Grammalecte  Check-in [47944f336f]

Overview
Comment:[core][fr] fix previous commit
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core
Files: files | file ages | folders
SHA3-256: 47944f336fef505ef563b564596aa6af79076a4fa636ca4da25336db52cb5b23
User & Date: olr on 2021-02-05 19:41:00
Other Links: manifest | tags
Context
2021-02-05
21:07
[build][core][lo][fx][fr] change data structure for conjugation tool check-in: a56f46447a user: olr tags: trunk, fr, core, build, major_change, fx, lo
19:41
[core][fr] fix previous commit check-in: 47944f336f user: olr tags: trunk, fr, core
19:21
[fr] ajustements check-in: fe4a2a6586 user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/modules-js/conj.js from [03aa2c6aa7] to [fd6082c64b].

58
59
60
61
62
63
64



65
66
67
68
69
70
71
72
73
74
75



76
77
78
79
80
81
82
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88







+
+
+











+
+
+







        return this._dVerb.hasOwnProperty(sVerb);
    },

    getConj: function (sVerb, sTense, sWho) {
        // returns conjugation (can be an empty string)
        if (!this._dVerb.hasOwnProperty(sVerb)) {
            return null;
        }
        if (sTense == ":Y") {
            return sVerb;
        }
        if (!this._dPatternConj[sTense][this._lTags[this._dVerb[sVerb][1]][this._dTenseIdx.get(sTense)]].hasOwnProperty(sWho)) {
            return "";
        }
        return this._modifyStringWithSuffixCode(sVerb, this._dPatternConj[sTense][this._lTags[this._dVerb[sVerb][1]][this._dTenseIdx.get(sTense)]][sWho]);
    },

    hasConj: function (sVerb, sTense, sWho) {
        // returns false if no conjugation (also if empty) else true
        if (!this._dVerb.hasOwnProperty(sVerb)) {
            return false;
        }
        if (sTense == ":Y") {
            return true;
        }
        if (this._dPatternConj[sTense][this._lTags[this._dVerb[sVerb][1]][this._dTenseIdx.get(sTense)]].hasOwnProperty(sWho)
                && this._dPatternConj[sTense][this._lTags[this._dVerb[sVerb][1]][this._dTenseIdx.get(sTense)]][sWho]) {
            return true;
        }
        return false;
    },
121
122
123
124
125
126
127



128
129
130
131
132
133
134
135



136
137
138
139
140
141
142
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154







+
+
+








+
+
+







            return null;
        }
        return this._lTags[this._dVerb[sVerb][1]];
    },

    _getConjWithTags: function (sVerb, tTags, sTense, sWho) {
        // returns conjugation (can be an empty string)
        if (sTense == ":Y") {
            return sVerb;
        }
        if (!this._dPatternConj[sTense][tTags[this._dTenseIdx.get(sTense)]].hasOwnProperty(sWho)) {
            return "";
        }
        return this._modifyStringWithSuffixCode(sVerb, this._dPatternConj[sTense][tTags[this._dTenseIdx.get(sTense)]][sWho]);
    },

    _hasConjWithTags: function (tTags, sTense, sWho) {
        // returns false if no conjugation (also if empty) else true
        if (sTense == ":Y") {
            return true;
        }
        if (this._dPatternConj[sTense][tTags[this._dTenseIdx.get(sTense)]].hasOwnProperty(sWho)
                && this._dPatternConj[sTense][tTags[this._dTenseIdx.get(sTense)]][sWho]) {
            return true;
        }
        return false;
    },

Modified gc_lang/fr/modules-js/gce_suggestions.js from [712aa0bc24] to [e713e67341].

158
159
160
161
162
163
164
165

166
167
168
169
170
171
172
158
159
160
161
162
163
164

165
166
167
168
169
170
171
172







-
+







    return "";
}

