我正在使用这个自定义的特征生成器:
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的代码,但没有找到关于如何提取此生成器生成的特征的任何信息。
所以问题是,在我的模型的生成器列表中添加此生成器后,如何提取特征以了解哪些标记与我的字典中的条目匹配?
谢谢!
回答:
机器学习特征并不能保证标记会被标记为命名实体。这就像在标记上放置一个标志,表明该标记出现在字典中,但它仍然需要与其他特征一起进行评估。
你可以使用DictionaryNameFinder来跳过机器学习过程。