问题
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