Overview
| Comment: | [core] value function: test with several casing |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | core | rg |
| Files: | files | file ages | folders |
| SHA3-256: |
e8346bc291e7d7c70c1678eec98da205 |
| User & Date: | olr on 2018-06-30 07:39:15 |
| Other Links: | branch diff | manifest | tags |
Context
|
2018-06-30
| ||
| 09:49 | [fr] conversion: regex rules -> graph rules check-in: cbc9afbecd user: olr tags: fr, rg | |
| 07:39 | [core] value function: test with several casing check-in: e8346bc291 user: olr tags: core, rg | |
| 07:26 | [fr] conversion: regex rules -> graph rules check-in: 41a49a3d20 user: olr tags: fr, rg | |
Changes
Modified gc_core/py/lang_core/gc_engine.py from [4effed76c8] to [afcee24576].
| ︙ | ︙ | |||
973 974 975 976 977 978 979 |
#### Analyse tokens
def g_value (dToken, sValues, nLeft=None, nRight=None):
"test if <dToken['sValue']> is in sValues (each value should be separated with |)"
sValue = "|"+dToken["sValue"]+"|" if nLeft is None else "|"+dToken["sValue"][slice(nLeft, nRight)]+"|"
| | > > > > > > > > > > > | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 |
#### Analyse tokens
def g_value (dToken, sValues, nLeft=None, nRight=None):
"test if <dToken['sValue']> is in sValues (each value should be separated with |)"
sValue = "|"+dToken["sValue"]+"|" if nLeft is None else "|"+dToken["sValue"][slice(nLeft, nRight)]+"|"
if sValue in sValues:
return True
if dToken["sValue"][0:2].istitle(): # we test only 2 first chars, to make valid words such as "Laissez-les", "Passe-partout".
if sValue.lower() in sValues:
return True
elif dToken["sValue"].isupper():
#if sValue.lower() in sValues:
# return True
sValue = "|"+sValue[1:].capitalize()
if sValue.capitalize() in sValues:
return True
return False
def g_morph (dToken, sPattern, sNegPattern="", nLeft=None, nRight=None, bMemorizeMorph=True):
"analyse a token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies"
if "lMorph" in dToken:
lMorph = dToken["lMorph"]
else:
|
| ︙ | ︙ |