Grammalecte  Diff

Differences From Artifact [e69e781426]:

To Artifact [c7763dfdd8]:


603
604
605
606
607
608
609
610

611
612
613
614
615
616

617



618
619










620
621
622
623
624
625
626
603
604
605
606
607
608
609

610
611
612
613
614
615

616
617
618
619
620


621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637







-
+





-
+

+
+
+
-
-
+
+
+
+
+
+
+
+
+
+







}

function hasSimil (sWord, sPattern=null) {
    return phonet.hasSimil(sWord, sPattern);
}

function suggSimil (sWord, sPattern=null, bSubst=false, bVC=false) {
    // return list of words phonetically similar to sWord and whom POS is matching sPattern
    // return list of words phonetically similar to <sWord> and whom POS is matching <sPattern>
    let sSfx;
    if (bVC) {
        [sWord, sSfx] = splitVerb(sWord);
    }
    let aSugg = phonet.selectSimil(sWord, sPattern);
    if (aSugg.size === 0 || !bSubst) {
    if (aSugg.size === 0 && bSubst) {
        for (let sMorph of gc_engine.oSpellChecker.getMorph(sWord)) {
            if (sMorph.includes(":V")) {
                let sInfi = sMorph.slice(1, sMorph.indexOf("/"));
                if (sPattern) {
            for (let e of conj.getSimil(sWord, sMorph, bSubst)) {
                aSugg.add(e);
                    for (let sName of conj.getNamesFrom(sInfi)) {
                        if (_oSpellChecker.getMorph(sName).some(sMorph => (sMorph.search(sPattern) !== -1))) {
                            aSugg.add(sName);
                        }
                    }
                }
                else {
                    conj.getNamesFrom(sInfi).forEach(sName => aSugg.add(sName));
                }
                break;
            }
        }
    }
    if (aSugg.size > 0) {
        if (bVC) {
            return Array.from(aSugg).map((sSugg) => joinVerbAndSuffix(sSugg, sSfx)).join("|");
        }