Index: graphspell-js/ibdawg.js ================================================================== --- graphspell-js/ibdawg.js +++ graphspell-js/ibdawg.js @@ -275,13 +275,10 @@ isValid (sWord) { // checks if sWord is valid (different casing tested if the first letter is a capital) if (!sWord) { return true; } - if (sWord.includes("'")) { // ugly hack - sWord = sWord.replace("'", "’"); - } if (this.lookup(sWord)) { return true; } if (sWord.charAt(0).gl_isUpperCase()) { if (sWord.length > 1) { Index: graphspell-js/str_transform.js ================================================================== --- graphspell-js/str_transform.js +++ graphspell-js/str_transform.js @@ -24,11 +24,12 @@ } return lNgrams; }, _xTransCharsForSpelling: new Map([ - ['ſ', 's'], ['ffi', 'ffi'], ['ffl', 'ffl'], ['ff', 'ff'], ['ſt', 'ft'], ['fi', 'fi'], ['fl', 'fl'], ['st', 'st'] + ['ſ', 's'], ['ffi', 'ffi'], ['ffl', 'ffl'], ['ff', 'ff'], ['ſt', 'ft'], ['fi', 'fi'], ['fl', 'fl'], ['st', 'st'], + ["'", '’'] ]), spellingNormalization: function (sWord) { let sNewWord = ""; for (let c of sWord) { Index: graphspell/ibdawg.py ================================================================== --- graphspell/ibdawg.py +++ graphspell/ibdawg.py @@ -277,12 +277,10 @@ def isValid (self, sWord): "checks if is valid (different casing tested if the first letter is a capital)" if not sWord: return True - if "'" in sWord: # ugly hack - sWord = sWord.replace("'", "’") if self.lookup(sWord): return True if sWord[0:1].isupper(): if len(sWord) > 1: if sWord.istitle(): Index: graphspell/str_transform.py ================================================================== --- graphspell/str_transform.py +++ graphspell/str_transform.py @@ -19,11 +19,12 @@ #### WORD NORMALIZATION _xTransCharsForSpelling = str.maketrans({ - 'ſ': 's', 'ffi': 'ffi', 'ffl': 'ffl', 'ff': 'ff', 'ſt': 'ft', 'fi': 'fi', 'fl': 'fl', 'st': 'st' + 'ſ': 's', 'ffi': 'ffi', 'ffl': 'ffl', 'ff': 'ff', 'ſt': 'ft', 'fi': 'fi', 'fl': 'fl', 'st': 'st', + "'": '’' }) def spellingNormalization (sWord): "nomalization NFC and removing ligatures" return unicodedata.normalize("NFC", sWord.translate(_xTransCharsForSpelling))