474
475
476
477
478
479
480
481
482
483
484
485
486
487
|
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if (bDebug) {
console.log(" MATCH: >" + sLemma);
}
yield { "iToken1": iToken1, "iNode": oNode["<lemmas>"][sLemma] };
bTokenFound = true;
}
}
}
// phonetic similarity
if (oNode.hasOwnProperty("<phonet>")) {
for (let sPhonet in oNode["<phonet>"]) {
if (sPhonet.endsWith("!")) {
let sPhon = sPhonet.slice(0,-1);
if (oToken["sValue"] == sPhon) {
continue;
}
if (oToken["sValue"].slice(0,1).gl_isUpperCase()) {
if (oToken["sValue"].toLowerCase() == sPhon) {
continue;
}
if (oToken["sValue"].gl_isUpperCase() && oToken["sValue"].gl_toCapitalize() == sPhon) {
continue;
}
}
}
if (phonet.isSimilAs(oToken["sValue"], sPhonet.gl_trimRight("!"))) {
if (bDebug) {
console.log(" MATCH: %" + sPhonet);
}
yield { "iToken1": iToken1, "iNode": oNode["<phonet>"][sPhonet] };
bTokenFound = true;
}
}
}
// morph arcs
if (oNode.hasOwnProperty("<morph>")) {
let lMorph = (oToken.hasOwnProperty("lMorph")) ? oToken["lMorph"] : gc_engine.oSpellChecker.getMorph(oToken["sValue"]);
if (lMorph.length > 0) {
for (let sSearch in oNode["<morph>"]) {
if (!sSearch.includes("¬")) {
|