我正在尝试创建一个实体识别(NER)应用程序,我正在尝试采用词性标注(PoS)方法。
我正在尝试利用Python的NLTK库,并将其用作hmm_tagger=nltk.HiddenMarkovModelTagger.train(train_set)
。
在火车集中,我试图以Brown corpus的tagged_sents()格式提供数据。
如下所示,PoS标记
brown_a = nltk.corpus.brown.tagged_sents()[:2]
>>> brown_a
[[(u'The', u'AT'), (u'Fulton', u'NP-TL'), (u'County', u'NN-TL'), (u'Grand', u'JJ-TL'), (u'Jury', u'NN-TL'), (u'said', u'VBD'), (u'Friday', u'NR'), (u'an', u'AT'), (u'investigation', u'NN'), (u'of', u'IN'), (u"Atlanta's", u'NP$'), (u'recent', u'JJ'), (u'primary', u'NN'), (u'election', u'NN'), (u'produced', u'VBD'), (u'``', u'``'), (u'no', u'AT'), (u'evidence', u'NN'), (u"''", u"''"), (u'that', u'CS'), (u'any', u'DTI'), (u'irregularities', u'NNS'), (u'took', u'VBD'), (u'place', u'NN'), (u'.', u'.')], [(u'The', u'AT'), (u'jury', u'NN'), (u'further', u'RBR'), (u'said', u'VBD'), (u'in', u'IN'), (u'term-end', u'NN'), (u'presentments', u'NNS'), (u'that', u'CS'), (u'the', u'AT'), (u'City', u'NN-TL'), (u'Executive', u'JJ-TL'), (u'Committee', u'NN-TL'), (u',', u','), (u'which', u'WDT'), (u'had', u'HVD'), (u'over-all', u'JJ'), (u'charge', u'NN'), (u'of', u'IN'), (u'the', u'AT'), (u'election', u'NN'), (u',', u','), (u'``', u'``'), (u'deserves', u'VBZ'), (u'the', u'AT'), (u'praise', u'NN'), (u'and', u'CC'), (u'thanks', u'NNS'), (u'of', u'IN'), (u'the', u'AT'), (u'City', u'NN-TL'), (u'of', u'IN-TL'), (u'Atlanta', u'NP-TL'), (u"''", u"''"), (u'for', u'IN'), (u'the', u'AT'), (u'manner', u'NN'), (u'in', u'IN'), (u'which', u'WDT'), (u'the', u'AT'), (u'election', u'NN'), (u'was', u'BEDZ'), (u'conducted', u'VBN'), (u'.', u'.')]]
{这里brown_a的大小我们可能会增加。它仅作为示例给出。}
我现在正在尝试构建一个NER,我正在将数据改为
[[(u'The', u'NameP'), (u'Fulton', u'Name'), (u'County', u'NameC'), (u'Grand', u'NameCC'), (u'Jury', u'NameCCC'), (u'said', u'VBD'), (u'Friday', u'NR'), (u'an', u'AT'), (u'investigation', u'NA'), (u'of', u'NA'), (u"Atlanta's", u'Name'), (u'recent', u'NA'), (u'primary', u'NA'), (u'election', u'NA'), (u'produced', u'NA'), (u'``', u'NA'), (u'no', u'NA'), (u'evidence', u'NA'), (u"''", u"NA"), (u'that', u'NA'), ...]
在这里,我保留数据格式,但是将tagset更改为我的定义,NA for Not Available(任何不是NE的东西), NameP for Previous to Name, 姓名,等等。
我现在将这些新数据作为训练集和训练。
我的方法是否正常或我是否需要改变主要内容?
请建议。