Grammalecte  Diff

Differences From Artifact [c252d197b9]:

To Artifact [ca7f3318b7]:


1018
1019
1020
1021
1022
1023
1024

1025
1026





1027
1028
1029
1030
1031
1032
1033
1018
1019
1020
1021
1022
1023
1024
1025


1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037







+
-
-
+
+
+
+
+







    # search sPattern
    zPattern = re.compile(sPattern)
    return any(zPattern.search(sMorph)  for sMorph in lMorph)


def g_analyse (dToken, sPattern, sNegPattern="", nLeft=None, nRight=None, bMemorizeMorph=True):
    "analyse a token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies (disambiguation off)"
    if nLeft is not None:
    sValue = dToken["sValue"]  if nLeft is not None  else dToken["sValue"][slice(nLeft, nRight)]
    lMorph = _oSpellChecker.getMorph(sValue)
        lMorph = _oSpellChecker.getMorph(dToken["sValue"][slice(nLeft, nRight)])
        if bMemorizeMorph:
            dToken["lMorph"] = lMorph
    else:
        lMorph = _oSpellChecker.getMorph(dToken["sValue"])
    if not lMorph:
        return False
    # check negative condition
    if sNegPattern:
        if sNegPattern == "*":
            zPattern = re.compile(sPattern)
            return all(zPattern.search(sMorph)  for sMorph in lMorph)