Grammalecte  Check-in [bc13d3f8bb]

Overview
Comment:[core] get token outside secure scope
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | rg
Files: files | file ages | folders
SHA3-256: bc13d3f8bbebca765b8fe33e6a425cdc13bc7f0660b559c71664b764456bb8e2
User & Date: olr on 2018-07-25 15:05:39
Other Links: branch diff | manifest | tags
Context
2018-07-25
15:06
[fr] conversion: regex rules -> graph rules check-in: 11e28f20e0 user: olr tags: fr, rg
15:05
[core] get token outside secure scope check-in: bc13d3f8bb user: olr tags: core, rg
15:04
[build] get token outside secure scope check-in: 245941cc07 user: olr tags: build, rg
Changes

Modified gc_core/py/lang_core/gc_engine.py from [a408aa043b] to [d74503b11e].

1110
1111
1112
1113
1114
1115
1116









1117
1118
1119
1120
1121
1122
1123
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132







+
+
+
+
+
+
+
+
+







def g_space_between_tokens (dToken1, dToken2, nMin, nMax=None):
    nSpace = dToken2["nStart"] - dToken1["nEnd"]
    if nSpace < nMin:
        return False
    if nMax is not None and nSpace > nMax:
        return False
    return True


def g_token (lToken, i):
    if i < 0:
        return lToken[0]
    if i >= len(lToken):
        return lToken[-1]
    return lToken[i]



#### Disambiguator

def g_select (dToken, sPattern, lDefault=None):
    "select morphologies for <dToken> according to <sPattern>, always return True"
    lMorph = dToken["lMorph"]  if "lMorph" in dToken  else _oSpellChecker.getMorph(dToken["sValue"])