1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| // JavaScript
/*
Conjugation generator
beta stage, unfinished, the root for a new way to generate flexions…
*/
"use strict";
var conj_generator = {
conjugate: function (sVerb, sVerbTag="i_____a", bVarPpas=true) {
let lConj = [];
let cGroup = this.getVerbGroupChar(sVerb);
for (let [nCut, sAdd, sFlexTags, sPattern] of this.getConjRules(sVerb, bVarPpas)) {
if (!sPattern || RegExp(sPattern).test(sVerb)) {
lConj.push( [sVerb.slice(0, -nCut) + sAdd, ":V" + cGroup + "_" + sVerbTag + sFlexTags] );
}
}
return lConj;
},
getVerbGroupChar: function (sVerb) {
sVerb = sVerb.toLowerCase();
if (sVerb.endsWith("er")) {
return "1";
}
|
|
|
|
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| // JavaScript
/*
Conjugation generator
beta stage, unfinished, the root for a new way to generate flexions…
*/
"use strict";
var conj_generator = {
conjugate: function (sVerb, sVerbTag="i_____a", bVarPpas=true) {
let lEntry = [];
let cGroup = this.getVerbGroupChar(sVerb);
for (let [nCut, sAdd, sFlexTags, sPattern] of this.getConjRules(sVerb, bVarPpas)) {
if (!sPattern || RegExp(sPattern).test(sVerb)) {
lEntry.push( [sVerb.slice(0, -nCut) + sAdd, ":V" + cGroup + "_" + sVerbTag + sFlexTags] );
}
}
return lEntry;
},
getVerbGroupChar: function (sVerb) {
sVerb = sVerb.toLowerCase();
if (sVerb.endsWith("er")) {
return "1";
}
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| if (sVerb.slice(-5) in this.oConj["V1"]) {
lConj = this.oConj["V1"][sVerb.slice(-5)];
}
// 4 lettres
else if (sVerb.slice(-4) in this.oConj["V1"]) {
if (sVerb.endsWith("eler") || sVerb.endsWith("eter")) {
lConj = this.oConj["V1"][sVerb.slice(-4)]["1"];
}
lConj = this.oConj["V1"][sVerb.slice(-4)];
}
// 3 lettres
else if (sVerb.slice(-3) in this.oConj["V1"]) {
lConj = this.oConj["V1"][sVerb.slice(-3)];
}
else {
lConj = this.oConj["V1"]["er"];
}
lConj.push(...this.oConj["V1_ppas"][sVarPpas]);
} else if (sVerb.endsWith("ir") && nGroup <= 2) {
// deuxième groupe
lConj = this.oConj["V2"];
lConj.push(...this.oConj["V2_ppas"][sVarPpas]);
} else {
// TODO: troisième groupe
|
|
|
>
>
>
>
| 47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
| if (sVerb.slice(-5) in this.oConj["V1"]) {
lConj = this.oConj["V1"][sVerb.slice(-5)];
}
// 4 lettres
else if (sVerb.slice(-4) in this.oConj["V1"]) {
if (sVerb.endsWith("eler") || sVerb.endsWith("eter")) {
lConj = this.oConj["V1"][sVerb.slice(-4)]["1"];
} else {
lConj = this.oConj["V1"][sVerb.slice(-4)];
}
}
// 3 lettres
else if (sVerb.slice(-3) in this.oConj["V1"]) {
lConj = this.oConj["V1"][sVerb.slice(-3)];
}
// 2 lettres
else {
lConj = this.oConj["V1"]["er"];
}
console.log(lConj);
console.log(this.oConj["V1_ppas"][sVarPpas]);
lConj.push(...this.oConj["V1_ppas"][sVarPpas]);
} else if (sVerb.endsWith("ir") && nGroup <= 2) {
// deuxième groupe
lConj = this.oConj["V2"];
lConj.push(...this.oConj["V2_ppas"][sVarPpas]);
} else {
// TODO: troisième groupe
|