Grammalecte  Diff

Differences From Artifact [68b70111ba]:

To Artifact [a010e7113e]:


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
29
30
31
32

33
34
35
36
37
38
39
// Grammalecte - Conjugueur
// License: GPL 3

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console, self, browser, chrome, __dirname */

"use strict";

${map}



if(typeof(process) !== 'undefined') {
    var helpers = require("../graphspell/helpers.js");
} else if (typeof(require) !== 'undefined') {
    var helpers = require("resource://grammalecte/graphspell/helpers.js");
}

var conj = {
    _lVtyp: [],
    _lTags: [],
    _dPatternConj: {},
    _dVerb: {},


    bInit: false,
    init: function (sJSONData) {
        try {
            let _oData = JSON.parse(sJSONData);
            this._lVtyp = _oData.lVtyp;
            this._lTags = _oData.lTags;
            this._dPatternConj = _oData.dPatternConj;
            this._dVerb = _oData.dVerb;

            this.bInit = true;
        }
        catch (e) {
            console.error(e);
        }
    },











>













>




|
|
|
|
|
>







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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Grammalecte - Conjugueur
// License: GPL 3

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console, self, browser, chrome, __dirname */

"use strict";

${map}
${set}


if(typeof(process) !== 'undefined') {
    var helpers = require("../graphspell/helpers.js");
} else if (typeof(require) !== 'undefined') {
    var helpers = require("resource://grammalecte/graphspell/helpers.js");
}

var conj = {
    _lVtyp: [],
    _lTags: [],
    _dPatternConj: {},
    _dVerb: {},
    _dVerbNames: {},

    bInit: false,
    init: function (sJSONData) {
        try {
            let oData = JSON.parse(sJSONData);
            this._lVtyp = oData.lVtyp;
            this._lTags = oData.lTags;
            this._dPatternConj = oData.dPatternConj;
            this._dVerb = oData.dVerb;
            this._dVerbNames = oData.dVerbNames;
            this.bInit = true;
        }
        catch (e) {
            console.error(e);
        }
    },

117
118
119
120
121
122
123




124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
                    aSugg.add("eut");
                } else {
                    aSugg.add("étais");
                    aSugg.add("était");
                }
                aSugg.delete("");
            } else {




                // we suggest past participles
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q1"));
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q2"));
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q3"));
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q4"));
                aSugg.delete("");
                // if there is only one past participle (epi inv), unreliable.
                if (aSugg.size === 1) {
                    aSugg.clear();

                }
            }
        }
        return aSugg;
    },

    _getTags: function (sVerb) {







>
>
>
>
|
|
|
|
|
|
|
|
|
>







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
                    aSugg.add("eut");
                } else {
                    aSugg.add("étais");
                    aSugg.add("était");
                }
                aSugg.delete("");
            } else {
                if (this._dVerbNames.hasOwnProperty(sInfi)) {
                    // there are names derivated from the verb
                    aSugg.gl_update(this._dVerbNames[sInfi]);
                } else {
                    // we suggest past participles
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q1"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q2"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q3"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q4"));
                    aSugg.delete("");
                    // if there is only one past participle (epi inv), unreliable.
                    if (aSugg.size === 1) {
                        aSugg.clear();
                    }
                }
            }
        }
        return aSugg;
    },

    _getTags: function (sVerb) {