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
|
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
|
+
+
-
+
+
+
+
-
+
+
+
+
|
// returns True if sWord exists in this._dMasForm
return this._dMasForm.has(sWord);
},
getMasForm: function (sWord, bPlur) {
// returns masculine form with feminine form
if (this._dMasForm.has(sWord)) {
let masForm = [];
for (var sTag of this._whatSuffixCode(sWord, bPlur)){
return [ for (sTag of this._whatSuffixCode(sWord, bPlur)) this._modifyStringWithSuffixCode(sWord, sTag) ];
masForm.push( this._modifyStringWithSuffixCode(sWord, sTag) );
}
return masForm;
}
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 miscPlurial = [];
return [ for (sTag of this._lTagMiscPlur[this._dMiscPlur.get(sWord)].split("|")) this._modifyStringWithSuffixCode(sWord, sTag) ];
for (var sTag of this._lTagMiscPlur[this._dMiscPlur.get(sWord)].split("|")){
miscPlurial.push( this._modifyStringWithSuffixCode(sWord, sTag) );
}
return miscPlurial;
}
return [];
},
_whatSuffixCode: function (sWord, bPlur) {
// necessary only for dMasFW
let sSfx = this._lTagMasForm[this._dMasForm.get(sWord)];
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
-
+
|
}
}
catch (e) {
console.log(e);
return "## erreur, code : " + sSfx + " ##";
}
}
}
};
// Initialization
if (typeof(browser) !== 'undefined') {
// WebExtension
mfsp.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/mfsp_data.json")));
} else if (typeof(require) !== 'undefined') {
|