222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
return Array.from(aSugg).join("|");
}
return "";
}
//// Nouns and adjectives
function suggPlur (sFlex, sWordToAgree=null) {
// returns plural forms assuming sFlex is singular
if (sWordToAgree) {
let lMorph = _oSpellChecker.getMorph(sWordToAgree);
if (lMorph.length === 0) {
return "";
}
let sGender = cregex.getGender(lMorph);
|
|
|
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
return Array.from(aSugg).join("|");
}
return "";
}
//// Nouns and adjectives
function suggPlur (sFlex, sWordToAgree=null, bSelfSugg=false) {
// returns plural forms assuming sFlex is singular
if (sWordToAgree) {
let lMorph = _oSpellChecker.getMorph(sWordToAgree);
if (lMorph.length === 0) {
return "";
}
let sGender = cregex.getGender(lMorph);
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
}
if (_oSpellChecker.isValid(sFlex+"x")) {
aSugg.add(sFlex+"x");
}
if (mfsp.hasMiscPlural(sFlex)) {
mfsp.getMiscPlural(sFlex).forEach(function(x) { aSugg.add(x); });
}
if (aSugg.size == 0) {
aSugg.add(sFlex);
}
return Array.from(aSugg).join("|");
}
function suggSing (sFlex) {
// returns singular forms assuming sFlex is plural
let aSugg = new Set();
if (sFlex.endsWith("ux")) {
if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"l")) {
aSugg.add(sFlex.slice(0,-2)+"l");
}
if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"il")) {
|
|
>
|
|
>
|
>
|
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
}
if (_oSpellChecker.isValid(sFlex+"x")) {
aSugg.add(sFlex+"x");
}
if (mfsp.hasMiscPlural(sFlex)) {
mfsp.getMiscPlural(sFlex).forEach(function(x) { aSugg.add(x); });
}
if (aSugg.size == 0 && bSelfSugg && (sFlex.endsWith("s") || sFlex.endsWith("x") || sFlex.endsWith("S") || sFlex.endsWith("X"))) {
aSugg.add(sFlex);
}
if (aSugg.size > 0) {
return Array.from(aSugg).join("|");
}
return "";
}
function suggSing (sFlex, bSelfSugg=false) {
// returns singular forms assuming sFlex is plural
let aSugg = new Set();
if (sFlex.endsWith("ux")) {
if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"l")) {
aSugg.add(sFlex.slice(0,-2)+"l");
}
if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"il")) {
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"IL")) {
aSugg.add(sFlex.slice(0,-2)+"IL");
}
}
if ((sFlex.endsWith("s") || sFlex.endsWith("x") || sFlex.endsWith("S") || sFlex.endsWith("X")) && _oSpellChecker.isValid(sFlex.slice(0,-1))) {
aSugg.add(sFlex.slice(0,-1));
}
if (aSugg.size == 0) {
aSugg.add(sFlex);
}
return Array.from(aSugg).join("|");
}
function suggMasSing (sFlex, bSuggSimil=false) {
// returns masculine singular forms
let aSugg = new Set();
for (let sMorph of _oSpellChecker.getMorph(sFlex)) {
if (!sMorph.includes(":V")) {
|
|
>
|
>
>
|
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"IL")) {
aSugg.add(sFlex.slice(0,-2)+"IL");
}
}
if ((sFlex.endsWith("s") || sFlex.endsWith("x") || sFlex.endsWith("S") || sFlex.endsWith("X")) && _oSpellChecker.isValid(sFlex.slice(0,-1))) {
aSugg.add(sFlex.slice(0,-1));
}
if (bSelfSugg && aSugg.size == 0) {
aSugg.add(sFlex);
}
if (aSugg.size > 0) {
return Array.from(aSugg).join("|");
}
return "";
}
function suggMasSing (sFlex, bSuggSimil=false) {
// returns masculine singular forms
let aSugg = new Set();
for (let sMorph of _oSpellChecker.getMorph(sFlex)) {
if (!sMorph.includes(":V")) {
|