cspell-dictionary 6.27.0 → 6.29.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/{SpellingDictionary → cjs/SpellingDictionary}/CachingDictionary.d.ts +3 -3
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/CachingDictionary.js +9 -9
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/FlagWordsDictionary.d.ts +1 -1
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/FlagWordsDictionary.js +11 -11
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/IgnoreWordsDictionary.d.ts +1 -1
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/IgnoreWordsDictionary.js +5 -5
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionary.d.ts +7 -0
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryCollection.d.ts +1 -1
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryCollection.js +12 -12
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryFromTrie.d.ts +3 -2
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryFromTrie.js +18 -17
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryMethods.d.ts +1 -1
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryMethods.js +5 -5
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SuggestDictionary.d.ts +2 -2
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SuggestDictionary.js +9 -9
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/index.d.ts +1 -1
- package/dist/cjs/SpellingDictionary/Typos/index.d.ts +4 -0
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/index.js +7 -7
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typos.d.ts +1 -1
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typosParser.d.ts +1 -1
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typosParser.js +6 -6
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/util.d.ts +1 -1
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/TyposDictionary.d.ts +2 -2
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/TyposDictionary.js +10 -10
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/createInlineSpellingDictionary.d.ts +1 -1
- package/dist/cjs/SpellingDictionary/createInlineSpellingDictionary.js +25 -0
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/createSpellingDictionary.d.ts +2 -2
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/createSpellingDictionary.js +9 -9
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/index.d.ts +10 -10
- package/dist/{SpellingDictionary → cjs/SpellingDictionary}/index.js +20 -20
- package/dist/{index.d.ts → cjs/index.d.ts} +2 -2
- package/dist/{index.js → cjs/index.js} +11 -11
- package/dist/{util → cjs/util}/clean.d.ts +1 -1
- package/dist/cjs/util/repMap.d.ts +27 -0
- package/dist/cjs/util/repMap.js +158 -0
- package/dist/{util → cjs/util}/textMappers.js +2 -2
- package/dist/esm/SpellingDictionary/CachingDictionary.d.mts +30 -0
- package/dist/esm/SpellingDictionary/CachingDictionary.mjs +45 -0
- package/dist/esm/SpellingDictionary/FlagWordsDictionary.d.mts +11 -0
- package/dist/esm/SpellingDictionary/FlagWordsDictionary.mjs +134 -0
- package/dist/esm/SpellingDictionary/IgnoreWordsDictionary.d.mts +11 -0
- package/dist/esm/SpellingDictionary/IgnoreWordsDictionary.mjs +96 -0
- package/dist/esm/SpellingDictionary/SpellingDictionary.d.mts +150 -0
- package/dist/esm/SpellingDictionary/SpellingDictionary.mjs +4 -0
- package/dist/esm/SpellingDictionary/SpellingDictionaryCollection.d.mts +16 -0
- package/dist/esm/SpellingDictionary/SpellingDictionaryCollection.mjs +111 -0
- package/dist/esm/SpellingDictionary/SpellingDictionaryFromTrie.d.mts +50 -0
- package/dist/esm/SpellingDictionary/SpellingDictionaryFromTrie.mjs +172 -0
- package/dist/esm/SpellingDictionary/SpellingDictionaryMethods.d.mts +26 -0
- package/dist/esm/SpellingDictionary/SpellingDictionaryMethods.mjs +96 -0
- package/dist/esm/SpellingDictionary/SuggestDictionary.d.mts +20 -0
- package/dist/esm/SpellingDictionary/SuggestDictionary.mjs +97 -0
- package/dist/esm/SpellingDictionary/Terms/index.d.mts +2 -0
- package/dist/esm/SpellingDictionary/Terms/index.mjs +1 -0
- package/dist/esm/SpellingDictionary/Terms/terms.d.mts +12 -0
- package/dist/esm/SpellingDictionary/Terms/terms.mjs +1 -0
- package/dist/esm/SpellingDictionary/Typos/index.d.mts +4 -0
- package/dist/esm/SpellingDictionary/Typos/index.mjs +2 -0
- package/dist/esm/SpellingDictionary/Typos/typos.d.mts +18 -0
- package/dist/esm/SpellingDictionary/Typos/typos.mjs +1 -0
- package/dist/esm/SpellingDictionary/Typos/typosParser.d.mts +34 -0
- package/dist/esm/SpellingDictionary/Typos/typosParser.mjs +131 -0
- package/dist/esm/SpellingDictionary/Typos/util.d.mts +31 -0
- package/dist/esm/SpellingDictionary/Typos/util.mjs +105 -0
- package/dist/esm/SpellingDictionary/TyposDictionary.d.mts +21 -0
- package/dist/esm/SpellingDictionary/TyposDictionary.mjs +129 -0
- package/dist/esm/SpellingDictionary/createInlineSpellingDictionary.d.mts +3 -0
- package/dist/esm/SpellingDictionary/createInlineSpellingDictionary.mjs +20 -0
- package/dist/esm/SpellingDictionary/createSpellingDictionary.d.mts +23 -0
- package/dist/esm/SpellingDictionary/createSpellingDictionary.mjs +68 -0
- package/dist/esm/SpellingDictionary/defaults.d.mts +3 -0
- package/dist/esm/SpellingDictionary/defaults.mjs +2 -0
- package/dist/esm/SpellingDictionary/index.d.mts +11 -0
- package/dist/esm/SpellingDictionary/index.mjs +9 -0
- package/dist/esm/index.d.mts +3 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/util/AutoCache.d.mts +25 -0
- package/dist/esm/util/AutoCache.mjs +67 -0
- package/dist/esm/util/AutoResolve.d.mts +21 -0
- package/dist/esm/util/AutoResolve.mjs +52 -0
- package/dist/esm/util/IterableLike.d.mts +4 -0
- package/dist/esm/util/IterableLike.mjs +1 -0
- package/dist/esm/util/clean.d.mts +7 -0
- package/dist/esm/util/clean.mjs +13 -0
- package/dist/esm/util/regexHelper.d.mts +7 -0
- package/dist/esm/util/regexHelper.mjs +8 -0
- package/dist/esm/util/repMap.d.mts +27 -0
- package/dist/esm/util/repMap.mjs +152 -0
- package/dist/esm/util/simpleCache.d.mts +46 -0
- package/dist/esm/util/simpleCache.mjs +135 -0
- package/dist/esm/util/text.d.mts +10 -0
- package/dist/esm/util/text.mjs +46 -0
- package/dist/esm/util/textMappers.d.mts +3 -0
- package/dist/esm/util/textMappers.mjs +15 -0
- package/dist/esm/util/types.d.mts +7 -0
- package/dist/esm/util/types.mjs +1 -0
- package/dist/esm/util/util.d.mts +2 -0
- package/dist/esm/util/util.mjs +3 -0
- package/package.json +29 -20
- package/dist/SpellingDictionary/Typos/index.d.ts +0 -4
- package/dist/SpellingDictionary/createInlineSpellingDictionary.js +0 -25
- package/dist/util/repMap.d.ts +0 -11
- package/dist/util/repMap.js +0 -65
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionary.js +0 -0
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/index.js +0 -0
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/terms.d.ts +0 -0
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/terms.js +0 -0
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typos.js +0 -0
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/util.js +0 -0
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/defaults.d.ts +0 -0
- /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/defaults.js +0 -0
- /package/dist/{util → cjs/util}/AutoCache.d.ts +0 -0
- /package/dist/{util → cjs/util}/AutoCache.js +0 -0
- /package/dist/{util → cjs/util}/AutoResolve.d.ts +0 -0
- /package/dist/{util → cjs/util}/AutoResolve.js +0 -0
- /package/dist/{util → cjs/util}/IterableLike.d.ts +0 -0
- /package/dist/{util → cjs/util}/IterableLike.js +0 -0
- /package/dist/{util → cjs/util}/clean.js +0 -0
- /package/dist/{util → cjs/util}/regexHelper.d.ts +0 -0
- /package/dist/{util → cjs/util}/regexHelper.js +0 -0
- /package/dist/{util → cjs/util}/simpleCache.d.ts +0 -0
- /package/dist/{util → cjs/util}/simpleCache.js +0 -0
- /package/dist/{util → cjs/util}/text.d.ts +0 -0
- /package/dist/{util → cjs/util}/text.js +0 -0
- /package/dist/{util → cjs/util}/textMappers.d.ts +0 -0
- /package/dist/{util → cjs/util}/types.d.ts +0 -0
- /package/dist/{util → cjs/util}/types.js +0 -0
- /package/dist/{util → cjs/util}/util.d.ts +0 -0
- /package/dist/{util → cjs/util}/util.js +0 -0
|
@@ -25,11 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createTyposDictionary = void 0;
|
|
27
27
|
const sync_1 = require("@cspell/cspell-pipe/sync");
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const defaults = __importStar(require("./defaults"));
|
|
31
|
-
const
|
|
32
|
-
const
|
|
28
|
+
const AutoResolve_js_1 = require("../util/AutoResolve.js");
|
|
29
|
+
const textMappers_js_1 = require("../util/textMappers.js");
|
|
30
|
+
const defaults = __importStar(require("./defaults.js"));
|
|
31
|
+
const index_js_1 = require("./Typos/index.js");
|
|
32
|
+
const util_js_1 = require("./Typos/util.js");
|
|
33
33
|
class TyposDictionaryImpl {
|
|
34
34
|
constructor(name, source, typosDef, ignoreList) {
|
|
35
35
|
this.name = name;
|
|
@@ -39,10 +39,10 @@ class TyposDictionaryImpl {
|
|
|
39
39
|
this.type = 'typos';
|
|
40
40
|
this.isDictionaryCaseSensitive = true;
|
|
41
41
|
this.size = Object.keys(typosDef).length;
|
|
42
|
-
this.explicitIgnoreWords = (0,
|
|
43
|
-
this.suggestions = (0,
|
|
42
|
+
this.explicitIgnoreWords = (0, util_js_1.extractIgnoreValues)(typosDef, '!');
|
|
43
|
+
this.suggestions = (0, util_js_1.extractAllSuggestions)(typosDef);
|
|
44
44
|
this.ignoreWords = new Set((0, sync_1.pipe)(this.explicitIgnoreWords, (0, sync_1.opAppend)(ignoreList || [])));
|
|
45
|
-
this.suggestionsLower = new Set((0, sync_1.pipe)(this.suggestions,
|
|
45
|
+
this.suggestionsLower = new Set((0, sync_1.pipe)(this.suggestions, textMappers_js_1.mapperRemoveCaseAndAccents));
|
|
46
46
|
this.containsNoSuggestWords = this.ignoreWords.size > 0;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -139,7 +139,7 @@ class TyposDictionaryImpl {
|
|
|
139
139
|
return [];
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
const createCache = (0,
|
|
142
|
+
const createCache = (0, AutoResolve_js_1.createAutoResolveWeakCache)();
|
|
143
143
|
/**
|
|
144
144
|
* Create a dictionary where all words are to be forbidden.
|
|
145
145
|
* @param entries - list of Typos Entries
|
|
@@ -149,7 +149,7 @@ const createCache = (0, AutoResolve_1.createAutoResolveWeakCache)();
|
|
|
149
149
|
*/
|
|
150
150
|
function createTyposDictionary(entries, name, source) {
|
|
151
151
|
return createCache.get(entries, () => {
|
|
152
|
-
const def = (0,
|
|
152
|
+
const def = (0, index_js_1.processEntriesToTyposDef)(entries);
|
|
153
153
|
return new TyposDictionaryImpl(name, source, def);
|
|
154
154
|
});
|
|
155
155
|
}
|
package/dist/{SpellingDictionary → cjs/SpellingDictionary}/createInlineSpellingDictionary.d.ts
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { DictionaryDefinitionInline, SpellingDictionary } from './SpellingDictionary';
|
|
1
|
+
import type { DictionaryDefinitionInline, SpellingDictionary } from './SpellingDictionary.js';
|
|
2
2
|
export declare function createInlineSpellingDictionary(inlineDict: DictionaryDefinitionInline, source: string): SpellingDictionary;
|
|
3
3
|
//# sourceMappingURL=createInlineSpellingDictionary.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInlineSpellingDictionary = void 0;
|
|
4
|
+
const AutoResolve_js_1 = require("../util/AutoResolve.js");
|
|
5
|
+
const util_js_1 = require("../util/util.js");
|
|
6
|
+
const createSpellingDictionary_js_1 = require("./createSpellingDictionary.js");
|
|
7
|
+
const FlagWordsDictionary_js_1 = require("./FlagWordsDictionary.js");
|
|
8
|
+
const IgnoreWordsDictionary_js_1 = require("./IgnoreWordsDictionary.js");
|
|
9
|
+
const SpellingDictionaryCollection_js_1 = require("./SpellingDictionaryCollection.js");
|
|
10
|
+
const SuggestDictionary_js_1 = require("./SuggestDictionary.js");
|
|
11
|
+
const cache = (0, AutoResolve_js_1.createAutoResolveWeakCache)();
|
|
12
|
+
function createInlineSpellingDictionary(inlineDict, source) {
|
|
13
|
+
return cache.get(inlineDict, () => {
|
|
14
|
+
const { words, flagWords, ignoreWords, suggestWords, name } = inlineDict;
|
|
15
|
+
const dictSources = [
|
|
16
|
+
words && (0, createSpellingDictionary_js_1.createSpellingDictionary)(words, name + '-words', source, inlineDict),
|
|
17
|
+
flagWords && (0, FlagWordsDictionary_js_1.createFlagWordsDictionary)(flagWords, name + '-flag-words', source),
|
|
18
|
+
ignoreWords && (0, IgnoreWordsDictionary_js_1.createIgnoreWordsDictionary)(ignoreWords, name + '-ignore-words', source),
|
|
19
|
+
suggestWords && (0, SuggestDictionary_js_1.createSuggestDictionary)(suggestWords, name + '-suggest', source),
|
|
20
|
+
].filter(util_js_1.isDefined);
|
|
21
|
+
return (0, SpellingDictionaryCollection_js_1.createCollection)(dictSources, name, source);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.createInlineSpellingDictionary = createInlineSpellingDictionary;
|
|
25
|
+
//# sourceMappingURL=createInlineSpellingDictionary.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IterableLike } from '../util/IterableLike';
|
|
2
|
-
import type { DictionaryInfo, SpellingDictionary, SpellingDictionaryOptions } from './SpellingDictionary';
|
|
1
|
+
import type { IterableLike } from '../util/IterableLike.js';
|
|
2
|
+
import type { DictionaryInfo, SpellingDictionary, SpellingDictionaryOptions } from './SpellingDictionary.js';
|
|
3
3
|
/**
|
|
4
4
|
* Create a SpellingDictionary
|
|
5
5
|
* @param wordList - list of words
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFailedToLoadDictionary = exports.createSpellingDictionary = void 0;
|
|
4
4
|
const cspell_trie_lib_1 = require("cspell-trie-lib");
|
|
5
5
|
const fast_equals_1 = require("fast-equals");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const cachedDictionaries = new
|
|
6
|
+
const simpleCache_js_1 = require("../util/simpleCache.js");
|
|
7
|
+
const SpellingDictionary_js_1 = require("./SpellingDictionary.js");
|
|
8
|
+
const SpellingDictionaryFromTrie_js_1 = require("./SpellingDictionaryFromTrie.js");
|
|
9
|
+
const SpellingDictionaryMethods_js_1 = require("./SpellingDictionaryMethods.js");
|
|
10
|
+
const cachedDictionaries = new simpleCache_js_1.AutoWeakCache(_createSpellingDictionary, 64);
|
|
11
11
|
const maxSetSize = 3;
|
|
12
|
-
const cachedParamsByWordList = new
|
|
12
|
+
const cachedParamsByWordList = new simpleCache_js_1.SimpleCache(64);
|
|
13
13
|
/**
|
|
14
14
|
* Create a SpellingDictionary
|
|
15
15
|
* @param wordList - list of words
|
|
@@ -42,11 +42,11 @@ function _createSpellingDictionary(params) {
|
|
|
42
42
|
const parseOptions = { stripCaseAndAccents: options?.supportNonStrictSearches ?? true };
|
|
43
43
|
const words = (0, cspell_trie_lib_1.parseDictionaryLines)(wordList, parseOptions);
|
|
44
44
|
const trie = (0, cspell_trie_lib_1.buildTrieFast)(words);
|
|
45
|
-
const opts = { ...(options ||
|
|
45
|
+
const opts = { ...(options || SpellingDictionary_js_1.defaultOptions) };
|
|
46
46
|
if (opts.weightMap === undefined && opts.dictionaryInformation) {
|
|
47
|
-
opts.weightMap = (0,
|
|
47
|
+
opts.weightMap = (0, SpellingDictionaryMethods_js_1.createWeightMapFromDictionaryInformation)(opts.dictionaryInformation);
|
|
48
48
|
}
|
|
49
|
-
return new
|
|
49
|
+
return new SpellingDictionaryFromTrie_js_1.SpellingDictionaryFromTrie(trie, name, opts, source);
|
|
50
50
|
}
|
|
51
51
|
function createFailedToLoadDictionary(name, source, error, options) {
|
|
52
52
|
options = options || {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { CachingDictionary, createCachingDictionary } from './CachingDictionary';
|
|
2
|
-
export { createInlineSpellingDictionary } from './createInlineSpellingDictionary';
|
|
3
|
-
export { createFailedToLoadDictionary, createSpellingDictionary } from './createSpellingDictionary';
|
|
4
|
-
export { createFlagWordsDictionary, createFlagWordsDictionary as createForbiddenWordsDictionary, } from './FlagWordsDictionary';
|
|
5
|
-
export { createIgnoreWordsDictionary } from './IgnoreWordsDictionary';
|
|
6
|
-
export type { DictionaryDefinitionInline, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary';
|
|
7
|
-
export { createCollection, SpellingDictionaryCollection } from './SpellingDictionaryCollection';
|
|
8
|
-
export { createSpellingDictionaryFromTrieFile } from './SpellingDictionaryFromTrie';
|
|
9
|
-
export { createSuggestDictionary } from './SuggestDictionary';
|
|
10
|
-
export { createTyposDictionary } from './TyposDictionary';
|
|
1
|
+
export { CachingDictionary, createCachingDictionary } from './CachingDictionary.js';
|
|
2
|
+
export { createInlineSpellingDictionary } from './createInlineSpellingDictionary.js';
|
|
3
|
+
export { createFailedToLoadDictionary, createSpellingDictionary } from './createSpellingDictionary.js';
|
|
4
|
+
export { createFlagWordsDictionary, createFlagWordsDictionary as createForbiddenWordsDictionary, } from './FlagWordsDictionary.js';
|
|
5
|
+
export { createIgnoreWordsDictionary } from './IgnoreWordsDictionary.js';
|
|
6
|
+
export type { DictionaryDefinitionInline, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary.js';
|
|
7
|
+
export { createCollection, SpellingDictionaryCollection } from './SpellingDictionaryCollection.js';
|
|
8
|
+
export { createSpellingDictionaryFromTrieFile } from './SpellingDictionaryFromTrie.js';
|
|
9
|
+
export { createSuggestDictionary } from './SuggestDictionary.js';
|
|
10
|
+
export { createTyposDictionary } from './TyposDictionary.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTyposDictionary = exports.createSuggestDictionary = exports.createSpellingDictionaryFromTrieFile = exports.createCollection = exports.createIgnoreWordsDictionary = exports.createForbiddenWordsDictionary = exports.createFlagWordsDictionary = exports.createSpellingDictionary = exports.createFailedToLoadDictionary = exports.createInlineSpellingDictionary = exports.createCachingDictionary = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "createCachingDictionary", { enumerable: true, get: function () { return
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "createInlineSpellingDictionary", { enumerable: true, get: function () { return
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "createFailedToLoadDictionary", { enumerable: true, get: function () { return
|
|
10
|
-
Object.defineProperty(exports, "createSpellingDictionary", { enumerable: true, get: function () { return
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "createFlagWordsDictionary", { enumerable: true, get: function () { return
|
|
13
|
-
Object.defineProperty(exports, "createForbiddenWordsDictionary", { enumerable: true, get: function () { return
|
|
14
|
-
var
|
|
15
|
-
Object.defineProperty(exports, "createIgnoreWordsDictionary", { enumerable: true, get: function () { return
|
|
16
|
-
var
|
|
17
|
-
Object.defineProperty(exports, "createCollection", { enumerable: true, get: function () { return
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "createSpellingDictionaryFromTrieFile", { enumerable: true, get: function () { return
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "createSuggestDictionary", { enumerable: true, get: function () { return
|
|
22
|
-
var
|
|
23
|
-
Object.defineProperty(exports, "createTyposDictionary", { enumerable: true, get: function () { return
|
|
4
|
+
var CachingDictionary_js_1 = require("./CachingDictionary.js");
|
|
5
|
+
Object.defineProperty(exports, "createCachingDictionary", { enumerable: true, get: function () { return CachingDictionary_js_1.createCachingDictionary; } });
|
|
6
|
+
var createInlineSpellingDictionary_js_1 = require("./createInlineSpellingDictionary.js");
|
|
7
|
+
Object.defineProperty(exports, "createInlineSpellingDictionary", { enumerable: true, get: function () { return createInlineSpellingDictionary_js_1.createInlineSpellingDictionary; } });
|
|
8
|
+
var createSpellingDictionary_js_1 = require("./createSpellingDictionary.js");
|
|
9
|
+
Object.defineProperty(exports, "createFailedToLoadDictionary", { enumerable: true, get: function () { return createSpellingDictionary_js_1.createFailedToLoadDictionary; } });
|
|
10
|
+
Object.defineProperty(exports, "createSpellingDictionary", { enumerable: true, get: function () { return createSpellingDictionary_js_1.createSpellingDictionary; } });
|
|
11
|
+
var FlagWordsDictionary_js_1 = require("./FlagWordsDictionary.js");
|
|
12
|
+
Object.defineProperty(exports, "createFlagWordsDictionary", { enumerable: true, get: function () { return FlagWordsDictionary_js_1.createFlagWordsDictionary; } });
|
|
13
|
+
Object.defineProperty(exports, "createForbiddenWordsDictionary", { enumerable: true, get: function () { return FlagWordsDictionary_js_1.createFlagWordsDictionary; } });
|
|
14
|
+
var IgnoreWordsDictionary_js_1 = require("./IgnoreWordsDictionary.js");
|
|
15
|
+
Object.defineProperty(exports, "createIgnoreWordsDictionary", { enumerable: true, get: function () { return IgnoreWordsDictionary_js_1.createIgnoreWordsDictionary; } });
|
|
16
|
+
var SpellingDictionaryCollection_js_1 = require("./SpellingDictionaryCollection.js");
|
|
17
|
+
Object.defineProperty(exports, "createCollection", { enumerable: true, get: function () { return SpellingDictionaryCollection_js_1.createCollection; } });
|
|
18
|
+
var SpellingDictionaryFromTrie_js_1 = require("./SpellingDictionaryFromTrie.js");
|
|
19
|
+
Object.defineProperty(exports, "createSpellingDictionaryFromTrieFile", { enumerable: true, get: function () { return SpellingDictionaryFromTrie_js_1.createSpellingDictionaryFromTrieFile; } });
|
|
20
|
+
var SuggestDictionary_js_1 = require("./SuggestDictionary.js");
|
|
21
|
+
Object.defineProperty(exports, "createSuggestDictionary", { enumerable: true, get: function () { return SuggestDictionary_js_1.createSuggestDictionary; } });
|
|
22
|
+
var TyposDictionary_js_1 = require("./TyposDictionary.js");
|
|
23
|
+
Object.defineProperty(exports, "createTyposDictionary", { enumerable: true, get: function () { return TyposDictionary_js_1.createTyposDictionary; } });
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { CachingDictionary, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryCollection, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary';
|
|
2
|
-
export { createCachingDictionary, createCollection, createFailedToLoadDictionary, createFlagWordsDictionary, createForbiddenWordsDictionary, createIgnoreWordsDictionary, createInlineSpellingDictionary, createSpellingDictionary, createSpellingDictionaryFromTrieFile, createSuggestDictionary, } from './SpellingDictionary';
|
|
1
|
+
export type { CachingDictionary, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryCollection, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary/index.js';
|
|
2
|
+
export { createCachingDictionary, createCollection, createFailedToLoadDictionary, createFlagWordsDictionary, createForbiddenWordsDictionary, createIgnoreWordsDictionary, createInlineSpellingDictionary, createSpellingDictionary, createSpellingDictionaryFromTrieFile, createSuggestDictionary, } from './SpellingDictionary/index.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSuggestDictionary = exports.createSpellingDictionaryFromTrieFile = exports.createSpellingDictionary = exports.createInlineSpellingDictionary = exports.createIgnoreWordsDictionary = exports.createForbiddenWordsDictionary = exports.createFlagWordsDictionary = exports.createFailedToLoadDictionary = exports.createCollection = exports.createCachingDictionary = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "createCachingDictionary", { enumerable: true, get: function () { return
|
|
6
|
-
Object.defineProperty(exports, "createCollection", { enumerable: true, get: function () { return
|
|
7
|
-
Object.defineProperty(exports, "createFailedToLoadDictionary", { enumerable: true, get: function () { return
|
|
8
|
-
Object.defineProperty(exports, "createFlagWordsDictionary", { enumerable: true, get: function () { return
|
|
9
|
-
Object.defineProperty(exports, "createForbiddenWordsDictionary", { enumerable: true, get: function () { return
|
|
10
|
-
Object.defineProperty(exports, "createIgnoreWordsDictionary", { enumerable: true, get: function () { return
|
|
11
|
-
Object.defineProperty(exports, "createInlineSpellingDictionary", { enumerable: true, get: function () { return
|
|
12
|
-
Object.defineProperty(exports, "createSpellingDictionary", { enumerable: true, get: function () { return
|
|
13
|
-
Object.defineProperty(exports, "createSpellingDictionaryFromTrieFile", { enumerable: true, get: function () { return
|
|
14
|
-
Object.defineProperty(exports, "createSuggestDictionary", { enumerable: true, get: function () { return
|
|
4
|
+
var index_js_1 = require("./SpellingDictionary/index.js");
|
|
5
|
+
Object.defineProperty(exports, "createCachingDictionary", { enumerable: true, get: function () { return index_js_1.createCachingDictionary; } });
|
|
6
|
+
Object.defineProperty(exports, "createCollection", { enumerable: true, get: function () { return index_js_1.createCollection; } });
|
|
7
|
+
Object.defineProperty(exports, "createFailedToLoadDictionary", { enumerable: true, get: function () { return index_js_1.createFailedToLoadDictionary; } });
|
|
8
|
+
Object.defineProperty(exports, "createFlagWordsDictionary", { enumerable: true, get: function () { return index_js_1.createFlagWordsDictionary; } });
|
|
9
|
+
Object.defineProperty(exports, "createForbiddenWordsDictionary", { enumerable: true, get: function () { return index_js_1.createForbiddenWordsDictionary; } });
|
|
10
|
+
Object.defineProperty(exports, "createIgnoreWordsDictionary", { enumerable: true, get: function () { return index_js_1.createIgnoreWordsDictionary; } });
|
|
11
|
+
Object.defineProperty(exports, "createInlineSpellingDictionary", { enumerable: true, get: function () { return index_js_1.createInlineSpellingDictionary; } });
|
|
12
|
+
Object.defineProperty(exports, "createSpellingDictionary", { enumerable: true, get: function () { return index_js_1.createSpellingDictionary; } });
|
|
13
|
+
Object.defineProperty(exports, "createSpellingDictionaryFromTrieFile", { enumerable: true, get: function () { return index_js_1.createSpellingDictionaryFromTrieFile; } });
|
|
14
|
+
Object.defineProperty(exports, "createSuggestDictionary", { enumerable: true, get: function () { return index_js_1.createSuggestDictionary; } });
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CharacterSet, ReplaceMap } from '@cspell/cspell-types';
|
|
2
|
+
export type ReplaceMapper = (src: string) => string;
|
|
3
|
+
export declare function createMapper(repMap: ReplaceMap | undefined, ignoreCharset?: string): ReplaceMapper;
|
|
4
|
+
declare function charsetToRepMapRegEx(charset: CharacterSet | undefined, replaceWith?: string): ReplaceMap | undefined;
|
|
5
|
+
declare function createMapperRegExp(repMap: ReplaceMap): RegExp;
|
|
6
|
+
interface RepTrieNode {
|
|
7
|
+
rep?: string[];
|
|
8
|
+
children?: Record<string, RepTrieNode>;
|
|
9
|
+
}
|
|
10
|
+
interface Edit {
|
|
11
|
+
b: number;
|
|
12
|
+
e: number;
|
|
13
|
+
r: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function createRepMapper(repMap: ReplaceMap | undefined, ignoreCharset?: string): (word: string) => string[];
|
|
16
|
+
declare function applyEdits(word: string, edits: Edit[]): string[];
|
|
17
|
+
declare function calcAllEdits(root: RepTrieNode, word: string): Edit[];
|
|
18
|
+
declare function createTrie(repMap: ReplaceMap | undefined, ignoreCharset?: string): RepTrieNode;
|
|
19
|
+
export declare const __testing__: {
|
|
20
|
+
charsetToRepMap: typeof charsetToRepMapRegEx;
|
|
21
|
+
createMapperRegExp: typeof createMapperRegExp;
|
|
22
|
+
createTrie: typeof createTrie;
|
|
23
|
+
calcAllEdits: typeof calcAllEdits;
|
|
24
|
+
applyEdits: typeof applyEdits;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=repMap.d.ts.map
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__testing__ = exports.createRepMapper = exports.createMapper = void 0;
|
|
4
|
+
const cspell_trie_lib_1 = require("cspell-trie-lib");
|
|
5
|
+
const regexHelper_js_1 = require("./regexHelper.js");
|
|
6
|
+
const util_js_1 = require("./util.js");
|
|
7
|
+
function createMapper(repMap, ignoreCharset) {
|
|
8
|
+
if (!repMap && !ignoreCharset)
|
|
9
|
+
return (a) => a;
|
|
10
|
+
repMap = repMap || [];
|
|
11
|
+
const charsetMap = charsetToRepMapRegEx(ignoreCharset);
|
|
12
|
+
if (charsetMap) {
|
|
13
|
+
repMap = repMap.concat(charsetMap);
|
|
14
|
+
}
|
|
15
|
+
const filteredMap = repMap.filter(([match, _]) => !!match);
|
|
16
|
+
if (!filteredMap.length) {
|
|
17
|
+
return (a) => a;
|
|
18
|
+
}
|
|
19
|
+
const regEx = createMapperRegExp(repMap);
|
|
20
|
+
const values = repMap.filter(([match, _]) => !!match).map(([_, into]) => into);
|
|
21
|
+
function resolve(m, ...matches) {
|
|
22
|
+
const index = matches.findIndex((a) => !!a);
|
|
23
|
+
return 0 <= index && index < values.length ? values[index] : m;
|
|
24
|
+
}
|
|
25
|
+
return function (s) {
|
|
26
|
+
return s.replace(regEx, resolve);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.createMapper = createMapper;
|
|
30
|
+
function charsetToRepMapRegEx(charset, replaceWith = '') {
|
|
31
|
+
if (!charset)
|
|
32
|
+
return undefined;
|
|
33
|
+
return charset
|
|
34
|
+
.split('|')
|
|
35
|
+
.map((chars) => `[${chars.replace(/[\][\\]/g, '\\$&')}]`)
|
|
36
|
+
.map((map) => [map, replaceWith]);
|
|
37
|
+
}
|
|
38
|
+
function charsetToRepMap(charset, replaceWith = '') {
|
|
39
|
+
if (!charset)
|
|
40
|
+
return undefined;
|
|
41
|
+
return charset
|
|
42
|
+
.split('|')
|
|
43
|
+
.flatMap((chars) => [...(0, cspell_trie_lib_1.expandCharacterSet)(chars)])
|
|
44
|
+
.map((char) => [char, replaceWith]);
|
|
45
|
+
}
|
|
46
|
+
function expandReplaceMap(repMap) {
|
|
47
|
+
return repMap.flatMap(([from, replaceWith]) => from.split('|').map((w) => [w, replaceWith]));
|
|
48
|
+
}
|
|
49
|
+
function createMapperRegExp(repMap) {
|
|
50
|
+
const filteredMap = repMap.filter(([match, _]) => !!match);
|
|
51
|
+
if (!filteredMap.length) {
|
|
52
|
+
return /$^/;
|
|
53
|
+
}
|
|
54
|
+
const regExStr = filteredMap
|
|
55
|
+
.map(([from, _]) => from)
|
|
56
|
+
// make sure it compiles into a regex
|
|
57
|
+
.map((s) => {
|
|
58
|
+
try {
|
|
59
|
+
// fix up any nested ()
|
|
60
|
+
const r = s.match(/\(/) ? s.replace(/\((?=.*\))/g, '(?:').replace(/\(\?:\?/g, '(?') : s;
|
|
61
|
+
new RegExp(r);
|
|
62
|
+
s = r;
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return (0, regexHelper_js_1.escapeRegEx)(s);
|
|
66
|
+
}
|
|
67
|
+
return s;
|
|
68
|
+
})
|
|
69
|
+
.map((s) => `(${s})`)
|
|
70
|
+
.join('|');
|
|
71
|
+
const regEx = new RegExp(regExStr, 'g');
|
|
72
|
+
return regEx;
|
|
73
|
+
}
|
|
74
|
+
function createRepMapper(repMap, ignoreCharset) {
|
|
75
|
+
if (!repMap && !ignoreCharset)
|
|
76
|
+
return (word) => [word];
|
|
77
|
+
const trie = createTrie(repMap, ignoreCharset);
|
|
78
|
+
// const root = createTrie(repMap, ignoreCharset);
|
|
79
|
+
return (word) => {
|
|
80
|
+
const edits = calcAllEdits(trie, word);
|
|
81
|
+
return applyEdits(word, edits);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
exports.createRepMapper = createRepMapper;
|
|
85
|
+
function applyEdits(word, edits) {
|
|
86
|
+
if (!edits.length)
|
|
87
|
+
return [word];
|
|
88
|
+
// Prepare
|
|
89
|
+
const letterEdits = [];
|
|
90
|
+
for (let i = 0; i < word.length; ++i) {
|
|
91
|
+
letterEdits[i] = { edits: [{ b: i, e: i + 1, r: word[i] }], suffixes: [] };
|
|
92
|
+
}
|
|
93
|
+
letterEdits[word.length] = { edits: [], suffixes: [''] };
|
|
94
|
+
// Add edits
|
|
95
|
+
for (const edit of edits) {
|
|
96
|
+
const le = letterEdits[edit.b];
|
|
97
|
+
le.edits.push(edit);
|
|
98
|
+
}
|
|
99
|
+
// Apply edits in reverse
|
|
100
|
+
for (let i = word.length - 1; i >= 0; --i) {
|
|
101
|
+
const le = letterEdits[i];
|
|
102
|
+
const sfx = le.suffixes;
|
|
103
|
+
for (const edit of le.edits) {
|
|
104
|
+
const pfx = edit.r;
|
|
105
|
+
const nSfx = letterEdits[edit.e].suffixes;
|
|
106
|
+
for (const s of nSfx) {
|
|
107
|
+
sfx.push(pfx + s);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const results = new Set(letterEdits[0].suffixes);
|
|
112
|
+
return [...results];
|
|
113
|
+
}
|
|
114
|
+
function calcAllEdits(root, word) {
|
|
115
|
+
const edits = [];
|
|
116
|
+
function walk(node, b, e) {
|
|
117
|
+
if (node.rep) {
|
|
118
|
+
node.rep.forEach((r) => edits.push({ b, e, r }));
|
|
119
|
+
}
|
|
120
|
+
if (e === word.length || !node.children)
|
|
121
|
+
return;
|
|
122
|
+
const n = node.children[word[e]];
|
|
123
|
+
if (!n)
|
|
124
|
+
return;
|
|
125
|
+
walk(n, b, e + 1);
|
|
126
|
+
}
|
|
127
|
+
for (let i = 0; i < word.length; ++i) {
|
|
128
|
+
walk(root, i, i);
|
|
129
|
+
}
|
|
130
|
+
return edits;
|
|
131
|
+
}
|
|
132
|
+
function createTrie(repMap, ignoreCharset) {
|
|
133
|
+
const combined = [repMap, charsetToRepMap(ignoreCharset)].filter(util_js_1.isDefined).flatMap((a) => a);
|
|
134
|
+
const expanded = expandReplaceMap(combined);
|
|
135
|
+
const trieRoot = Object.create(null);
|
|
136
|
+
expanded.forEach(([match, replaceWith]) => addToTrie(trieRoot, match, replaceWith));
|
|
137
|
+
return trieRoot;
|
|
138
|
+
}
|
|
139
|
+
function addToTrie(node, match, replaceWith) {
|
|
140
|
+
while (match) {
|
|
141
|
+
const children = node.children || (node.children = Object.create(null));
|
|
142
|
+
const k = match[0];
|
|
143
|
+
const childNode = children[k] || (children[k] = Object.create(null));
|
|
144
|
+
node = childNode;
|
|
145
|
+
match = match.slice(1);
|
|
146
|
+
}
|
|
147
|
+
const s = new Set(node.rep || []);
|
|
148
|
+
s.add(replaceWith);
|
|
149
|
+
node.rep = [...s];
|
|
150
|
+
}
|
|
151
|
+
exports.__testing__ = {
|
|
152
|
+
charsetToRepMap: charsetToRepMapRegEx,
|
|
153
|
+
createMapperRegExp,
|
|
154
|
+
createTrie,
|
|
155
|
+
calcAllEdits,
|
|
156
|
+
applyEdits,
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=repMap.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapperRemoveCaseAndAccents = exports.mapperNormalizeNFC = void 0;
|
|
4
|
-
const
|
|
4
|
+
const text_js_1 = require("./text.js");
|
|
5
5
|
function* mapperNormalizeNFC(words) {
|
|
6
6
|
for (const word of words) {
|
|
7
7
|
yield word.normalize('NFC');
|
|
@@ -12,7 +12,7 @@ function* mapperRemoveCaseAndAccents(words) {
|
|
|
12
12
|
for (const word of words) {
|
|
13
13
|
const lc = word.toLowerCase();
|
|
14
14
|
yield lc;
|
|
15
|
-
const woAccents = (0,
|
|
15
|
+
const woAccents = (0, text_js_1.removeAccents)(lc);
|
|
16
16
|
if (lc !== woAccents)
|
|
17
17
|
yield woAccents;
|
|
18
18
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CacheStats } from '../util/AutoCache.mjs';
|
|
2
|
+
import type { SearchOptions, SpellingDictionary } from './SpellingDictionary.mjs';
|
|
3
|
+
import type { SpellingDictionaryCollection } from './SpellingDictionaryCollection.mjs';
|
|
4
|
+
interface CallStats {
|
|
5
|
+
name: string;
|
|
6
|
+
id: number;
|
|
7
|
+
has: CacheStats;
|
|
8
|
+
isNoSuggestWord: CacheStats;
|
|
9
|
+
isForbidden: CacheStats;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Caching Dictionary remembers method calls to increase performance.
|
|
13
|
+
*/
|
|
14
|
+
export interface CachingDictionary {
|
|
15
|
+
name: string;
|
|
16
|
+
id: number;
|
|
17
|
+
has(word: string): boolean;
|
|
18
|
+
isNoSuggestWord(word: string): boolean;
|
|
19
|
+
isForbidden(word: string): boolean;
|
|
20
|
+
stats(): CallStats;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* create a caching dictionary
|
|
24
|
+
* @param dict - Dictionary to cache the search results.
|
|
25
|
+
* @param options - Search options to use.
|
|
26
|
+
* @returns CachingDictionary
|
|
27
|
+
*/
|
|
28
|
+
export declare function createCachingDictionary(dict: SpellingDictionary | SpellingDictionaryCollection, options: SearchOptions): CachingDictionary;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=CachingDictionary.d.mts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { autoCache, extractStats } from '../util/AutoCache.mjs';
|
|
2
|
+
import { canonicalSearchOptions } from './SpellingDictionaryMethods.mjs';
|
|
3
|
+
let dictionaryCounter = 0;
|
|
4
|
+
class CachedDict {
|
|
5
|
+
constructor(dict, options) {
|
|
6
|
+
this.dict = dict;
|
|
7
|
+
this.options = options;
|
|
8
|
+
this.id = ++dictionaryCounter;
|
|
9
|
+
this.has = autoCache((word) => this.dict.has(word, this.options));
|
|
10
|
+
this.isNoSuggestWord = autoCache((word) => this.dict.isNoSuggestWord(word, this.options));
|
|
11
|
+
this.isForbidden = autoCache((word) => this.dict.isForbidden(word));
|
|
12
|
+
this.name = dict.name;
|
|
13
|
+
// console.log(`CachedDict for ${this.name}`);
|
|
14
|
+
}
|
|
15
|
+
stats() {
|
|
16
|
+
return {
|
|
17
|
+
name: this.name,
|
|
18
|
+
id: this.id,
|
|
19
|
+
has: extractStats(this.has),
|
|
20
|
+
isNoSuggestWord: extractStats(this.isNoSuggestWord),
|
|
21
|
+
isForbidden: extractStats(this.isForbidden),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const knownDicts = new Map();
|
|
26
|
+
/**
|
|
27
|
+
* create a caching dictionary
|
|
28
|
+
* @param dict - Dictionary to cache the search results.
|
|
29
|
+
* @param options - Search options to use.
|
|
30
|
+
* @returns CachingDictionary
|
|
31
|
+
*/
|
|
32
|
+
export function createCachingDictionary(dict, options) {
|
|
33
|
+
options = canonicalSearchOptions(options);
|
|
34
|
+
let knownOptions = knownDicts.get(options);
|
|
35
|
+
if (!knownOptions) {
|
|
36
|
+
knownOptions = new WeakMap();
|
|
37
|
+
knownDicts.set(options, knownOptions);
|
|
38
|
+
}
|
|
39
|
+
const known = knownOptions.get(dict);
|
|
40
|
+
if (known)
|
|
41
|
+
return known;
|
|
42
|
+
const cached = new CachedDict(dict, options);
|
|
43
|
+
knownOptions.set(dict, cached);
|
|
44
|
+
return cached;
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SpellingDictionary } from './SpellingDictionary.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Create a dictionary where all words are to be forbidden.
|
|
4
|
+
* @param wordList - list of words
|
|
5
|
+
* @param name
|
|
6
|
+
* @param source
|
|
7
|
+
* @param options
|
|
8
|
+
* @returns SpellingDictionary
|
|
9
|
+
*/
|
|
10
|
+
export declare function createFlagWordsDictionary(wordList: readonly string[], name: string, source: string): SpellingDictionary;
|
|
11
|
+
//# sourceMappingURL=FlagWordsDictionary.d.mts.map
|