2016-06-18 4 views
0

이전에 생성 된 태그를 기반으로 텍스트를 분류하기 위해 jape 규칙을 개발하려고합니다. 당신은 내가 특히 B와 C 예측하지만, 이러한 규칙은 여전히에도이 비록 예측 B을주고, 각 prediction에 대해 일치하는 여러 조건을 가지고 볼 수 있듯이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} 

:

그때 나는이 규칙을 만들 RECORD에있는 Indicator.rule == a입니다. 위의 규칙에서 이미이를 부정했다고 가정합니다.

내 코드에 어떤 문제가 있습니까?

도움을 주시면 감사하겠습니다.

고마워요 :)

답변

1

"notcontains"를 사용해 보셨습니까?

에서와 마찬가지로 :

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

는 내가 생각! "! RECORD contains indicator A"는 표시기 A가 들어있는 RECORD가 아닌 모든 것 (예 : 표시기 B가 들어있는 토큰 또는 RECORD)과 일치합니다.

notcontains를 사용하면 두 문장의 RECORD 주석이 동일하다는 것을 알 수 있습니다.

관련 문제