Stanford nlp TokensRegex模式与用户定义的“否定”;“宏”;
我正在构建一个TokensRegex表达式,用于捕获“W Mullholland Drive”中“N Maple St”形式的文本。当前表达式如下所示:Stanford nlp TokensRegex模式与用户定义的“否定”;“宏”;,stanford-nlp,Stanford Nlp,我正在构建一个TokensRegex表达式,用于捕获“W Mullholland Drive”中“N Maple St”形式的文本。当前表达式如下所示: { ruleType: "tokens", pattern: (/[A-Z]/ ([{ner:PERSON}|{tag:NNP}])+), result: Concat($$0.text, "=", "STREET") } 然而,这也抓住了像“本田雅阁”这样的文字。我为所有不同的汽车品牌定义了一个宏,类似于: $VEHICLES = "/[H
{
ruleType: "tokens",
pattern: (/[A-Z]/ ([{ner:PERSON}|{tag:NNP}])+),
result: Concat($$0.text, "=", "STREET")
}
然而,这也抓住了像“本田雅阁”这样的文字。我为所有不同的汽车品牌定义了一个宏,类似于:
$VEHICLES = "/[Hh]onda|[Tt]oyota/"
我想将$VEHICLES宏的否定合并到TokensRegex表达式中,即上面的模式部分检查{ner:PERSON}或{tag:NNP}标记捕获的文本是否与$VEHICLES宏匹配,如果匹配,则它不是有效的匹配
视觉上
{
ruleType: "tokens",
pattern: (/[A-Z]/ ((([{ner:PERSON}|{tag:NNP}])&(!$VEHICLES))+),
// Matches the letter and the tokens and NOT anything in the macro.
// This pattern causes a ParseException when running CoreMapExpressionExtractor.createExtractorFromFile
// in my pipeline code.
result: Concat($$0.text, "=", "STREET")
}
TokensRegex中是否支持此功能