多个负约束在 JAPE 中不起作用

Multiple negative constraints do not work in JAPE

我正在尝试开发 jape 规则以根据之前创建的标签对文本进行分类。

然后我创建这些规则:

//Prediction A
Rule: A_Predictor
(
    {RECORD contains {Indicator.rule == A}}
): predict_A
-->
:predict_A.Prediction = {prediction = A}


//Prediction B
Rule: B_Predictor
(
    {RECORD contains {Indicator.rule == B}, !RECORD contains {Indicator.rule == A}}
): predict_B
-->
:predict_B.Prediction = {prediction = B}

//Prediction C
Rule: C_Predictor
(
    {RECORD contains {Indicator.rule == C}, !RECORD contains {Indicator.rule == A}, !RECORD contains {Indicator.rule == B}}
): predict_C
-->
:predict_C.Prediction = {prediction = C}

如您所见,我有多个条件可以匹配每个 prediction,尤其是预测 B 和 C。但是,即使有 [=13],这些规则仍然给出预测 B =] 在 RECORD 中,我假设我已经在上面的规则中否定了它。

我的代码有什么问题?

任何帮助将不胜感激。

谢谢:)

你试过了吗"notContains"?

如:

Rule: B_Predictor
(
    {RECORD contains {Indicator.rule == B}, RECORD notContains {Indicator.rule == A}}
): predict_B
-->
:predict_B.Prediction = {prediction = B}

我觉得!否定整个语句,“!RECORD 包含指示符 A”将匹配任何不是包含指示符 A 的 RECORD 的内容(例如包含指示符 B 的 Token 或 RECORD)。

对于 notContains,您还知道它在两个语句中是相同的 RECORD 注释。