Grammalecte  Check-in [b3026938be]

Overview
Comment:[fr][js][bug] conj generator: missing else
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fr | multid
Files: files | file ages | folders
SHA3-256: b3026938be0ee58828b933d0b221a96466a78ae7ee5b0aacd76eae488921f497
User & Date: olr on 2018-03-11 21:57:57
Other Links: branch diff | manifest | tags
Context
2018-03-11
22:22
[fx] lexicon editor: ui update check-in: b36b4dcdfe user: olr tags: fx, multid
21:57
[fr][js][bug] conj generator: missing else check-in: b3026938be user: olr tags: fr, multid
21:57
[fr][py][bug] conj generator: nissing else check-in: 67790bd50d user: olr tags: fr, multid
Changes

Modified gc_lang/fr/modules-js/conj_generator.js from [5cac5f9e5e] to [ccd2c13fff].

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
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 lEntry = [];
        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] );
                lEntry.push( [sVerb.slice(0, -nCut) + sAdd, ":V" + cGroup + "_" + sVerbTag + sFlexTags] );
            }
        }
        return lConj;
        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
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"];
                }
                lConj = this.oConj["V1"][sVerb.slice(-4)];
                } 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