︙ | | | ︙ | |
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//// verbs
function splitVerb (sVerb) {
// renvoie le verbe et les pronoms séparément
let iRight = sVerb.lastIndexOf("-");
let sSuffix = sVerb.slice(iRight);
sVerb = sVerb.slice(0, iRight);
if (sVerb.endsWith("-t") || sVerb.endsWith("-le") || sVerb.endsWith("-la") || sVerb.endsWith("-les")) {
iRight = sVerb.lastIndexOf("-");
sSuffix = sVerb.slice(iRight) + sSuffix;
sVerb = sVerb.slice(0, iRight);
}
return [sVerb, sSuffix];
}
|
|
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//// verbs
function splitVerb (sVerb) {
// renvoie le verbe et les pronoms séparément
let iRight = sVerb.lastIndexOf("-");
let sSuffix = sVerb.slice(iRight);
sVerb = sVerb.slice(0, iRight);
if (sVerb.endsWith("-t") || sVerb.endsWith("-le") || sVerb.endsWith("-la") || sVerb.endsWith("-les") || sVerb.endsWith("-nous") || sVerb.endsWith("-vous") || sVerb.endsWith("-leur") || sVerb.endsWith("-lui")) {
iRight = sVerb.lastIndexOf("-");
sSuffix = sVerb.slice(iRight) + sSuffix;
sVerb = sVerb.slice(0, iRight);
}
return [sVerb, sSuffix];
}
|
︙ | | | ︙ | |
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
}
}
if (aSugg.size > 0) {
return Array.from(aSugg).join("|");
}
return "";
}
function suggVerbImpe (sFlex, bVC=false) {
let sSfx;
if (bVC) {
[sFlex, sSfx] = splitVerb(sFlex);
}
let aSugg = new Set();
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
}
}
if (aSugg.size > 0) {
return Array.from(aSugg).join("|");
}
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) ];
if (sWho) {
for (let sTense of lTenses) {
if (conj.hasConj(sStem, sTense, sWho)) {
aSugg.add(conj.getConj(sStem, sTense, sWho));
}
}
}
else {
for (let sTense of lTenses) {
for (let sWho of [ ...sMorph.matchAll(/:[123][sp]/g) ]) {
if (conj.hasConj(sStem, sTense, sWho)) {
aSugg.add(conj.getConj(sStem, sTense, sWho));
}
}
}
}
}
if (aSugg.size > 0) {
return Array.from(aSugg).join("|");
}
return "";
}
function suggVerbImpe (sFlex, bVC=false) {
let sSfx;
if (bVC) {
[sFlex, sSfx] = splitVerb(sFlex);
}
let aSugg = new Set();
|
︙ | | | ︙ | |
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
if (conj._hasConjWithTags(tTags, ":E", ":2p")) {
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2p"));
}
}
}
if (aSugg.size > 0) {
if (bVC) {
return Array.from(aSugg).map((sSugg) => { return ((sSugg.endsWith("e") || sSugg.endsWith("a")) && (sSfx.endsWith("-en") || sSfx.endsWith("-y"))) ? sSugg + "s" + sSfx : sSugg + sSfx; }).join("|");
}
return Array.from(aSugg).join("|");
}
return "";
}
function suggVerbInfi (sFlex) {
|
|
|
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
if (conj._hasConjWithTags(tTags, ":E", ":2p")) {
aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2p"));
}
}
}
if (aSugg.size > 0) {
if (bVC) {
return Array.from(aSugg).map((sSugg) => { return ((sSugg.endsWith("e") || sSugg.endsWith("a")) && (sSfx == "-en" || sSfx == "-y")) ? sSugg + "s" + sSfx : sSugg + sSfx; }).join("|");
}
return Array.from(aSugg).join("|");
}
return "";
}
function suggVerbInfi (sFlex) {
|
︙ | | | ︙ | |
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
|
for (let e of conj.getSimil(sWord, sMorph, bSubst)) {
aSugg.add(e);
}
}
}
if (aSugg.size > 0) {
if (bVC) {
return Array.from(aSugg).map((sSugg) => { return sSugg + sSfx; }).join("|");
}
return Array.from(aSugg).join("|");
}
return "";
}
function suggCeOrCet (sWord) {
|
|
|
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
|
for (let e of conj.getSimil(sWord, sMorph, bSubst)) {
aSugg.add(e);
}
}
}
if (aSugg.size > 0) {
if (bVC) {
return Array.from(aSugg).map((sSugg) => { return ((sSugg.endsWith("e") || sSugg.endsWith("a")) && (sSfx == "-en" || sSfx == "-y")) ? sSugg + "s" + sSfx : sSugg + sSfx; }).join("|");
}
return Array.from(aSugg).join("|");
}
return "";
}
function suggCeOrCet (sWord) {
|
︙ | | | ︙ | |