Grammalecte  Check-in [6ff5d2733a]

Overview
Comment:[fr][js] suggestion des graphies similaires
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr
Files: files | file ages | folders
SHA3-256: 6ff5d2733ac240ace0ed095f651f78c4d8d4e44ae411d8881e8e3cd6fe59eac1
User & Date: olr on 2017-10-10 13:40:13
Other Links: manifest | tags
Context
2017-10-10
15:51
[fr] sécurisation d’une condition check-in: 79a81f04cf user: olr tags: fr, trunk
14:30
merge trunk check-in: d25e2ed843 user: olr tags: webext3
13:40
[fr][js] suggestion des graphies similaires check-in: 6ff5d2733a user: olr tags: fr, trunk
13:09
[fr] pt: faire illusion check-in: 9680cc2a5f user: olr tags: fr, trunk
Changes

Modified gc_lang/fr/modules-js/conj.js from [57af7c3c72] to [20daa8dfaa].

    79     79           // returns raw informations about sVerb
    80     80           if (!this._dVerb.hasOwnProperty(sVerb)) {
    81     81               return null;
    82     82           }
    83     83           return this._lVtyp[this._dVerb[sVerb][0]];
    84     84       },
    85     85   
    86         -    getSimil: function (sWord, sMorph, sFilter=null) {
           86  +    getSimil: function (sWord, sMorph, bSubst=false) {
    87     87           if (!sMorph.includes(":V")) {
    88     88               return new Set();
    89     89           }
    90     90           let sInfi = sMorph.slice(1, sMorph.indexOf(" "));
    91     91           let tTags = this._getTags(sInfi);
    92     92           let aSugg = new Set();
    93         -        if (sMorph.includes(":Q") || sMorph.includes(":Y")) {
           93  +        if (!bSubst) {
    94     94               // we suggest conjugated forms
    95     95               if (sMorph.includes(":V1")) {
    96     96                   aSugg.add(sInfi);
    97     97                   aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":3s"));
    98     98                   aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":2p"));
    99     99                   aSugg.add(this._getConjWithTags(sInfi, tTags, ":Iq", ":1s"));
   100    100                   aSugg.add(this._getConjWithTags(sInfi, tTags, ":Iq", ":3s"));
................................................................................
   122    122               aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q3"));
   123    123               aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q4"));
   124    124               aSugg.delete("");
   125    125               // if there is only one past participle (epi inv), unreliable.
   126    126               if (aSugg.size === 1) {
   127    127                   aSugg.clear();
   128    128               }
   129         -            if (sMorph.includes(":V1")) {
   130         -                aSugg.add(sInfi);
   131         -            }
   132    129           }
   133    130           return aSugg;
   134    131       },
   135    132   
   136    133       _getTags: function (sVerb) {
   137    134           // returns tuple of tags (usable with functions _getConjWithTags and _hasConjWithTags)
   138    135           if (!this._dVerb.hasOwnProperty(sVerb)) {

Modified gc_lang/fr/modules-js/gce_suggestions.js from [0d3c06e52f] to [a844f36535].

   486    486       return "";
   487    487   }
   488    488   
   489    489   function hasSimil (sWord, sPattern=null) {
   490    490       return phonet.hasSimil(sWord, sPattern);
   491    491   }
   492    492   
   493         -function suggSimil (sWord, sPattern) {
          493  +function suggSimil (sWord, sPattern=null, bSubst=false) {
   494    494       // return list of words phonetically similar to sWord and whom POS is matching sPattern
   495    495       let aSugg = phonet.selectSimil(sWord, sPattern);
   496    496       for (let sMorph of _dAnalyses.gl_get(sWord, [])) {
   497         -        for (let e of conj.getSimil(sWord, sMorph, sPattern)) {
   498         -            aSugg.add(e); 
          497  +        for (let e of conj.getSimil(sWord, sMorph, bSubst)) {
          498  +            aSugg.add(e);
   499    499           }
   500    500       }
   501    501       if (aSugg.size > 0) {
   502    502           return Array.from(aSugg).join("|");
   503    503       }
   504    504       return "";
   505    505   }

Modified gc_lang/fr/modules-js/phonet.js from [b4e35b2c18] to [409fa52cbe].

    62     62                   return this._lSet[this._dWord.get(sWord)];
    63     63               }
    64     64           }
    65     65           return [];
    66     66       },
    67     67   
    68     68       selectSimil: function (sWord, sPattern) {
    69         -        // return list of words phonetically similar to sWord and whom POS is matching sPattern
           69  +        // return a set of words phonetically similar to sWord and whom POS is matching sPattern
    70     70           if (!sPattern) {
    71     71               return new Set(this.getSimil(sWord));
    72     72           }
    73     73           let aSelect = new Set();
    74     74           for (let sSimil of this.getSimil(sWord)) {
    75     75               for (let sMorph of this._dMorph.gl_get(sSimil, [])) {
    76     76                   if (sMorph.search(sPattern) >= 0) {