我正在尝试使用 Stanford POS-tagger,我想问一下是否可以解析(实际上只有 pos 标签就足够了)英文文本并以 conll 格式输出结果。有这样的选择吗?
我正在使用 Stanford pos tagger 的完整 3.2.0 版本
非常感谢
最佳答案
当谈到 CONLL 格式时,我想您指的是 CONLL2000 分块任务格式:
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
CONLL分块任务格式一共有三列:
token
(即单词)POS
标签BIO
(begin, inside, outside) block /短语标签
遗憾的是,如果您使用 stanford MaxEnt 标记器,它只会给您token
和POS
信息,但没有BIO
block 信息。
java -cp stanford-postagger.jar edu.stanford.nlp.tagger.maxent.MaxentTagger -model models/left3words-wsj-0-18.tagger -textFile short.txt -outputFormat tsv 2> /dev/null
使用上面的命令,Stanford POS 标记器已经为您提供了制表符分隔格式,只是它没有第 3 列(请参阅 http://nlp.stanford.edu/software/pos-tagger-faq.shtml):
He PRP
reckons VBZ
the DT
...
要获得 BIO
列,您需要要么:
- 一个统计组 block 器或
- 一个完整的解析器
请参阅 http://www-nlp.stanford.edu/links/statnlp.html 以获取分块器/解析器列表,如果您想坚持使用斯坦福工具,我建议使用斯坦福解析器,但它为您提供了括号内的解析格式,您必须进行一些后处理才能将其放入 CONLL2000格式,见http://nlp.stanford.edu/software/lex-parser.shtml
关于nlp - 以conll格式输出结果(POS-tagging, stanford pos tagger),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18948712/