| 
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
3031
32
33
34
35
36
37
38
39
4041
42
43
44
4546
47
4849
50
51
5253
54
55
56
57
58
59
60
61
62
63
64
65
6667
68
69
70
71
72
73
74
75
7677
78
79
80
81
82
83
84
85
86
87
88
89
90
91 | 
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
43
44
45
46
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
 | 
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
-
-
 | 
    var helpers = require("resource://grammalecte/graphspell/helpers.js");
}
var mfsp = {
    // list of affix codes
    _lTagMiscPlur: [],
    _lTag_lTagFemForm: [],
    // 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(),
    bInit: false,
    init: function (sJSONData) {
        try {
            let _oData = JSON.parse(sJSONData);
            this._lTagMiscPlur = _oData.lTagMiscPlur;MasForm: [],            this._lTagthis._lTagFemForm = _oData.lTagFemForm;
            this._dMiscPlur = helpers.objectToMap(_oData.dMiscPlur);
            this._dMasForm = helpers.objectToMap(_oData.dMasForm);
            this.bInit = true;
        }
        catch (e) {
            console.error(e);
        }
    },MasForm = _oData.lTagMasForm;    isisMasForm: function (sWord) {
        // returns True if sWord exists in this._dMasForm
        return this._dMasForm.has(sWord);
    },FemForm: function (sWord) {    getgetFemForm: function (sWord, bPlur) {
        // returns masculine form with feminine form
        if (this._dMasForm.has(sWord)) {MasForm: function (sWord, bPlur) {            let alet aFemForm = [];
            for (let sTag of this._whatSuffixCode(sWord, bPlur)) {
                aFemForm.push( this._modifyStringWithSuffixCode(sWord, sTag) );
            }MasForm = [];
            for (let sTag of this._whatSuffixCode(sWord, bPlur)){
                aMasForm.push( this._modifyStringWithSuffixCode(sWord, sTag) );            return areturn aFemForm;
        }
        return [];
    },
    hasMiscPlural: function (sWord) {
        // returns True if sWord exists in dMiscPlur
        return this._dMiscPlur.has(sWord);
    },
    getMiscPlural: function (sWord) {
        // returns plural form with singular form
        if (this._dMiscPlur.has(sWord)) {
            let aMiscPlural = [];MasForm;            for (let sTag of this._lTagMiscPlur[this._dMiscPlur.get(sWord)].split("|")){
for (let sTag of this._lTagMiscPlur[this._dMiscPlur.get(sWord)].split("|")) {
                aMiscPlural.push( this._modifyStringWithSuffixCode(sWord, sTag) );
            }
            return aMiscPlural;
        }
        return [];
    },
    _whatSuffixCode: function (sWord, bPlur) {
        // necessary only for dMasFW        let sSfx = this._lTaglet sSfx = this._lTagFemForm[this._dMasForm.get(sWord)];MasForm[this._dMasForm.get(sWord)];if (bPlur) {
            return sSfx.slice(sSfx.indexOf("/")+1).split("|");
        }
        return sSfx.slice(0, sSfx.indexOf("/")).split("|");        if (sSfx.includes("/")) {    if (bPlur) {    return sSfx.slice(sSfx.indexOf("/")+1).split("|");    }    return sSfx.slice(0, sSfx.indexOf("/")).split("|");},
    _modifyStringWithSuffixCode: function (sWord, sSfx) {
        // returns sWord modified by sSfx
        if (!sWord) {
            return "";
        }        }        return sSfx.split("|"); | 
| 
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139 | 
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
 | 
-
+
 | 
} else {
    //console.log("Module mfsp non initialisé");
}
if (typeof(exports) !== 'undefined') {
    exports._lTagMiscPlur = mfsp._lTagMiscPlur;
    exports._lTagexports._lTagFemForm = mfsp._lTagFemForm;
    exports._dMiscPlur = mfsp._dMiscPlur;
    exports._dMasForm = mfsp._dMasForm;
    exports.init = mfsp.init;
    exports.isFemForm = mfsp.isFemForm;
    exports.getMasForm = mfsp.getMasForm;
    exports.hasMiscPlural = mfsp.hasMiscPlural;
    exports.getMiscPlural = mfsp.getMiscPlural;
    exports._whatSuffixCode = mfsp._whatSuffixCode;
    exports._modifyStringWithSuffixCode = mfsp._modifyStringWithSuffixCode;
}MasForm = mfsp._lTagMasForm; |