Differences From Artifact [7f1ad67968]:
- File gc_core/py/lang_core/gc_engine.py — part of check-in [8f59594242] at 2019-07-27 01:07:04 on branch trunk — [core] listRules() update (user: olr, size: 53872) [annotate] [blame] [check-ins using]
To Artifact [4e48beeec8]:
- File gc_core/py/lang_core/gc_engine.py — part of check-in [ee9fbe69c3] at 2019-08-06 19:06:24 on branch trunk — [build][core][fr] DARG builder: simple search in morphologies, update graph parser, update French rules (user: olr, size: 55786) [annotate] [blame] [check-ins using]
| ︙ | |||
453 454 455 456 457 458 459 460 461 462 463 464 465 466 | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
if "<lemmas>" in dNode:
for sLemma in _oSpellChecker.getLemma(dToken["sValue"]):
if sLemma in dNode["<lemmas>"]:
if bDebug:
echo(" MATCH: >" + sLemma)
yield { "iToken1": iToken1, "iNode": dNode["<lemmas>"][sLemma] }
bTokenFound = True
# morph arcs
if "<morph>" in dNode:
lMorph = dToken.get("lMorph", _oSpellChecker.getMorph(dToken["sValue"]))
if lMorph:
for sSearch in dNode["<morph>"]:
if "¬" not in sSearch:
# no anti-pattern
if any(sSearch in sMorph for sMorph in lMorph):
if bDebug:
echo(" MATCH: $" + sSearch)
yield { "iToken1": iToken1, "iNode": dNode["<morph>"][sSearch] }
bTokenFound = True
else:
# there is an anti-pattern
sPattern, sNegPattern = sSearch.split("¬", 1)
if sNegPattern == "*":
# all morphologies must match with <sPattern>
if sPattern:
if all(sPattern in sMorph for sMorph in lMorph):
if bDebug:
echo(" MATCH: $" + sSearch)
yield { "iToken1": iToken1, "iNode": dNode["<morph>"][sSearch] }
bTokenFound = True
else:
if sNegPattern and any(sNegPattern in sMorph for sMorph in lMorph):
continue
if not sPattern or any(sPattern in sMorph for sMorph in lMorph):
if bDebug:
echo(" MATCH: $" + sSearch)
yield { "iToken1": iToken1, "iNode": dNode["<morph>"][sSearch] }
bTokenFound = True
# regex morph arcs
if "<re_morph>" in dNode:
lMorph = dToken.get("lMorph", _oSpellChecker.getMorph(dToken["sValue"]))
if lMorph:
for sRegex in dNode["<re_morph>"]:
if "¬" not in sRegex:
# no anti-pattern
|
| ︙ |