NER interfere with REGEXNER

时光总嘲笑我的痴心妄想 提交于 2019-12-12 17:08:53

问题


I use regexner to find named entities that are not in the default set of Stanford NLP and it works fine. However, when I add ner annotator, it annotates tokens that match my regular expression with default tags. How can I overwrite default annotations?

def createNLPPipelineRegex(): StanfordCoreNLP = {
     val props = new Properties()
     props.put("regexner.mapping", "regex.txt")
     props.put("annotators", "tokenize, ssplit, regexner, pos, lemma, ner")
     props.put("tokenize.options", "untokenizable=noneKeep,normalizeParentheses=false")
     new StanfordCoreNLP(props)

}


回答1:


If you add regexner after the ner annotator it should work:

props.put("annotators", "tokenize, ssplit, pos, lemma, ner, regexner")


来源:https://stackoverflow.com/questions/32642008/ner-interfere-with-regexner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!