hunspell-reader 5.13.3 → 5.13.4
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.js +11 -0
- package/package.json +7 -7
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) {
|
|
@@ -292,4 +295,12 @@ function removeNeedAffix(flags) {
|
|
|
292
295
|
delete newFlags.isNeedAffix;
|
|
293
296
|
return newFlags;
|
|
294
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
|
+
}
|
|
295
306
|
//# sourceMappingURL=aff.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hunspell-reader",
|
|
3
|
-
"version": "5.13.
|
|
3
|
+
"version": "5.13.4",
|
|
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": "^16.11.
|
|
44
|
-
"jest": "^27.4.
|
|
45
|
-
"prettier": "^2.5.
|
|
43
|
+
"@types/node": "^16.11.14",
|
|
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": "cf6ef9e6137af46d1a7ebd83600c05a4892c4814"
|
|
76
76
|
}
|