0
0

More than 1 year has passed since last update.

I-measureを今時動かす

Last updated at Posted at 2023-07-05

文法誤り訂正の評価尺度 I-measure (https://github.com/mfelice/imeasure) を今時動かす方法を紹介します。どうも、python2が使われていた時代は普通に動いていたみたいなんですが、現在python2で動かそうと思うと少し難しいです。

python 2.7の環境を用意

conda create -n p27 python=2.7
conda activate p27

elementtreeをインストール

公式のリンクからwgetするとファイルが壊れる。

wget https://src.fedoraproject.org/repo/pkgs/python-elementtree/elementtree-1.2.6-20050316.tar.gz/md5/e1b21716be8bfff8bf192fc3880ad008/elementtree-1.2.6-20050316.tar.gz
tar zxvf elementtree-1.2.6-20050316.tar.gz
cd elementtree-1.2.6-20050316
python setup.py install

nltkをインストール

pipだと入らない。

conda install nltk -c intel

numpyをインストール

python -m pip install numpy

M2をxmlに変換

python m2_to_ixml.py -in:official-2014.combined.m2 -out:official-2014.combined.xml

I-measureを実行

$ python ieval.py -ref:official-2014.combined.xml -hyp:AMU -nomix
---------------------------------------------------------------------------------------------------------------------
Hypothesis file    : AMU
Gold standard file : official-2014.combined.xml
Maximising metric  : WACC - CORRECTION
Optimise for       : SENTENCE
WAcc weight        : 2.0
F beta             : 1.0
---------------------------------------------------------------------------------------------------------------------

OVERALL RESULTS
---------------------------------------------------------------------------------------------------------------------
Aspect            TP      TN      FP      FN     FPN       P       R  F_1.00     Acc   Acc_b    WAcc  WAcc_b       I 
---------------------------------------------------------------------------------------------------------------------
Detection        620   27350     752    2158       0   45.19   22.32   29.88   90.58   90.99   88.65   90.99   -2.57
Correction       484   27350     888    2294     136   35.28   17.42   23.33   90.14   90.99   87.99   90.99   -3.30

-nomixをつけると元の論文と値が変わってしまう気がするんですが、つけないと数百GBのメモリを使い果たした上にkillされてしまったので、どうしたらいいのかよくわかりません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0