Grammalecte  Check-in [ed091d83b9]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[graphspell][js] fix time calculation for suggestions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | graphspell | nodejs
Files: files | file ages | folders
SHA3-256:ed091d83b9e0e610529ecf3fa6aae4cfcdb538040442aac80f7398e75ecbda9f
User & Date: olr 2018-10-17 13:30:29
Context
2018-10-17
13:43
[njs] Fix some case in cli check-in: e0cae3263f user: IllusionPerdu tags: njs, nodejs
13:30
[graphspell][js] fix time calculation for suggestions check-in: ed091d83b9 user: olr tags: graphspell, nodejs
2018-10-16
10:16
[njs] Add TF option Chg how to set option check-in: ee5d077740 user: IllusionPerdu tags: njs, nodejs
Changes

Changes to graphspell-js/ibdawg.js.

   318    318               }
   319    319           }
   320    320           return l;
   321    321       }
   322    322   
   323    323       suggest (sWord, nSuggLimit=10) {
   324    324           // returns a array of suggestions for <sWord>
   325         -	//console.time("Suggestions for " + sWord + ");
          325  +        //console.time("Suggestions for " + sWord);
   326    326           sWord = char_player.spellingNormalization(sWord);
   327    327           let sPfx = "";
   328    328           let sSfx = "";
   329    329           [sPfx, sWord, sSfx] = char_player.cut(sWord);
   330    330           let nMaxSwitch = Math.max(Math.floor(sWord.length / 3), 1);
   331    331           let nMaxDel = Math.floor(sWord.length / 5);
   332    332           let nMaxHardRepl = Math.max(Math.floor((sWord.length - 5) / 4), 1);
................................................................................
   334    334           let oSuggResult = new SuggResult(sWord);
   335    335           this._suggest(oSuggResult, sWord, nMaxSwitch, nMaxDel, nMaxHardRepl, nMaxJump);
   336    336           let aSugg = oSuggResult.getSuggestions(nSuggLimit);
   337    337           if (sSfx || sPfx) {
   338    338               // we add what we removed
   339    339               return aSugg.map( (sSugg) => { return sPfx + sSugg + sSfx; } );
   340    340           }
   341         -	//console.timeEnd("Suggestions for " + sWord + ");
          341  +        //console.timeEnd("Suggestions for " + sWord);
   342    342           return aSugg;
   343    343       }
   344    344   
   345    345       _suggest (oSuggResult, sRemain, nMaxSwitch=0, nMaxDel=0, nMaxHardRepl=0, nMaxJump=0, nDist=0, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=false) {
   346    346           // returns a set of suggestions
   347    347           // recursive function
   348    348           if (sRemain == "") {