Grammalecte  Diff

Differences From Artifact [5ce8b4f9f6]:

To Artifact [9f60b851a7]:


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
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

+
+


















+







+







// Grammalecte
/*jslint esversion: 6*/
/*global console,require,exports,browser*/

"use strict";


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


var mfsp = {
    // list of affix codes
    _lTagMiscPlur: [],
    _lTagMasForm: [],
    // dictionary of words with uncommon plurals (-x, -ux, english, latin and italian plurals) and tags to generate them
    _dMiscPlur: new Map(),
    // dictionary of feminine forms and tags to generate masculine forms (singular and plural)
    _dMasForm: new Map(),

    isInit: false,
    init: function (sJSONData) {
        try {
            let _oData = JSON.parse(sJSONData);
            this._lTagMiscPlur = _oData.lTagMiscPlur;
            this._lTagMasForm = _oData.lTagMasForm;
            this._dMiscPlur = helpers.objectToMap(_oData.dMiscPlur);
            this._dMasForm = helpers.objectToMap(_oData.dMasForm);
            this.isInit = true;
        }
        catch (e) {
            console.error(e);
        }
    },

    isFemForm: function (sWord) {
96
97
98
99
100
101
102
103

104
105
106

107
108


109
110
111
112
113
114
115
100
101
102
103
104
105
106

107
108
109

110
111
112
113
114
115
116
117
118
119
120
121







-
+


-
+


+
+







            return "## erreur, code : " + sSfx + " ##";
        }
    }
};


// Initialization
if (typeof(browser) !== 'undefined') {
if (!mfsp.isInit && typeof(browser) !== 'undefined') {
    // WebExtension
    mfsp.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/mfsp_data.json")));
} else if (typeof(require) !== 'undefined') {
} else if (!mfsp.isInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    mfsp.init(helpers.loadFile("resource://grammalecte/fr/mfsp_data.json"));
} else if (mfsp.isInit){
    console.log("Module mfsp déjà initialisé");
} else {
    console.log("Module mfsp non initialisé");
}


if (typeof(exports) !== 'undefined') {
    exports._lTagMiscPlur = mfsp._lTagMiscPlur;