@@ -174,10 +174,12 @@ throw ValueError("# Error: unknown code: " + this.nCompressionMethod); } //console.log(this.getInfo()); this.bOptNumSigle = true; this.bOptNumAtLast = false; + + this.aSuggState = new Set(); } getInfo () { return ` Language: ${this.sLangName} Lang code: ${this.sLangCode} Dictionary name: ${this.sDicName}\n` + ` Compression method: ${this.nCompressionMethod} Date: ${this.sDate} Stemming: ${this.cStemming}FX\n` + @@ -316,10 +318,11 @@ } else if (sWord.gl_isLowerCase()) { this._suggest(oSuggResult, sWord.gl_toCapitalize(), nMaxSwitch, nMaxDel, nMaxHardRepl); } let aSugg = oSuggResult.getSuggestions(nSuggLimit); + this.aSuggState.clear(); if (sSfx || sPfx) { // we add what we removed return aSugg.map( (sSugg) => { return sPfx + sSugg + sSfx } ); } return aSugg; @@ -335,10 +338,18 @@ for (let sTail of this._getTails(iAddr)) { oSuggResult.addSugg(sNewWord+sTail); } return; } + else if (sRemain.length < 4) { + let sState = sNewWord + ":" + sRemain; + if (this.aSuggState.has(sState)) { + return; + } + this.aSuggState.add(sState); + } + let cCurrent = sRemain.slice(0, 1); for (let [cChar, jAddr] of this._getCharArcs(iAddr)) { if (char_player.d1to1.gl_get(cCurrent, cCurrent).indexOf(cChar) != -1) { this._suggest(oSuggResult, sRemain.slice(1), nMaxSwitch, nMaxDel, nMaxHardRepl, nDeep+1, jAddr, sNewWord+cChar); }