function suggVerbFrom (sStem, sFlex, sWho="") {
    "conjugate <sStem> according to <sFlex> (and eventually <sWho>)"
    let aSugg = new Set();
    for (let sMorph of gc_engine.oSpellChecker.getMorph(sFlex)) {
        let lTenses = [ ...sMorph.matchAll(/:(?:Y|I[pqsf]|S[pq]|K|P|Q)/g) ];
        let lTenses = [ ...sMorph.matchAll(/:(?:Y|I[pqsf]|S[pq]|K|P)/g) ];
        if (sWho) {
            for (let [sTense, ] of lTenses) {
                if (conj.hasConj(sStem, sTense, sWho)) {
                    aSugg.add(conj.getConj(sStem, sTense, sWho));
                }
            }
        }

Modified gc_lang/fr/modules/conj.py from [542bdbf844] to [af72bab83b].

37
38
39
40
41
42
43


44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60







+
+







-
+







    return sVerb in _dVerb


def getConj (sVerb, sTense, sWho):
    "returns conjugation (can be an empty string)"
    if sVerb not in _dVerb:
        return None
    if sTense == ":Y":
        return sVerb
    return _modifyStringWithSuffixCode(sVerb, _dPatternConj[sTense][_lTags[_dVerb[sVerb][1]][_dTenseIdx[sTense]]].get(sWho, ""))


def hasConj (sVerb, sTense, sWho):
    "returns False if no conjugation (also if empty) else True"
    if sVerb not in _dVerb:
        return False
    if _dPatternConj[sTense][_lTags[_dVerb[sVerb][1]][_dTenseIdx[sTense]]].get(sWho, False):
    if sTense == ":Y" or _dPatternConj[sTense][_lTags[_dVerb[sVerb][1]][_dTenseIdx[sTense]]].get(sWho, False):
        return True
    return False


def getVtyp (sVerb):
    "returns raw informations about sVerb"
    if sVerb not in _dVerb:
109
110
111
112
113
114
115


116
117
118
119
120
121

122
123
124
125
126
127
128
111
112
113
114
115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132







+
+





-
+







    if sVerb not in _dVerb:
        return None
    return _lTags[_dVerb[sVerb][1]]


def _getConjWithTags (sVerb, tTags, sTense, sWho):
    "returns conjugation (can be an empty string)"
    if sTense == ":Y":
        return sVerb
    return _modifyStringWithSuffixCode(sVerb, _dPatternConj[sTense][tTags[_dTenseIdx[sTense]]].get(sWho, ""))


def _hasConjWithTags (tTags, sTense, sWho):
    "returns False if no conjugation (also if empty) else True"
    if _dPatternConj[sTense][tTags[_dTenseIdx[sTense]]].get(sWho, False):
    if sTense == ":Y" or _dPatternConj[sTense][tTags[_dTenseIdx[sTense]]].get(sWho, False):
        return True
    return False


def _modifyStringWithSuffixCode (sWord, sSfx):
    "returns sWord modified by sSfx"
    if not sSfx:

Modified gc_lang/fr/modules/gce_suggestions.py from [2cb060c852] to [26290c5dd1].

125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
125
126
127
128
129
130
131

132
133
134
135
136
137
138
139







-
+







    return ""


def suggVerbFrom (sStem, sFlex, sWho=""):
    "conjugate <sStem> according to <sFlex> (and eventually <sWho>)"
    dSugg = {}
    for sMorph in _oSpellChecker.getMorph(sFlex):
        lTenses = [ m.group(0)  for m in re.finditer(":(?:Y|I[pqsf]|S[pq]|K|P|Q)", sMorph) ]
        lTenses = [ m.group(0)  for m in re.finditer(":(?:Y|I[pqsf]|S[pq]|K|P)", sMorph) ]
        if sWho:
            for sTense in lTenses:
                if conj.hasConj(sStem, sTense, sWho):
                    dSugg[conj.getConj(sStem, sTense, sWho)] = ""
        else:
            for sTense in lTenses:
                for sWho in [ m.group(0)  for m in re.finditer(":[123][sp]", sMorph) ]:

Modified gc_lang/fr/rules.grx from [0577c93aa0] to [c8824c64d1].

7093
7094
7095
7096
7097
7098
7099
7100

7101
7102
7103
7104
7105
7106
7107
7108
7109

7110
7111
7112
7113
7114
7115
7116
7093
7094
7095
7096
7097
7098
7099

7100
7101
7102
7103
7104
7105
7106
7107
7108

7109
7110
7111
7112
7113
7114
7115
7116







-
+








-
+







    >avérer >vrai
        <<- /pleo/ -2>> =\2.replace("vrai", "exact")                && Pléonasme.

    >descendre en bas
        <<- /pleo/ not value(>1, "|de|des|du|d’|") ->> \1           && Pléonasme.

    >choisir [le|un|ce|quel|mon|ton|son|notre|votre|leur] choix
        <<- /pleo/ -1>> =suggVerbFrom(\1, "faire")                  && Pléonasme.
        <<- /pleo/ -1>> =suggVerbFrom("faire", \1)                  && Pléonasme.

    [>efforcer|>essayer|>tâcher] de faire en sorte [de|d’]
        <<- /pleo/ ->> \1 \-1                                       && Pléonasme.

    >monter en haut
        <<- /pleo/ not value(>1, "|de|des|du|d’|") ->> \1           && Pléonasme.

    >opter pour [l’|une|cette|quelle] option
        <<- /pleo/ -1:2>> =suggVerbFrom(\1, "choisir")              && Pléonasme.
        <<- /pleo/ -1:2>> =suggVerbFrom("choisir", \1)              && Pléonasme.

    >sortir hors [de|d’]
        <<- /pleo/ -2:3>> \3                                        && Pléonasme. Exemple : « sortir de la maison », et non « sortir hors de la maison ».

    >suivre derrière
        <<- not morph(>1, ":D") ->> \1                              && Pléonasme.