Index: gc_core/js/ibdawg.js ================================================================== --- gc_core/js/ibdawg.js +++ gc_core/js/ibdawg.js @@ -39,12 +39,13 @@ throw TypeError("# Error. Not a pyfsa binary dictionary. Header: " + this.sHeader); } if (!(this.nVersion == "1" || this.nVersion == "2" || this.nVersion == "3")) { throw RangeError("# Error. Unknown dictionary version: " + this.nVersion); } - + // to get the value of an arc, to get the char of an arc with its value this.dChar = helpers.objectToMap(this.dChar); + this.dCharVal = this.dChar.gl_reverse(); //this.byDic = new Uint8Array(this.byDic); // not quicker, even slower if (this.cStemming == "S") { this.funcStemming = str_transform.getStemFromSuffixCode; } else if (this.cStemming == "A") { @@ -265,14 +266,14 @@ // return a list of suffixes ending at a distance of from let aTails = new Set(); for (let [nVal, jAddr] of this._getArcs(iAddr)) { if (nVal < this.nChar) { if (this._convBytesToInteger(this.byDic.slice(jAddr, jAddr+this.nBytesArc)) & this._finalNodeMask) { - aTails.add(sTail + this.dChar.get(nVal)); + aTails.add(sTail + this.dCharVal.get(nVal)); } if (n && aTails.size == 0) { - aTails.gl_update(this._getTails(jAddr, sTail+this.dChar.get(nVal), n-1)); + aTails.gl_update(this._getTails(jAddr, sTail+this.dCharVal.get(nVal), n-1)); } } } return aTails; } @@ -295,12 +296,12 @@ } * _getSimilarArcsAndCrushedChars (cChar, iAddr) { // generator: yield similar char of and address of the following node for (let [nVal, jAddr] of this._getArcs(iAddr)) { - if (this.dChar.get(nVal, null) in char_player.aVovels) { - yield [this.dChar[nVal], jAddr]; + if (this.dCharVal.get(nVal, null) in char_player.aVovels) { + yield [this.dCharVal[nVal], jAddr]; } } yield* this._getSimilarArcs(cChar, iAddr); } Index: gc_core/js/jsex_map.js ================================================================== --- gc_core/js/jsex_map.js +++ gc_core/js/jsex_map.js @@ -41,8 +41,16 @@ if (this.has(k)){ this.set(k, v); } } }; + + Map.prototype.gl_reverse = function () { + let dNewMap = new Map(); + this.forEach((val, key) => { + dNewMap.set(val, key); + }); + return dNewMap; + }; Map.prototype.grammalecte = true; } Index: gc_lang/fr/webext/gce_worker.js ================================================================== --- gc_lang/fr/webext/gce_worker.js +++ gc_lang/fr/webext/gce_worker.js @@ -286,11 +286,10 @@ if (!oDict) { postMessage(createResponse("getSpellSuggestions", "# Error. Dictionary not loaded.", dInfo, true)); return; } let aSugg = oDict.suggest(sWord); - console.log(aSugg); postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg}, dInfo, true)); } // Lexicographer