Index: graphspell-js/char_player.js ================================================================== --- graphspell-js/char_player.js +++ graphspell-js/char_player.js @@ -361,15 +361,23 @@ ]), cut: function (sWord) { // returns an arry of strings (prefix, trimed_word, suffix) - let m = /^([a-zA-Zà-öÀ-Ö0-9_ø-ÿØ-ßĀ-ʯfi-st]+)(-(?:t-|)(?:ils?|elles?|on|je|tu|nous|vous|ce)$)/.exec(sWord); + let sPrefix = ""; + let sSuffix = ""; + let m = /^([ldmtsnjcç]|lorsqu|presqu|jusqu|puisqu|quoiqu|quelqu|qu)[’'‘`]([a-zA-Zà-öÀ-Ö0-9_ø-ÿØ-ßĀ-ʯfi-st-]+)/i.exec(sWord); + if (m) { + sPrefix = m[1] + "’"; + sWord = m[2]; + } + m = /^([a-zA-Zà-öÀ-Ö0-9_ø-ÿØ-ßĀ-ʯfi-st]+)(-(?:t-|)(?:ils?|elles?|on|je|tu|nous|vous|ce)$)/i.exec(sWord); if (m) { - return ["", m[1], m[2]]; + sWord = m[1]; + sSuffix = m[2]; } - return ["", sWord, ""]; + return [sPrefix, sWord, sSuffix]; }, // Other functions filterSugg: function (aSugg) { return aSugg.filter((sSugg) => { return !sSugg.endsWith("è") && !sSugg.endsWith("È"); }); Index: graphspell/char_player.py ================================================================== --- graphspell/char_player.py +++ graphspell/char_player.py @@ -350,18 +350,26 @@ aPfx2 = frozenset([ "belgo", "franco", "génito", "gynéco", "médico", "russo" ]) -_zMotAvecPronom = re.compile("^(?i)(\\w+)(-(?:t-|)(?:ils?|elles?|on|je|tu|nous|vous|ce))$") +_zWordPrefixes = re.compile("(?i)^([ldmtsnjcç]|lorsqu|presqu|jusqu|puisqu|quoiqu|quelqu|qu)[’'‘`]([\\w-]+)") +_zWordSuffixes = re.compile("(?i)^(\\w+)(-(?:t-|)(?:ils?|elles?|on|je|tu|nous|vous|ce))$") def cut (sWord): "returns a tuple of strings (prefix, trimed_word, suffix)" - m = _zMotAvecPronom.search(sWord) + sPrefix = "" + sSuffix = "" + m = _zWordPrefixes.search(sWord) + if m: + sPrefix = m.group(1) + "’" + sWord = m.group(2) + m = _zWordSuffixes.search(sWord) if m: - return ("", m.group(1), m.group(2)) - return ("", sWord, "") + sWord = m.group(1) + sSuffix = m.group(2) + return (sPrefix, sWord, sSuffix) # Other functions def filterSugg (aSugg):