hunspell-reader 5.13.2 → 5.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aff.d.ts +3 -2
- package/dist/aff.js +12 -0
- package/dist/affReader.js +2 -1
- package/package.json +7 -7
package/dist/aff.d.ts
CHANGED
|
@@ -35,10 +35,11 @@ export interface AffTransformFlags {
|
|
|
35
35
|
FORBIDDENWORD?: string;
|
|
36
36
|
NOSUGGEST?: string;
|
|
37
37
|
COMPOUNDBEGIN?: string;
|
|
38
|
-
COMPOUNDMIDDLE?: string;
|
|
39
38
|
COMPOUNDEND?: string;
|
|
40
|
-
|
|
39
|
+
COMPOUNDFLAG?: string;
|
|
41
40
|
COMPOUNDFORBIDFLAG?: string;
|
|
41
|
+
COMPOUNDMIDDLE?: string;
|
|
42
|
+
COMPOUNDPERMITFLAG?: string;
|
|
42
43
|
ONLYINCOMPOUND?: string;
|
|
43
44
|
}
|
|
44
45
|
export interface AffInfo extends AffTransformFlags {
|
package/dist/aff.js
CHANGED
|
@@ -62,6 +62,8 @@ class Aff {
|
|
|
62
62
|
* @internal
|
|
63
63
|
*/
|
|
64
64
|
applyRulesToWord(affWord, remainingDepth) {
|
|
65
|
+
var _a;
|
|
66
|
+
const compoundMin = (_a = this.affInfo.COMPOUNDMIN) !== null && _a !== void 0 ? _a : 3;
|
|
65
67
|
const { word, base, suffix, prefix, dic } = affWord;
|
|
66
68
|
const allRules = this.getMatchingRules(affWord.rules);
|
|
67
69
|
const { rulesApplied, flags } = allRules
|
|
@@ -75,6 +77,7 @@ class Aff {
|
|
|
75
77
|
const wordWithFlags = { word, flags, rulesApplied, rules: '', base, suffix, prefix, dic };
|
|
76
78
|
return [wordWithFlags, ...this.applyAffixesToWord(affixRules, { ...wordWithFlags, rules }, remainingDepth)]
|
|
77
79
|
.filter(({ flags }) => !flags.isNeedAffix)
|
|
80
|
+
.map((affWord) => adjustCompounding(affWord, compoundMin))
|
|
78
81
|
.map((affWord) => logAffWord(affWord, 'applyRulesToWord'));
|
|
79
82
|
}
|
|
80
83
|
applyAffixesToWord(affixRules, affWord, remainingDepth) {
|
|
@@ -208,6 +211,7 @@ const affFlag = {
|
|
|
208
211
|
COMPOUNDBEGIN: { canBeCompoundBegin: true },
|
|
209
212
|
COMPOUNDMIDDLE: { canBeCompoundMiddle: true },
|
|
210
213
|
COMPOUNDEND: { canBeCompoundEnd: true },
|
|
214
|
+
COMPOUNDFLAG: { isCompoundPermitted: true },
|
|
211
215
|
COMPOUNDPERMITFLAG: { isCompoundPermitted: true },
|
|
212
216
|
COMPOUNDFORBIDFLAG: { isCompoundForbidden: true },
|
|
213
217
|
ONLYINCOMPOUND: { isOnlyAllowedInCompound: true },
|
|
@@ -291,4 +295,12 @@ function removeNeedAffix(flags) {
|
|
|
291
295
|
delete newFlags.isNeedAffix;
|
|
292
296
|
return newFlags;
|
|
293
297
|
}
|
|
298
|
+
function adjustCompounding(affWord, minLength) {
|
|
299
|
+
if (!affWord.flags.isCompoundPermitted || affWord.word.length >= minLength) {
|
|
300
|
+
return affWord;
|
|
301
|
+
}
|
|
302
|
+
const { isCompoundPermitted, ...flags } = affWord.flags;
|
|
303
|
+
affWord.flags = flags;
|
|
304
|
+
return affWord;
|
|
305
|
+
}
|
|
294
306
|
//# sourceMappingURL=aff.js.map
|
package/dist/affReader.js
CHANGED
|
@@ -162,7 +162,7 @@ function asNumber(_fieldValue, line) {
|
|
|
162
162
|
return parseInt(value);
|
|
163
163
|
}
|
|
164
164
|
/*
|
|
165
|
-
cspell:ignore COMPOUNDBEGIN COMPOUNDEND COMPOUNDMIDDLE COMPOUNDMIN COMPOUNDPERMITFLAG COMPOUNDRULE COMPOUNDFORBIDFLAG
|
|
165
|
+
cspell:ignore COMPOUNDBEGIN COMPOUNDEND COMPOUNDMIDDLE COMPOUNDMIN COMPOUNDPERMITFLAG COMPOUNDRULE COMPOUNDFORBIDFLAG COMPOUNDFLAG
|
|
166
166
|
cspell:ignore FORBIDDENWORD KEEPCASE
|
|
167
167
|
cspell:ignore MAXDIFF NEEDAFFIX WORDCHARS
|
|
168
168
|
*/
|
|
@@ -178,6 +178,7 @@ const affTableField = {
|
|
|
178
178
|
COMPOUNDEND: asString,
|
|
179
179
|
COMPOUNDMIDDLE: asString,
|
|
180
180
|
COMPOUNDMIN: asNumber,
|
|
181
|
+
COMPOUNDFLAG: asString,
|
|
181
182
|
COMPOUNDPERMITFLAG: asString,
|
|
182
183
|
COMPOUNDFORBIDFLAG: asString,
|
|
183
184
|
COMPOUNDRULE: simpleTable,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hunspell-reader",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.14.0",
|
|
4
4
|
"description": "A library for reading Hunspell Dictionary Files",
|
|
5
5
|
"bin": "bin.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/fs-extra": "^9.0.13",
|
|
42
42
|
"@types/jest": "^27.0.3",
|
|
43
|
-
"@types/node": "^
|
|
44
|
-
"jest": "^27.4.
|
|
45
|
-
"prettier": "^2.5.
|
|
43
|
+
"@types/node": "^17.0.5",
|
|
44
|
+
"jest": "^27.4.5",
|
|
45
|
+
"prettier": "^2.5.1",
|
|
46
46
|
"rimraf": "^3.0.2",
|
|
47
|
-
"ts-jest": "^27.
|
|
48
|
-
"typescript": "^4.5.
|
|
47
|
+
"ts-jest": "^27.1.2",
|
|
48
|
+
"typescript": "^4.5.4"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"commander": "^8.3.0",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=12.13.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "8c8dfb70479584839e8035094771762f77118667"
|
|
76
76
|
}
|