Index: graphspell-js/ibdawg.js ================================================================== --- graphspell-js/ibdawg.js +++ graphspell-js/ibdawg.js @@ -364,11 +364,11 @@ for (let sTail of this._getTails(iAddr)) { oSuggResult.addSugg(sNewWord+sTail); } return; } - else if (this.isValid(sRemain)) { + else if (this.isValid(sRemain) && oSuggResult.sWord.startsWith(sNewWord)) { oSuggResult.addSugg(sNewWord+" "+sRemain); } } if (nDist > oSuggResult.nDistLimit) { return; Index: graphspell/ibdawg.py ================================================================== --- graphspell/ibdawg.py +++ graphspell/ibdawg.py @@ -327,11 +327,11 @@ if not sRemain: oSuggResult.addSugg(sNewWord, nDeep) for sTail in self._getTails(iAddr): oSuggResult.addSugg(sNewWord+sTail, nDeep) return - elif self.isValid(sRemain): + elif self.isValid(sRemain) and oSuggResult.sWord.startswith(sNewWord): oSuggResult.addSugg(sNewWord+" "+sRemain) if nDist > oSuggResult.nDistLimit: return cCurrent = sRemain[0:1] for cChar, jAddr in self._getCharArcs(iAddr):