2012-07-04 31 views
4

我正在构建一个15k行培训数据文档,名为:en-ner-person.train,按照在线手册(http://opennlp.apache.org/documentation/1.5.2-incubating/manual /opennlp.html)。打开NLP名称查找器培训

我的问题是:在我的培训文档中,是否包含整个报告?或者,我是否只包含名称为<START:person> John Smith <END>的行?

因此,例如,我在我的训练数据使用此报告全文:

<START:person> Pierre Vinken <END> , 61 years old , will join the board as a nonexecutive director Nov. 29 . 
A nonexecutive director has many similar responsibilities as an executive director. 
However, there are no voting rights with this position. 
Mr . <START:person> Vinken <END> is chairman of Elsevier N.V. , the Dutch publishing group . 

还是我只包括我的培训文件中这两行:

<START:person> Pierre Vinken <END> , 61 years old , will join the board as a nonexecutive director Nov. 29 . 
Mr . <START:person> Vinken <END> is chairman of Elsevier N.V. , the Dutch publishing group . 

回答

7

您应该使用整个报告。这将有助于系统学习何时不标记实体,从而提高虚假负面评分。

您可以使用evaluation tool进行测量。保留一些你的语料库的句子进行测试,例如总数的1/10,并使用其他9/10句子训练你的模型。您可以尝试使用整个报告进行训练,而使用只有名称的句子进行训练。结果将依据precision and recall

记住要保留整个报告的测试样本,而不仅仅是带有名称的句子,否则你将无法准确测量模型如何使用没有名字的句子。

2

我会包括所有的东西,尽管它可能不会对训练模型中的权重有所贡献。

培训文件中是否使用了什么是由用于训练模型的特征生成器决定的。如果你到了实际调整特征生成器的地步,那么你至少不需要重新构建你的训练文件,如果它已经包含了所有内容的话。

从文档这个例子功能发生器也恰好是用于名称发现者在代码中默认的:Custom Feature Generation

AdaptiveFeatureGenerator featureGenerator = new CachedFeatureGenerator(
     new AdaptiveFeatureGenerator[]{ 
      new WindowFeatureGenerator(new TokenFeatureGenerator(), 2, 2), 
      new WindowFeatureGenerator(new TokenClassFeatureGenerator(true), 2, 2), 
      new OutcomePriorFeatureGenerator(), 
      new PreviousMapFeatureGenerator(), 
      new BigramNameFeatureGenerator(), 
      new SentenceFeatureGenerator(true, false) 
      }); 

我不能完全解释的代码,glob和避风港” t在它上面发现了很好的文档或者通过源代码来了解它,但是那里的WindowFeatureGenerator考虑了令牌和令牌的类别(例如,如果该令牌已经被标记为人)+/- 2个位置之前和之后的位置令牌正在被检查。

因此,不包含实体的句子中的标记可能会对一个句子产生影响。通过裁剪额外的句子,你可能会训练你的模型有非自然模式,比如以名字结尾的句子,然后是一个以这样的名字开头的句子:

The car fell on <START:person> Pierre Vinken <END>. <START:person> Pierre Vinken<END> is the chairman.