Grammalecte  Check-in [8419a4fad8]

Overview
Comment:[core] gc engine: handle different casing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | rg
Files: files | file ages | folders
SHA3-256: 8419a4fad864b0b0b1a563d5485fda6fda833aa612041234eb9cc602ddb19333
User & Date: olr on 2018-06-20 03:20:09
Other Links: branch diff | manifest | tags
Context
2018-06-20
03:43
[fr] now useless to check lemmas to handle casing check-in: 1c3bb4567c user: olr tags: fr, rg
03:20
[core] gc engine: handle different casing check-in: 8419a4fad8 user: olr tags: core, rg
2018-06-19
17:53
[build] useless line check-in: b4cc6e93dc user: olr tags: build, rg
Changes

Modified gc_core/py/lang_core/gc_engine.py from [bea60fba77] to [743ad9cfa1].

601
602
603
604
605
606
607

















608
609
610
611
612
613
614
    def _getNextMatchingNodes (self, dToken, dGraph, dNode, bDebug=False):
        "generator: return nodes where <dToken> “values” match <dNode> arcs"
        # token value
        if dToken["sValue"] in dNode:
            if bDebug:
                print("MATCH:", dToken["sValue"])
            yield dGraph[dNode[dToken["sValue"]]]

















        # token lemmas
        if "<lemmas>" in dNode:
            for sLemma in _oSpellChecker.getLemma(dToken["sValue"]):
                if sLemma in dNode["<lemmas>"]:
                    if bDebug:
                        print("MATCH: >" + sLemma)
                    yield dGraph[dNode["<lemmas>"][sLemma]]







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
    def _getNextMatchingNodes (self, dToken, dGraph, dNode, bDebug=False):
        "generator: return nodes where <dToken> “values” match <dNode> arcs"
        # token value
        if dToken["sValue"] in dNode:
            if bDebug:
                print("MATCH:", dToken["sValue"])
            yield dGraph[dNode[dToken["sValue"]]]
        if dToken["sValue"].istitle():
            sValue = dToken["sValue"].lower()
            if sValue in dNode:
                if bDebug:
                    print("MATCH:", sValue)
                yield dGraph[dNode[sValue]]
        elif dToken["sValue"].isupper():
            sValue = dToken["sValue"].lower()
            if sValue in dNode:
                if bDebug:
                    print("MATCH:", sValue)
                yield dGraph[dNode[sValue]]
            sValue = dToken["sValue"].capitalize()
            if sValue in dNode:
                if bDebug:
                    print("MATCH:", sValue)
                yield dGraph[dNode[sValue]]
        # token lemmas
        if "<lemmas>" in dNode:
            for sLemma in _oSpellChecker.getLemma(dToken["sValue"]):
                if sLemma in dNode["<lemmas>"]:
                    if bDebug:
                        print("MATCH: >" + sLemma)
                    yield dGraph[dNode["<lemmas>"][sLemma]]