Index: gc_core/js/lang_core/gc_engine.js ================================================================== --- gc_core/js/lang_core/gc_engine.js +++ gc_core/js/lang_core/gc_engine.js @@ -1261,11 +1261,12 @@ function select (dTokenPos, nPos, sWord, sPattern, lDefault=null) { if (!sWord) { return true; } - if (dTokenPos.has(nPos)) { + if (!dTokenPos.has(nPos)) { + console.log("Error. There should be a token at this position: ", nPos); return true; } let lMorph = _oSpellChecker.getMorph(sWord); if (lMorph.length === 0 || lMorph.length === 1) { return true; @@ -1283,11 +1284,12 @@ function exclude (dTokenPos, nPos, sWord, sPattern, lDefault=null) { if (!sWord) { return true; } - if (dTokenPos.has(nPos)) { + if (!dTokenPos.has(nPos)) { + console.log("Error. There should be a token at this position: ", nPos); return true; } let lMorph = _oSpellChecker.getMorph(sWord); if (lMorph.length === 0 || lMorph.length === 1) { return true; @@ -1319,11 +1321,11 @@ dToken["lMorph"] = lDefault; } return true; } let lSelect = lMorph.filter( sMorph => sMorph.search(sPattern) !== -1 ); - if (lSelect) { + if (lSelect.length > 0) { if (lSelect.length != lMorph.length) { dToken["lMorph"] = lSelect; } } else if (lDefault) { dToken["lMorph"] = lDefault; @@ -1339,11 +1341,11 @@ dToken["lMorph"] = lDefault; } return true; } let lSelect = lMorph.filter( sMorph => sMorph.search(sPattern) === -1 ); - if (lSelect) { + if (lSelect.length > 0) { if (lSelect.length != lMorph.length) { dToken["lMorph"] = lSelect; } } else if (lDefault) { dToken["lMorph"] = lDefault;