2016-08-17 47 views
0

我使用這個自定義featureGenerator:如何從OpenNLP生成器中提取特徵?

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), 
       new DictionaryFeatureGenerator("person", dictionary) 
       }); 

我只加了DictionaryFeatureGenerator有幾個項目:

Dictionary dictionary = new Dictionary(); 
    dictionary.put(new StringList(new String[]{"giovanni"})); 
    dictionary.put(new StringList(new String[]{"maria"})); 
    dictionary.put(new StringList(new String[]{"luca"})); 

我想看看DictionaryFeatureGenerator.java代碼,但我沒有發現任何東西關於該生成器的生成特徵的提取。

所以問題是,在我的模型生成器列表中添加此生成器後,如何提取功能以瞭解什麼標記匹配我的字典條目?

謝謝!

回答

1

機器學習功能並不保證令牌將被標記爲命名實體。這就像在標記中加入一個標記,表示該標記出現在字典中,但仍需要使用其他功能進行評估。

您可以使用DictionaryNameFinder跳過機器學習。