Python 如何定义和理解brill词性标注器中的规则和模板?
我正试图在nltk词性标注上弄脏我的手。我使用的是brill tagger,它创建了一系列规则。我的模板如下:-Python 如何定义和理解brill词性标注器中的规则和模板?,python,machine-learning,nltk,pos-tagger,Python,Machine Learning,Nltk,Pos Tagger,我正试图在nltk词性标注上弄脏我的手。我使用的是brill tagger,它创建了一系列规则。我的模板如下:- templates = [ Template(Pos(1,1)), Template(Pos(2,2)), Template(Pos(1,2)), Template(Pos(1,3)), Template(Word(1,1)), Template(Word(2,2)), Template(Word(1,2)), Temp
templates = [
Template(Pos(1,1)),
Template(Pos(2,2)),
Template(Pos(1,2)),
Template(Pos(1,3)),
Template(Word(1,1)),
Template(Word(2,2)),
Template(Word(1,2)),
Template(Word(1,3)),
Template(Pos(-1, -1), Pos(1,1)),
Template(Word(-1, -1), Word(1,1))
]
我的规则表如下所示:-
Found 149 useful rules.
B |
S F r O | Score = Fixed - Broken
c i o t | R Fixed = num tags changed incorrect -> correct
o x k h | u Broken = num tags changed correct -> incorrect
r e e e | l Other = num tags changed incorrect -> incorrect
e d n r | e
------------------+-------------------------------------------------------
24 24 0 1 | VB->VBP if Pos:NN@[1]
14 14 0 2 | JJ->NN if Pos:CD@[1]
14 14 0 0 | NN->VBP if Pos:NNS@[1,2,3]
11 11 0 0 | TO->IN if Pos:NN@[1,2]
9 9 0 0 | JJ->VBP if Pos:NN@[1]
1 1 0 0 | TO->IN if Pos:VB@[1]
1 1 0 0 | VBP->NN if Word:my_group@[1]
我在理解规则上有问题。
例如,如果位置为NNS@[1,2,3]NN->VBP
我的问题是:-
- 这是否意味着,如果给定句子中1、2或3个位置的词性标记是名词,则将NN转换为动词
- 1、2和3是相对于给定句子中的当前标记,还是暗示标记位于绝对索引1、2或3
- 模板与规则的关系如何?我的意思是,如果Pos:NNS@[1,2,3]
提前谢谢。问得好!!