2012-07-04 47 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.