Grammalecte  Diff

Differences From Artifact [e41e56dec1]:

To Artifact [8fe9942358]:


   450    450       }
   451    451       aSugg.delete("");
   452    452       if (aSugg.size > 0) {
   453    453           return Array.from(aSugg).join("|");
   454    454       }
   455    455       return "";
   456    456   }
          457  +
          458  +function g_suggAgree (dTokenDst, dTokenSrc) {
          459  +    // returns suggestions for <dTokenDst> that matches agreement with <dTokenSrc>
          460  +    let lMorphSrc = oTokenSrc.hasOwnProperty("lMorph") ? oTokenSrc["lMorph"] : gc_engine.oSpellChecker.getMorph(oTokenSrc["sValue"]);
          461  +    if (lMorphSrc.length === 0) {
          462  +        return "";
          463  +    }
          464  +    let [sGender, sNumber] = cregex.getGenderNumber(lMorphSrc);
          465  +    if (sGender == ":m") {
          466  +        if (sNumber == ":s") {
          467  +            return suggMasSing(dTokenDst["sValue"]);
          468  +        }
          469  +        else if (sNumber == ":p") {
          470  +            return suggMasPlur(dTokenDst["sValue"]);
          471  +        }
          472  +        return suggMasSing(dTokenDst["sValue"]);
          473  +    }
          474  +    else if (sGender == ":f") {
          475  +        if (sNumber == ":s") {
          476  +            return suggFemSing(dTokenDst["sValue"]);
          477  +        }
          478  +        else if (sNumber == ":p") {
          479  +            return suggFemPlur(dTokenDst["sValue"]);
          480  +        }
          481  +        return suggFemSing(dTokenDst["sValue"]);
          482  +    }
          483  +    else if (sGender == ":e") {
          484  +        if (sNumber == ":s") {
          485  +            return suggSing(dTokenDst["sValue"]);
          486  +        }
          487  +        else if (sNumber == ":p") {
          488  +            return suggPlur(dTokenDst["sValue"]);
          489  +        }
          490  +        return dTokenDst["sValue"];
          491  +    }
          492  +    return "";
          493  +}
   457    494   
   458    495   function hasFemForm (sFlex) {
   459    496       for (let sStem of gc_engine.oSpellChecker.getLemma(sFlex)) {
   460    497           if (mfsp.isMasForm(sStem) || conj.hasConj(sStem, ":PQ", ":Q3")) {
   461    498               return true;
   462    499           }
   463    500       }