Grammalecte  Check-in [d4639a499b]

Overview
Comment:[core][py] update suggestions module
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core
Files: files | file ages | folders
SHA3-256: d4639a499bd98203105a16c776cd5491c7df7d3ef38da5b1f3e8e0ab2dfc95d3
User & Date: olr on 2021-02-05 17:32:21
Other Links: manifest | tags
Context
2021-02-05
17:33
[fr] mise à jour du dictonnaire [fr] ajustements check-in: 096f86a1af user: olr tags: trunk, fr
17:32
[core][py] update suggestions module check-in: d4639a499b user: olr tags: trunk, fr, core
2021-02-03
17:34
[fr] ajustements check-in: aaec50e9ed user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/modules/gce_suggestions.py from [99dc48572e] to [2cb060c852].

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
    "suggest past participles for <sFlex>"
    dSugg = {}
    for sStem in _oSpellChecker.getLemma(sFlex):
        tTags = conj._getTags(sStem)
        if tTags:
            if not sPattern:
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
                if conj._hasConjWithTags(tTags, ":PQ", ":Q2"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2")] = ""
                if conj._hasConjWithTags(tTags, ":PQ", ":Q3"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3")] = ""
                if conj._hasConjWithTags(tTags, ":PQ", ":Q4"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4")] = ""
            elif sPattern == ":m:s":
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":m:p":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q2"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":f:s":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q3"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":f:p":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q4"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":s":
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
                if conj._hasConjWithTags(tTags, ":PQ", ":Q3"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3")] = ""
            elif sPattern == ":p":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q2"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
                if conj._hasConjWithTags(tTags, ":PQ", ":Q4"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4")] = ""
            else:
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""


    if dSugg:
        return "|".join(dSugg)
    return ""


def suggVerbTense (sFlex, sTense, sWho):
    "change <sFlex> to a verb according to <sTense> and <sWho>"
    aSugg = []
    for sStem in _oSpellChecker.getLemma(sFlex):
        if conj.hasConj(sStem, sTense, sWho):
            aSugg.append(conj.getConj(sStem, sTense, sWho))
    if aSugg:
        return "|".join(aSugg)
    return ""


def suggVerbFrom (sStem, sFlex, sWho=""):
    "conjugate <sStem> according to <sFlex> (and eventually <sWho>)"
    dSugg = {}
    for sMorph in _oSpellChecker.getMorph(sFlex):







<
|
<
|
<
|



















<
|





<
|


>
>

|





|


|
|
|







72
73
74
75
76
77
78

79

80

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    "suggest past participles for <sFlex>"
    dSugg = {}
    for sStem in _oSpellChecker.getLemma(sFlex):
        tTags = conj._getTags(sStem)
        if tTags:
            if not sPattern:
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""

                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2")] = ""

                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3")] = ""

                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4")] = ""
            elif sPattern == ":m:s":
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":m:p":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q2"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":f:s":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q3"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":f:p":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q4"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
            elif sPattern == ":s":
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""

                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q3")] = ""
            elif sPattern == ":p":
                if conj._hasConjWithTags(tTags, ":PQ", ":Q2"):
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q2")] = ""
                else:
                    dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""

                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q4")] = ""
            else:
                dSugg[conj._getConjWithTags(sStem, tTags, ":PQ", ":Q1")] = ""
    if "" in dSugg:
        del dSugg[""]
    if dSugg:
        return "|".join(dSugg.keys())
    return ""


def suggVerbTense (sFlex, sTense, sWho):
    "change <sFlex> to a verb according to <sTense> and <sWho>"
    dSugg = {}
    for sStem in _oSpellChecker.getLemma(sFlex):
        if conj.hasConj(sStem, sTense, sWho):
            dSugg[conj.getConj(sStem, sTense, sWho)] = ""
    if dSugg:
        return "|".join(dSugg.keys())
    return ""


def suggVerbFrom (sStem, sFlex, sWho=""):
    "conjugate <sStem> according to <sFlex> (and eventually <sWho>)"
    dSugg = {}
    for sMorph in _oSpellChecker.getMorph(sFlex):