; CRF node-format-crf = %m\s%f[6]-%F-[0,1,2,3]\n unk-format-crf = %m\sOTHER-%F-[0,1,2,3]\n
固有表現抽出の学習
8 -記号-空白 O 大久保 43 大久保-名詞-固有名詞-人名-姓 B-HUMAN 8 -記号-空白 I-HUMAN え 2 え-感動詞 I-HUMAN ○ 4 ○-記号-一般 I-HUMAN こ 38 こ-名詞-一般 I-HUMAN 8 -記号-空白 O O
#IOBタグ #B: チャンクの先頭 #E: チャンクの末尾 #I : チャンクの内部 #S: 一つの語でチャンクを構成する #O: チャンクの外部
Rockwell NNP B-NP International NNP I-NP Corp. NNP I-NP 's POS B-NP Tulsa NNP I-NP unit NN I-NP said VBD B-VP it PRP B-NP signed VBD B-VP実際のファイル
$ cat train.data
He PRP B-NP reckons VBZ B-VP the DT B-NP current JJ I-NP account NN I-NP deficit NN I-NP will MD B-VP narrow VB I-VP to TO B-PP only RB B-NP # # I-NP 1.8 CD I-NP billion CD I-NP in IN B-PP September NNP B-NP . . O He PRP B-NP reckons VBZ B-VP
$ cat template
# Unigram U00:%x[-2,0] U01:%x[-1,0] U02:%x[0,0] U03:%x[1,0] U04:%x[2,0] U05:%x[-1,0]/%x[0,0] U06:%x[0,0]/%x[1,0] U10:%x[-2,1] U11:%x[-1,1] U12:%x[0,1]q U13:%x[1,1] U14:%x[2,1] U15:%x[-2,1]/%x[-1,1] U16:%x[-1,1]/%x[0,1] U17:%x[0,1]/%x[1,1] U18:%x[1,1]/%x[2,1] U20:%x[-2,1]/%x[-1,1]/%x[0,1] U21:%x[-1,1]/%x[0,1]/%x[1,1] U22:%x[0,1]/%x[1,1]/%x[2,1]
$ crf_learn -a MIRA template train.data model
CRF++: Yet Another CRF Tool Kit Copyright(C)2005-2007 Taku Kudo, All rights reserved. reading training data: Done!0.00 s Number of sentences: 2 Number of features: 1800 Number of thread(s): 1 Freq: 1 eta: 0.00010 C: 1.00000 shrinking size: 20 Algorithm: MIRA iter=0 terr=0.66667 serr=0.50000 act=2 uact=0 obj=0.30126 kkt=12.00000 iter=1 terr=0.16667 serr=0.50000 act=2 uact=0 obj=0.36494 kkt=2.84937 iter=2 terr=0.00000 serr=0.00000 act=2 uact=0 obj=0.36494 kkt=0.00000 iter=3 terr=0.00000 serr=0.00000 act=2 uact=0 obj=0.36494 kkt=0.00000 Done!0.00 s
$ crf_test -m model test.data
He PRP B-NP B-NP reckons VBZ B-VP B-VP the DT B-NP B-NP current JJ I-NP I-NP account NN I-NP I-NP deficit NN I-NP I-NP will MD B-VP B-VP narrow VB I-VP I-VP to TO B-PP B-PP only RB B-NP B-NP # # I-NP I-NP 1.8 CD I-NP I-NP billion CD I-NP I-NP in IN B-PP B-PP September NNP B-NP B-NP . . O O He PRP B-NP B-NP reckons VBZ B-VP B-VP