1

我尝试向 CRF++ 模板添加更多功能。

根据How can I tell CRF++ classifier that a word x is captilized or understand punctuations?

训练样本

The  DT  0  1   0   1   B-MISC
Oxford  NNP 0   1   0   1   I-MISC
Companion   NNP 0   1   0   1   I-MISC
to  TO  0   0   0   0   I-MISC
Philosophy  NNP 0   1   0   1   I-MISC

特征模板

# 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]
U07:%x[-2,0]/%x[-1,0]/%x[0,0]

#shape feature
U08:%x[-2,2]
U09:%x[-1,2]
U10:%x[0,2]
U11:%x[1,2]
U12:%x[2,2]

B

训练阶段没问题。但我没有得到 crf_test 的输出

tilney@ubuntu:/data/wikipedia/en$ crf_test -m validation_model test.data
tilney@ubuntu:/data/wikipedia/en$ 

如果忽略上面的形状,一切正常。我哪里做错了?

4

1 回答 1

1

我想通了。这是我的测试数据的问题。我认为每个特征都应该取自经过训练的模型,所以我的测试数据中只有两列:word tag,结果证明测试文件应该与训练数据具有完全相同的格式!

于 2014-12-09T06:46:29.177 回答