Grammalecte  Diff

Differences From Artifact [942880b931]:

To Artifact [94477ac350]:


1449
1450
1451
1452
1453
1454
1455
1456

1457
1458
1459
1460
1461







1462
1463
1464
1465
1466
1467
1468
1449
1450
1451
1452
1453
1454
1455

1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475







-
+





+
+
+
+
+
+
+







    } else if (lDefault) {
        oToken["lMorph"] = lDefault;
    }
    return true;
}

function g_add_morph (oToken, sNewMorph) {
    "Disambiguation: add a morphology to a token"
    // Disambiguation: add a morphology to a token
    let lMorph = (oToken.hasOwnProperty("lMorph")) ? oToken["lMorph"] : _oSpellChecker.getMorph(oToken["sValue"]);
    lMorph.push(...sNewMorph.split("|"));
    oToken["lMorph"] = lMorph;
    return true;
}

function g_rewrite (dToken, sToReplace, sReplace) {
    // Disambiguation: rewrite morphologies
    let lMorph = (oToken.hasOwnProperty("lMorph")) ? oToken["lMorph"] : _oSpellChecker.getMorph(oToken["sValue"]);
    oToken["lMorph"] = lMorph.map(s => s.replace(sToReplace, sReplace));
    return true;
}

function g_define (oToken, sMorphs) {
    // set morphologies of <oToken>, always return true
    oToken["lMorph"] = sMorphs.split("|");
    return true;
}