NER 干扰 REGEXNER

NER interfere with REGEXNER

我使用 regexner 查找不在 Stanford NLP 默认集合中的命名实体,它工作正常。但是,当我添加 ner 注释器时,它会使用默认标记对与我的正则表达式匹配的标记进行注释。如何覆盖默认注释?

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)

}

如果您在 ner 注释器之后添加 regexner,它应该可以工作:

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