Skip to content

Commit

Permalink
Merge pull request #122 from dehilsterlexis/VISUALTEXT-FILES-099
Browse files Browse the repository at this point in the history
VISUALTEXT-FILES-099 fixed ambig functions in KBFuncs.nlp
  • Loading branch information
dehilsterlexis authored Jul 11, 2024
2 parents b199e0a + 183fc06 commit a3701e5
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,29 @@ JsonStr(L("str")) {
###############################################

AmbigTrimPOS(L("node"),L("pos")) {
L("con") = down(N("meaning",2));
L("meaning") = pnvar(L("node"),"meaning");
if (!L("meaning")) {
return;
}
L("con") = down(L("meaning"));
while (L("con")) {
if (strval(L("con"),"pos") == L("pos")) {
AmbigCopyAttrs(L("con"),N(2));
pnreplaceval(N(2),"pos num",1);
pnreplaceval(N(2),"meaning",L("con"));
pnremoveval(N(2),L("pos"));
L("p") = strval(L("con"),"pos");
if (L("p") == L("pos")) {
AmbigCopyAttrs(L("con"),L("node"));
pnreplaceval(L("node"),"pos num",1);
pnreplaceval(L("node"),"meaning",L("con"));
}
L("con") = next(L("con"));
}

L("names") = pnvarnames(L("node"));
while (L("names")[L("ii")]) {
L("name") = L("names")[ L("ii") ];
if (IsPOS(L("name")) && L("name") != L("pos")) {
pnremoveval(L("node"),L("name"));
}
L("ii")++;
}
}

AmbigCopyAttrs(L("con"),L("node")) {
Expand Down Expand Up @@ -511,6 +524,12 @@ AmbigCopyAttrs(L("con"),L("node")) {
}
}

IsPOS(L("pos")) {
if (L("pos") == "noun" || L("pos") == "verb" || L("pos") == "adj" || L("pos") == "adv" || L("pos") == "prep" || L("pos") == "pron" || L("pos") == "conj" || L("pos") == "det" || L("pos") == "num" || L("pos") == "int" || L("pos") == "art" || L("pos") == "pro" || L("pos") == "punct")
return 1;
return 0;
}

###############################################
# DICTIONARY FUNCTIONS (These are no longer needed. Relics of the past.)
###############################################
Expand Down

0 comments on commit a3701e5

Please sign in to comment.