cspell-trie-lib 8.17.1 → 8.17.2

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.
Files changed (223) hide show
  1. package/dist/index.d.ts +808 -2
  2. package/dist/index.js +7796 -1
  3. package/package.json +7 -7
  4. package/dist/lib/Builder/BuilderCursor.d.ts +0 -10
  5. package/dist/lib/Builder/BuilderCursor.js +0 -2
  6. package/dist/lib/Builder/TrieBuilder.d.ts +0 -19
  7. package/dist/lib/Builder/TrieBuilder.js +0 -2
  8. package/dist/lib/Builder/cursor-util.d.ts +0 -4
  9. package/dist/lib/Builder/cursor-util.js +0 -39
  10. package/dist/lib/Builder/index.d.ts +0 -4
  11. package/dist/lib/Builder/index.js +0 -2
  12. package/dist/lib/ITrie.d.ts +0 -168
  13. package/dist/lib/ITrie.js +0 -173
  14. package/dist/lib/ITrieNode/CompoundModes.d.ts +0 -15
  15. package/dist/lib/ITrieNode/CompoundModes.js +0 -5
  16. package/dist/lib/ITrieNode/FindOptions.d.ts +0 -10
  17. package/dist/lib/ITrieNode/FindOptions.js +0 -2
  18. package/dist/lib/ITrieNode/FindTypes.d.ts +0 -7
  19. package/dist/lib/ITrieNode/FindTypes.js +0 -2
  20. package/dist/lib/ITrieNode/ITrieNode.d.ts +0 -78
  21. package/dist/lib/ITrieNode/ITrieNode.js +0 -2
  22. package/dist/lib/ITrieNode/TrieInfo.d.ts +0 -14
  23. package/dist/lib/ITrieNode/TrieInfo.js +0 -2
  24. package/dist/lib/ITrieNode/find.d.ts +0 -30
  25. package/dist/lib/ITrieNode/find.js +0 -307
  26. package/dist/lib/ITrieNode/index.d.ts +0 -3
  27. package/dist/lib/ITrieNode/index.js +0 -2
  28. package/dist/lib/ITrieNode/trie-util.d.ts +0 -17
  29. package/dist/lib/ITrieNode/trie-util.js +0 -62
  30. package/dist/lib/ITrieNode/walker/hintedWalker.d.ts +0 -23
  31. package/dist/lib/ITrieNode/walker/hintedWalker.js +0 -139
  32. package/dist/lib/ITrieNode/walker/index.d.ts +0 -5
  33. package/dist/lib/ITrieNode/walker/index.js +0 -4
  34. package/dist/lib/ITrieNode/walker/walker.d.ts +0 -10
  35. package/dist/lib/ITrieNode/walker/walker.js +0 -127
  36. package/dist/lib/ITrieNode/walker/walkerTypes.d.ts +0 -14
  37. package/dist/lib/ITrieNode/walker/walkerTypes.js +0 -2
  38. package/dist/lib/SimpleDictionaryParser.d.ts +0 -80
  39. package/dist/lib/SimpleDictionaryParser.js +0 -213
  40. package/dist/lib/TrieBlob/CharIndex.d.ts +0 -32
  41. package/dist/lib/TrieBlob/CharIndex.js +0 -116
  42. package/dist/lib/TrieBlob/FastTrieBlob.d.ts +0 -86
  43. package/dist/lib/TrieBlob/FastTrieBlob.js +0 -317
  44. package/dist/lib/TrieBlob/FastTrieBlobBitMaskInfo.d.ts +0 -7
  45. package/dist/lib/TrieBlob/FastTrieBlobBitMaskInfo.js +0 -9
  46. package/dist/lib/TrieBlob/FastTrieBlobBuilder.d.ts +0 -52
  47. package/dist/lib/TrieBlob/FastTrieBlobBuilder.js +0 -323
  48. package/dist/lib/TrieBlob/FastTrieBlobIRoot.d.ts +0 -52
  49. package/dist/lib/TrieBlob/FastTrieBlobIRoot.js +0 -237
  50. package/dist/lib/TrieBlob/FastTrieBlobInternals.d.ts +0 -43
  51. package/dist/lib/TrieBlob/FastTrieBlobInternals.js +0 -87
  52. package/dist/lib/TrieBlob/TrieBlob.d.ts +0 -71
  53. package/dist/lib/TrieBlob/TrieBlob.js +0 -446
  54. package/dist/lib/TrieBlob/TrieBlobIRoot.d.ts +0 -86
  55. package/dist/lib/TrieBlob/TrieBlobIRoot.js +0 -266
  56. package/dist/lib/TrieBlob/Utf8.d.ts +0 -55
  57. package/dist/lib/TrieBlob/Utf8.js +0 -261
  58. package/dist/lib/TrieBlob/createTrieBlob.d.ts +0 -8
  59. package/dist/lib/TrieBlob/createTrieBlob.js +0 -12
  60. package/dist/lib/TrieBlob/index.d.ts +0 -2
  61. package/dist/lib/TrieBlob/index.js +0 -2
  62. package/dist/lib/TrieBlob/resolveMap.d.ts +0 -2
  63. package/dist/lib/TrieBlob/resolveMap.js +0 -9
  64. package/dist/lib/TrieBuilder.d.ts +0 -55
  65. package/dist/lib/TrieBuilder.js +0 -302
  66. package/dist/lib/TrieCursor/TrieCursor.d.ts +0 -9
  67. package/dist/lib/TrieCursor/TrieCursor.js +0 -2
  68. package/dist/lib/TrieCursor/index.d.ts +0 -2
  69. package/dist/lib/TrieCursor/index.js +0 -2
  70. package/dist/lib/TrieData.d.ts +0 -18
  71. package/dist/lib/TrieData.js +0 -2
  72. package/dist/lib/TrieNode/TrieNode.d.ts +0 -11
  73. package/dist/lib/TrieNode/TrieNode.js +0 -2
  74. package/dist/lib/TrieNode/TrieNodeBuilder.d.ts +0 -31
  75. package/dist/lib/TrieNode/TrieNodeBuilder.js +0 -125
  76. package/dist/lib/TrieNode/TrieNodeTrie.d.ts +0 -25
  77. package/dist/lib/TrieNode/TrieNodeTrie.js +0 -53
  78. package/dist/lib/TrieNode/compoundWalker.d.ts +0 -29
  79. package/dist/lib/TrieNode/compoundWalker.js +0 -59
  80. package/dist/lib/TrieNode/find.d.ts +0 -71
  81. package/dist/lib/TrieNode/find.js +0 -287
  82. package/dist/lib/TrieNode/trie-util.d.ts +0 -54
  83. package/dist/lib/TrieNode/trie-util.js +0 -194
  84. package/dist/lib/TrieNode/trie.d.ts +0 -5
  85. package/dist/lib/TrieNode/trie.js +0 -125
  86. package/dist/lib/buildITrie.d.ts +0 -4
  87. package/dist/lib/buildITrie.js +0 -9
  88. package/dist/lib/consolidate.d.ts +0 -7
  89. package/dist/lib/consolidate.js +0 -94
  90. package/dist/lib/constants.d.ts +0 -9
  91. package/dist/lib/constants.js +0 -16
  92. package/dist/lib/convertToTrieRefNodes.d.ts +0 -8
  93. package/dist/lib/convertToTrieRefNodes.js +0 -85
  94. package/dist/lib/decodeTrie.d.ts +0 -3
  95. package/dist/lib/decodeTrie.js +0 -7
  96. package/dist/lib/distance/distance.d.ts +0 -34
  97. package/dist/lib/distance/distance.js +0 -43
  98. package/dist/lib/distance/distanceAStar.d.ts +0 -7
  99. package/dist/lib/distance/distanceAStar.js +0 -54
  100. package/dist/lib/distance/distanceAStarWeighted.d.ts +0 -21
  101. package/dist/lib/distance/distanceAStarWeighted.js +0 -141
  102. package/dist/lib/distance/formatResultEx.d.ts +0 -5
  103. package/dist/lib/distance/formatResultEx.js +0 -56
  104. package/dist/lib/distance/index.d.ts +0 -3
  105. package/dist/lib/distance/index.js +0 -2
  106. package/dist/lib/distance/levenshtein.d.ts +0 -14
  107. package/dist/lib/distance/levenshtein.js +0 -131
  108. package/dist/lib/distance/weightedMaps.d.ts +0 -110
  109. package/dist/lib/distance/weightedMaps.js +0 -296
  110. package/dist/lib/flatten.d.ts +0 -9
  111. package/dist/lib/flatten.js +0 -111
  112. package/dist/lib/index.d.ts +0 -30
  113. package/dist/lib/index.js +0 -22
  114. package/dist/lib/io/constants.d.ts +0 -17
  115. package/dist/lib/io/constants.js +0 -17
  116. package/dist/lib/io/decode.d.ts +0 -3
  117. package/dist/lib/io/decode.js +0 -51
  118. package/dist/lib/io/importExport.d.ts +0 -16
  119. package/dist/lib/io/importExport.js +0 -65
  120. package/dist/lib/io/importExportV1.d.ts +0 -16
  121. package/dist/lib/io/importExportV1.js +0 -125
  122. package/dist/lib/io/importExportV2.d.ts +0 -16
  123. package/dist/lib/io/importExportV2.js +0 -174
  124. package/dist/lib/io/importExportV3.d.ts +0 -22
  125. package/dist/lib/io/importExportV3.js +0 -150
  126. package/dist/lib/io/importExportV4.d.ts +0 -51
  127. package/dist/lib/io/importExportV4.js +0 -446
  128. package/dist/lib/io/importV3.d.ts +0 -6
  129. package/dist/lib/io/importV3.js +0 -158
  130. package/dist/lib/io/importV3FastBlob.d.ts +0 -3
  131. package/dist/lib/io/importV3FastBlob.js +0 -6
  132. package/dist/lib/io/index.d.ts +0 -2
  133. package/dist/lib/io/index.js +0 -2
  134. package/dist/lib/mappers/joinLetters.d.ts +0 -8
  135. package/dist/lib/mappers/joinLetters.js +0 -11
  136. package/dist/lib/mappers/mapCosts.d.ts +0 -6
  137. package/dist/lib/mappers/mapCosts.js +0 -23
  138. package/dist/lib/mappers/mapDictionaryInfo.d.ts +0 -6
  139. package/dist/lib/mappers/mapDictionaryInfo.js +0 -64
  140. package/dist/lib/mappers/mapDictionaryInfoToWeightMap.d.ts +0 -5
  141. package/dist/lib/mappers/mapDictionaryInfoToWeightMap.js +0 -35
  142. package/dist/lib/mappers/mapHunspellInformation.d.ts +0 -35
  143. package/dist/lib/mappers/mapHunspellInformation.js +0 -196
  144. package/dist/lib/mappers/mapToSuggestionCostDef.d.ts +0 -17
  145. package/dist/lib/mappers/mapToSuggestionCostDef.js +0 -113
  146. package/dist/lib/models/DictionaryInformation.d.ts +0 -8
  147. package/dist/lib/models/DictionaryInformation.js +0 -2
  148. package/dist/lib/models/locale/index.d.ts +0 -2
  149. package/dist/lib/models/locale/index.js +0 -2
  150. package/dist/lib/models/locale/knownLocales.d.ts +0 -3
  151. package/dist/lib/models/locale/knownLocales.js +0 -534
  152. package/dist/lib/models/locale/locale.d.ts +0 -24
  153. package/dist/lib/models/locale/locale.js +0 -63
  154. package/dist/lib/models/suggestionCostsDef.d.ts +0 -2
  155. package/dist/lib/models/suggestionCostsDef.js +0 -2
  156. package/dist/lib/suggest.d.ts +0 -5
  157. package/dist/lib/suggest.js +0 -5
  158. package/dist/lib/suggestCollector.d.ts +0 -7
  159. package/dist/lib/suggestCollector.js +0 -2
  160. package/dist/lib/suggestions/SuggestionTypes.d.ts +0 -39
  161. package/dist/lib/suggestions/SuggestionTypes.js +0 -2
  162. package/dist/lib/suggestions/collectSuggestions.d.ts +0 -3
  163. package/dist/lib/suggestions/collectSuggestions.js +0 -32
  164. package/dist/lib/suggestions/constants.d.ts +0 -12
  165. package/dist/lib/suggestions/constants.js +0 -12
  166. package/dist/lib/suggestions/genSuggestionsOptions.d.ts +0 -58
  167. package/dist/lib/suggestions/genSuggestionsOptions.js +0 -45
  168. package/dist/lib/suggestions/orthography.d.ts +0 -13
  169. package/dist/lib/suggestions/orthography.js +0 -66
  170. package/dist/lib/suggestions/suggest.d.ts +0 -7
  171. package/dist/lib/suggestions/suggest.js +0 -197
  172. package/dist/lib/suggestions/suggestAStar.d.ts +0 -49
  173. package/dist/lib/suggestions/suggestAStar.js +0 -338
  174. package/dist/lib/suggestions/suggestCollector.d.ts +0 -81
  175. package/dist/lib/suggestions/suggestCollector.js +0 -209
  176. package/dist/lib/suggestions/suggestTrieData.d.ts +0 -2
  177. package/dist/lib/suggestions/suggestTrieData.js +0 -2
  178. package/dist/lib/trie.d.ts +0 -86
  179. package/dist/lib/trie.js +0 -193
  180. package/dist/lib/trieRef.d.ts +0 -6
  181. package/dist/lib/trieRef.js +0 -2
  182. package/dist/lib/types.d.ts +0 -70
  183. package/dist/lib/types.js +0 -14
  184. package/dist/lib/utils/PairingHeap.d.ts +0 -50
  185. package/dist/lib/utils/PairingHeap.js +0 -98
  186. package/dist/lib/utils/assert.d.ts +0 -2
  187. package/dist/lib/utils/assert.js +0 -6
  188. package/dist/lib/utils/autoCacheMap.d.ts +0 -11
  189. package/dist/lib/utils/autoCacheMap.js +0 -31
  190. package/dist/lib/utils/bufferLines.d.ts +0 -3
  191. package/dist/lib/utils/bufferLines.js +0 -27
  192. package/dist/lib/utils/clean.d.ts +0 -3
  193. package/dist/lib/utils/clean.js +0 -10
  194. package/dist/lib/utils/isDefined.d.ts +0 -2
  195. package/dist/lib/utils/isDefined.js +0 -4
  196. package/dist/lib/utils/isValidChar.d.ts +0 -4
  197. package/dist/lib/utils/isValidChar.js +0 -19
  198. package/dist/lib/utils/memorizeLastCall.d.ts +0 -2
  199. package/dist/lib/utils/memorizeLastCall.js +0 -14
  200. package/dist/lib/utils/memorizer.d.ts +0 -2
  201. package/dist/lib/utils/memorizer.js +0 -38
  202. package/dist/lib/utils/mergeDefaults.d.ts +0 -10
  203. package/dist/lib/utils/mergeDefaults.js +0 -20
  204. package/dist/lib/utils/mergeOptionalWithDefaults.d.ts +0 -5
  205. package/dist/lib/utils/mergeOptionalWithDefaults.js +0 -6
  206. package/dist/lib/utils/normalizeWord.d.ts +0 -20
  207. package/dist/lib/utils/normalizeWord.js +0 -23
  208. package/dist/lib/utils/secondChanceCache.d.ts +0 -16
  209. package/dist/lib/utils/secondChanceCache.js +0 -55
  210. package/dist/lib/utils/text.d.ts +0 -55
  211. package/dist/lib/utils/text.js +0 -134
  212. package/dist/lib/utils/timer.d.ts +0 -31
  213. package/dist/lib/utils/timer.js +0 -117
  214. package/dist/lib/utils/util.d.ts +0 -38
  215. package/dist/lib/utils/util.js +0 -72
  216. package/dist/lib/walker/hintedWalker.d.ts +0 -23
  217. package/dist/lib/walker/hintedWalker.js +0 -103
  218. package/dist/lib/walker/index.d.ts +0 -5
  219. package/dist/lib/walker/index.js +0 -4
  220. package/dist/lib/walker/walker.d.ts +0 -13
  221. package/dist/lib/walker/walker.js +0 -174
  222. package/dist/lib/walker/walkerTypes.d.ts +0 -24
  223. package/dist/lib/walker/walkerTypes.js +0 -18
package/dist/index.d.ts CHANGED
@@ -1,2 +1,808 @@
1
- export * from './lib/index.js';
2
- //# sourceMappingURL=index.d.ts.map
1
+ import { SuggestionCostMapDef, DictionaryDefinitionAugmented } from '@cspell/cspell-types';
2
+ export { SuggestionCostMapDef } from '@cspell/cspell-types';
3
+ import { Operator } from '@cspell/cspell-pipe/sync';
4
+
5
+ /**
6
+ * Costs are minimized while penalties are maximized.
7
+ */
8
+ interface Cost$1 {
9
+ /**
10
+ * The cost of an operation
11
+ * `c'' = min(c, c')`
12
+ */
13
+ c?: number | undefined;
14
+ /**
15
+ * The penalties applied
16
+ * `p'' = max(p, p')`
17
+ */
18
+ p?: number | undefined;
19
+ }
20
+ interface TrieCost extends Cost$1 {
21
+ /** nested trie nodes */
22
+ n?: Record<string, TrieCost>;
23
+ }
24
+ interface TrieTrieCost {
25
+ /** nested trie nodes */
26
+ n?: Record<string, TrieTrieCost>;
27
+ /** root of cost trie */
28
+ t?: Record<string, TrieCost>;
29
+ }
30
+ interface WeightMap {
31
+ readonly insDel: TrieCost;
32
+ readonly replace: TrieTrieCost;
33
+ readonly swap: TrieTrieCost;
34
+ readonly adjustments: Map<string, PenaltyAdjustment>;
35
+ }
36
+ interface PenaltyAdjustment {
37
+ /** Penalty Identifier */
38
+ id: string;
39
+ /** RegExp Pattern to match */
40
+ regexp: RegExp;
41
+ /** Penalty to apply */
42
+ penalty: number;
43
+ }
44
+
45
+ /**
46
+ * Calculate the edit distance between any two words.
47
+ * Use the Damerau–Levenshtein distance algorithm.
48
+ * @param wordA
49
+ * @param wordB
50
+ * @param editCost - the cost of each edit (defaults to 100)
51
+ * @returns the edit distance.
52
+ */
53
+ declare function editDistance(wordA: string, wordB: string, editCost?: number): number;
54
+ /**
55
+ * Calculate the weighted edit distance between any two words.
56
+ * @param wordA
57
+ * @param wordB
58
+ * @param weights - the weights to use
59
+ * @param editCost - the cost of each edit (defaults to 100)
60
+ * @returns the edit distance
61
+ */
62
+ declare function editDistanceWeighted(wordA: string, wordB: string, weights: WeightMap, editCost?: number): number;
63
+ /**
64
+ * Collect Map definitions into a single weighted map.
65
+ * @param defs - list of definitions
66
+ * @returns A Weighted Map to be used with distance calculations.
67
+ */
68
+ declare function createWeightedMap(defs: SuggestionCostMapDef[]): WeightMap;
69
+
70
+ /**
71
+ * Make all properties in T optional and Possibly undefined
72
+ */
73
+ type PartialWithUndefined<T> = {
74
+ [P in keyof T]?: T[P] | undefined;
75
+ };
76
+
77
+ interface TrieInfo {
78
+ compoundCharacter: string;
79
+ stripCaseAndAccentsPrefix: string;
80
+ forbiddenWordPrefix: string;
81
+ isCaseAware: boolean;
82
+ }
83
+ interface TrieCharacteristics {
84
+ hasForbiddenWords: boolean;
85
+ hasCompoundWords: boolean;
86
+ hasNonStrictWords: boolean;
87
+ }
88
+ type PartialTrieInfo = PartialWithUndefined<TrieInfo> | undefined;
89
+
90
+ interface FindResult$1 {
91
+ found: string | false;
92
+ compoundUsed: boolean;
93
+ caseMatched: boolean;
94
+ /**
95
+ * Is the word explicitly forbidden.
96
+ * - `true` - word is in the forbidden list.
97
+ * - `false` - word is not in the forbidden list.
98
+ * - `undefined` - unknown - was not checked.
99
+ */
100
+ forbidden?: boolean | undefined;
101
+ }
102
+ interface FindFullResult$1 extends FindResult$1 {
103
+ /**
104
+ * Is the word explicitly forbidden.
105
+ * - `true` - word is in the forbidden list.
106
+ * - `false` - word is not in the forbidden list.
107
+ * - `undefined` - unknown - was not checked.
108
+ */
109
+ forbidden: boolean | undefined;
110
+ }
111
+ type ITrieNodeId = object | number | string;
112
+ type Entry = readonly [string, ITrieNode];
113
+ interface ITrieNode {
114
+ /**
115
+ * ITrieNode instances are not unique. It is possible for multiple ITrieNode instances to
116
+ * represent the same node.
117
+ * `id` is used to see if two instances refer to the same node.
118
+ * The type is obscured because it is up the the backing structure to provide the best value.
119
+ * Note, only nodes from the same root are guaranteed to be unique. It is possible for two
120
+ * different ITrieNode instances to have the same `id` value if they come from different roots.
121
+ */
122
+ readonly id: ITrieNodeId;
123
+ /** flag End of Word */
124
+ readonly eow: boolean;
125
+ /** get keys to children */
126
+ keys(): Iterable<string>;
127
+ /** get keys to children */
128
+ values(): Iterable<ITrieNode>;
129
+ /** get the children as key value pairs */
130
+ entries(): Iterable<Entry>;
131
+ /** get child ITrieNode */
132
+ get(char: string): ITrieNode | undefined;
133
+ /** get a nested child ITrieNode */
134
+ getNode?: (chars: string) => ITrieNode | undefined;
135
+ /** has child */
136
+ has(char: string): boolean;
137
+ /** `true` iff this node has children */
138
+ hasChildren(): boolean;
139
+ /** check if a word exists within this node. */
140
+ findExact?: ((word: string) => boolean) | undefined;
141
+ }
142
+ interface ITrieNodeRoot extends ITrieNode {
143
+ readonly info: Readonly<TrieInfo>;
144
+ /**
145
+ * converts an `id` into a node.
146
+ * @param id an of a ITrieNode in this Trie
147
+ */
148
+ resolveId(id: ITrieNodeId): ITrieNode;
149
+ findExact: ((word: string) => boolean) | undefined;
150
+ /**
151
+ * Try to find a word.
152
+ * @param word - the normalized word to look up.
153
+ * @param strict - if `true` the case and accents must match.
154
+ * @returns undefined if it did not try to find the word, otherwise a FindResult.
155
+ */
156
+ find?: ((word: string, strict: boolean) => FindResult$1 | undefined) | undefined;
157
+ isForbidden?: ((word: string) => boolean) | undefined;
158
+ readonly forbidPrefix: string;
159
+ readonly compoundFix: string;
160
+ readonly caseInsensitivePrefix: string;
161
+ readonly hasForbiddenWords: boolean;
162
+ readonly hasCompoundWords: boolean;
163
+ readonly hasNonStrictWords: boolean;
164
+ }
165
+
166
+ declare const FLAG_WORD = 1;
167
+ type ChildMap = Record<string, TrieNode>;
168
+ interface TrieNode {
169
+ f?: number | undefined;
170
+ c?: ChildMap | undefined;
171
+ }
172
+ interface TrieRoot extends TrieInfo {
173
+ c: ChildMap;
174
+ }
175
+
176
+ declare const JOIN_SEPARATOR = "+";
177
+ declare const WORD_SEPARATOR = " ";
178
+ interface YieldResult$1 {
179
+ text: string;
180
+ node: TrieNode;
181
+ depth: number;
182
+ }
183
+ declare enum CompoundWordsMethod {
184
+ /**
185
+ * Do not compound words.
186
+ */
187
+ NONE = 0,
188
+ /**
189
+ * Create word compounds separated by spaces.
190
+ */
191
+ SEPARATE_WORDS = 1,
192
+ /**
193
+ * Create word compounds without separation.
194
+ */
195
+ JOIN_WORDS = 2
196
+ }
197
+ type WalkerIterator$1 = Generator<YieldResult$1, void, boolean | undefined>;
198
+
199
+ interface YieldResult {
200
+ text: string;
201
+ node: ITrieNode;
202
+ depth: number;
203
+ }
204
+ type FalseToNotGoDeeper = boolean;
205
+ /**
206
+ * By default a Walker Iterator will go depth first. To prevent the
207
+ * walker from going deeper use `iterator.next(false)`.
208
+ */
209
+ type WalkerIterator = Generator<YieldResult, void, FalseToNotGoDeeper | undefined>;
210
+
211
+ /**
212
+ * Ask for the next result.
213
+ * goDeeper of true tells the walker to go deeper in the Trie if possible. Default is true.
214
+ * This can be used to limit the walker's depth.
215
+ */
216
+ type HintedWalkerIterator = Generator<YieldResult$1, void, Hinting | undefined>;
217
+ declare function hintedWalker(root: TrieRoot, ignoreCase: boolean, hint: string, compoundingMethod: CompoundWordsMethod | undefined, emitWordSeparator?: string): HintedWalkerIterator;
218
+ interface Hinting {
219
+ goDeeper: boolean;
220
+ }
221
+
222
+ declare function walker(root: TrieNode, compoundingMethod?: CompoundWordsMethod): WalkerIterator$1;
223
+
224
+ interface GenSuggestionOptionsStrict {
225
+ /**
226
+ * Controls forcing compound words.
227
+ * @default CompoundWordsMethod.NONE
228
+ */
229
+ compoundMethod?: CompoundWordsMethod;
230
+ /**
231
+ * ignore case when searching.
232
+ */
233
+ ignoreCase: boolean;
234
+ /**
235
+ * Maximum number of "edits" allowed.
236
+ * 3 is a good number. Above 5 can be very slow.
237
+ */
238
+ changeLimit: number;
239
+ /**
240
+ * Inserts a compound character between compounded word segments.
241
+ * @default ""
242
+ */
243
+ compoundSeparator?: string;
244
+ }
245
+ type GenSuggestionOptions = Partial<GenSuggestionOptionsStrict>;
246
+ interface SuggestionOptionsStrict extends GenSuggestionOptionsStrict {
247
+ /**
248
+ * Maximum number of suggestions to make.
249
+ */
250
+ numSuggestions: number;
251
+ /**
252
+ * Allow ties when making suggestions.
253
+ * if `true` it is possible to have more than `numSuggestions`.
254
+ */
255
+ includeTies: boolean;
256
+ /**
257
+ * Time alloted in milliseconds to generate suggestions.
258
+ */
259
+ timeout: number;
260
+ /**
261
+ * Optional filter function.
262
+ * return true to keep the candidate.
263
+ */
264
+ filter?: (word: string, cost: number) => boolean;
265
+ /**
266
+ * Apply weights to improve the suggestions.
267
+ */
268
+ weightMap?: WeightMap | undefined;
269
+ }
270
+ type SuggestionOptions = Partial<SuggestionOptionsStrict>;
271
+
272
+ type Cost = number;
273
+ type MaxCost = Cost;
274
+ interface SuggestionResultBase {
275
+ /** The suggested word */
276
+ word: string;
277
+ /** The edit cost 100 = 1 edit */
278
+ cost: Cost;
279
+ /**
280
+ * This suggestion is the preferred suggestion.
281
+ * Setting this to `true` implies that an auto fix is possible.
282
+ */
283
+ isPreferred?: boolean | undefined;
284
+ }
285
+ interface SuggestionResult extends SuggestionResultBase {
286
+ /** The suggested word with compound marks, generally a `•` */
287
+ compoundWord?: string | undefined;
288
+ }
289
+ interface Progress {
290
+ type: 'progress';
291
+ /** Number of Completed Tasks so far */
292
+ completed: number;
293
+ /**
294
+ * Number of tasks remaining, this number is allowed to increase over time since
295
+ * completed tasks can generate new tasks.
296
+ */
297
+ remaining: number;
298
+ }
299
+ type GenerateNextParam = MaxCost | symbol | undefined;
300
+ type GenerateSuggestionResult = SuggestionResultBase | Progress | undefined;
301
+ /**
302
+ * Ask for the next result.
303
+ * maxCost - sets the max cost for following suggestions
304
+ * This is used to limit which suggestions are emitted.
305
+ * If the `iterator.next()` returns `undefined`, it is to request a value for maxCost.
306
+ *
307
+ * The SuggestionIterator is generally the
308
+ */
309
+ type SuggestionGenerator = Generator<GenerateSuggestionResult, void, GenerateNextParam>;
310
+
311
+ type FilterWordFn = (word: string, cost: number) => boolean;
312
+ interface SuggestionCollector {
313
+ /**
314
+ * Collection suggestions from a SuggestionIterator
315
+ * @param src - the SuggestionIterator used to generate suggestions.
316
+ * @param timeout - the amount of time in milliseconds to allow for suggestions.
317
+ * before sending `symbolStopProcessing`
318
+ * Iterator implementation:
319
+ * @example
320
+ * r = yield(suggestion);
321
+ * if (r === collector.symbolStopProcessing) // ...stop generating suggestions.
322
+ */
323
+ collect: (src: SuggestionGenerator, timeout?: number, filter?: FilterWordFn) => void;
324
+ add: (suggestion: SuggestionResultBase) => SuggestionCollector;
325
+ readonly suggestions: SuggestionResult[];
326
+ readonly changeLimit: number;
327
+ readonly maxCost: number;
328
+ readonly word: string;
329
+ readonly maxNumSuggestions: number;
330
+ readonly includesTies: boolean;
331
+ readonly ignoreCase: boolean;
332
+ readonly genSuggestionOptions: GenSuggestionOptions;
333
+ /**
334
+ * Possible value sent to the SuggestionIterator telling it to stop processing.
335
+ */
336
+ readonly symbolStopProcessing: symbol;
337
+ }
338
+ interface SuggestionCollectorOptions extends Omit<GenSuggestionOptionsStrict, 'ignoreCase' | 'changeLimit'> {
339
+ /**
340
+ * number of best matching suggestions.
341
+ * @default 10
342
+ */
343
+ numSuggestions: number;
344
+ /**
345
+ * An optional filter function that can be used to limit remove unwanted suggestions.
346
+ * I.E. to remove forbidden terms.
347
+ * @default () => true
348
+ */
349
+ filter?: FilterWordFn | undefined;
350
+ /**
351
+ * The number of letters that can be changed when looking for a match
352
+ * @default 5
353
+ */
354
+ changeLimit: number | undefined;
355
+ /**
356
+ * Include suggestions with tied cost even if the number is greater than `numSuggestions`.
357
+ * @default true
358
+ */
359
+ includeTies?: boolean | undefined;
360
+ /**
361
+ * specify if case / accents should be ignored when looking for suggestions.
362
+ * @default true
363
+ */
364
+ ignoreCase: boolean | undefined;
365
+ /**
366
+ * the total amount of time to allow for suggestions.
367
+ * @default 1000
368
+ */
369
+ timeout?: number | undefined;
370
+ /**
371
+ * Used to improve the sorted results.
372
+ */
373
+ weightMap?: WeightMap | undefined;
374
+ }
375
+ declare function suggestionCollector(wordToMatch: string, options: SuggestionCollectorOptions): SuggestionCollector;
376
+ /**
377
+ * Impersonating a Collector, allows searching for multiple variants on the same word.
378
+ * The collection is still in the original collector.
379
+ * @param collector - collector to impersonate
380
+ * @param word - word to present instead of `collector.word`.
381
+ * @returns a SuggestionCollector
382
+ */
383
+ declare function impersonateCollector(collector: SuggestionCollector, word: string): SuggestionCollector;
384
+
385
+ interface TrieData extends Readonly<TrieCharacteristics> {
386
+ readonly info: Readonly<TrieInfo>;
387
+ /** Method used to split words into individual characters. */
388
+ wordToCharacters(word: string): readonly string[];
389
+ /** get an iterable for all the words in the dictionary. */
390
+ words(): Iterable<string>;
391
+ getRoot(): ITrieNodeRoot;
392
+ getNode(prefix: string): ITrieNode | undefined;
393
+ has(word: string): boolean;
394
+ isForbiddenWord(word: string): boolean;
395
+ readonly hasForbiddenWords: boolean;
396
+ readonly hasCompoundWords: boolean;
397
+ readonly hasNonStrictWords: boolean;
398
+ readonly size: number;
399
+ }
400
+
401
+ interface ITrie {
402
+ readonly data: TrieData;
403
+ /**
404
+ * Approximate number of words in the Trie, the first call to this method might be expensive.
405
+ * Use `size` to get the number of nodes.
406
+ *
407
+ * It does NOT count natural compound words. Natural compounds are words that are composed of appending
408
+ * multiple words to make a new word. This is common in languages like German and Dutch.
409
+ */
410
+ numWords(): number;
411
+ /**
412
+ * Used to check if the number of words has been calculated.
413
+ */
414
+ isNumWordsKnown(): boolean;
415
+ /**
416
+ * The number of nodes in the Trie. There is a rough corelation between the size and the number of words.
417
+ */
418
+ readonly size: number;
419
+ readonly info: Readonly<TrieInfo>;
420
+ /**
421
+ * @param text - text to find in the Trie
422
+ */
423
+ find(text: string): ITrieNode | undefined;
424
+ has(word: string): boolean;
425
+ has(word: string, minLegacyCompoundLength: boolean | number): boolean;
426
+ /**
427
+ * Determine if a word is in the dictionary.
428
+ * @param word - the exact word to search for - must be normalized.
429
+ * @param caseSensitive - false means also searching a dictionary where the words were normalized to lower case and accents removed.
430
+ * @returns true if the word was found and is not forbidden.
431
+ */
432
+ hasWord(word: string, caseSensitive: boolean): boolean;
433
+ findWord(word: string, options?: FindWordOptions$1): FindFullResult$1;
434
+ /**
435
+ * Determine if a word is in the forbidden word list.
436
+ * @param word the word to lookup.
437
+ */
438
+ isForbiddenWord(word: string): boolean;
439
+ /**
440
+ * Provides an ordered sequence of words with the prefix of text.
441
+ */
442
+ completeWord(text: string): Iterable<string>;
443
+ /**
444
+ * Suggest spellings for `text`. The results are sorted by edit distance with changes near the beginning of a word having a greater impact.
445
+ * @param text - the text to search for
446
+ * @param options - Controls the generated suggestions:
447
+ * - ignoreCase - Ignore Case and Accents
448
+ * - numSuggestions - the maximum number of suggestions to return.
449
+ * - compoundMethod - Use to control splitting words.
450
+ * - changeLimit - the maximum number of changes allowed to text. This is an approximate value, since some changes cost less than others.
451
+ * the lower the value, the faster results are returned. Values less than 4 are best.
452
+ */
453
+ suggest(text: string, options: SuggestionOptions): string[];
454
+ /**
455
+ * Suggest spellings for `text`. The results are sorted by edit distance with changes near the beginning of a word having a greater impact.
456
+ * The results include the word and adjusted edit cost. This is useful for merging results from multiple tries.
457
+ */
458
+ suggestWithCost(text: string, options: SuggestionOptions): SuggestionResult[];
459
+ /**
460
+ * genSuggestions will generate suggestions and send them to `collector`. `collector` is responsible for returning the max acceptable cost.
461
+ * Costs are measured in weighted changes. A cost of 100 is the same as 1 edit. Some edits are considered cheaper.
462
+ * Returning a MaxCost < 0 will effectively cause the search for suggestions to stop.
463
+ */
464
+ genSuggestions(collector: SuggestionCollector, compoundMethod?: CompoundWordsMethod): void;
465
+ /**
466
+ * Returns an iterator that can be used to get all words in the trie. For some dictionaries, this can result in millions of words.
467
+ */
468
+ words(): Iterable<string>;
469
+ /**
470
+ * Allows iteration over the entire tree.
471
+ * On the returned Iterator, calling .next(goDeeper: boolean), allows for controlling the depth.
472
+ */
473
+ iterate(): WalkerIterator;
474
+ readonly weightMap: WeightMap | undefined;
475
+ readonly isCaseAware: boolean;
476
+ readonly hasForbiddenWords: boolean;
477
+ readonly hasCompoundWords: boolean;
478
+ readonly hasNonStrictWords: boolean;
479
+ }
480
+ interface FindWordOptions$1 {
481
+ caseSensitive?: boolean;
482
+ useLegacyWordCompounds?: boolean | number;
483
+ checkForbidden?: boolean;
484
+ }
485
+
486
+ declare function buildITrieFromWords(words: Iterable<string>, info?: PartialTrieInfo): ITrie;
487
+
488
+ /**
489
+ * Consolidate to DAWG
490
+ * @param root the root of the Trie tree
491
+ */
492
+ declare function consolidate(root: TrieRoot): TrieRoot;
493
+
494
+ declare const COMPOUND_FIX = "+";
495
+ declare const OPTIONAL_COMPOUND_FIX = "*";
496
+ declare const CASE_INSENSITIVE_PREFIX = "~";
497
+ declare const FORBID_PREFIX = "!";
498
+ declare const defaultTrieInfo: TrieInfo;
499
+
500
+ declare function decodeTrie(raw: string | Buffer): ITrie;
501
+
502
+ interface ExportOptions {
503
+ base?: number;
504
+ comment?: string;
505
+ version?: number;
506
+ addLineBreaksToImproveDiffs?: boolean;
507
+ }
508
+ /**
509
+ * Serialize a TrieNode.
510
+ * Note: This is destructive. The node will no longer be usable.
511
+ * Even though it is possible to preserve the trie, dealing with very large tries can consume a lot of memory.
512
+ * Considering this is the last step before exporting, it was decided to let this be destructive.
513
+ */
514
+ declare function serializeTrie(root: TrieRoot, options?: ExportOptions | number): Iterable<string>;
515
+ declare function importTrie(input: Iterable<string> | IterableIterator<string> | string[] | string): TrieRoot;
516
+
517
+ type DictionaryInformation = Exclude<DictionaryDefinitionAugmented['dictionaryInformation'], undefined>;
518
+
519
+ declare function mapDictionaryInformationToWeightMap(dictInfo: DictionaryInformation): WeightMap;
520
+
521
+ interface FindResult {
522
+ found: string | false;
523
+ compoundUsed: boolean;
524
+ caseMatched: boolean;
525
+ }
526
+ interface FindFullResult extends FindResult {
527
+ /**
528
+ * Is the word explicitly forbidden.
529
+ * - `true` - word is in the forbidden list.
530
+ * - `false` - word is not in the forbidden list.
531
+ * - `undefined` - unknown - was not checked.
532
+ * */
533
+ forbidden: boolean | undefined;
534
+ }
535
+
536
+ declare class Trie {
537
+ readonly root: TrieRoot;
538
+ private count?;
539
+ private _options;
540
+ private _findOptionsDefaults;
541
+ private _findOptionsExact;
542
+ readonly isLegacy: boolean;
543
+ private hasForbidden;
544
+ constructor(root: TrieRoot, count?: number | undefined);
545
+ /**
546
+ * Number of words in the Trie
547
+ */
548
+ size(): number;
549
+ isSizeKnown(): boolean;
550
+ get options(): Readonly<TrieInfo>;
551
+ /**
552
+ * @param text - text to find in the Trie
553
+ * @param minCompoundLength - deprecated - allows words to be glued together
554
+ */
555
+ find(text: string, minCompoundLength?: boolean | number): TrieNode | undefined;
556
+ has(word: string, minLegacyCompoundLength?: boolean | number): boolean;
557
+ /**
558
+ * Determine if a word is in the dictionary.
559
+ * @param word - the exact word to search for - must be normalized.
560
+ * @param caseSensitive - false means also searching a dictionary where the words were normalized to lower case and accents removed.
561
+ * @returns true if the word was found and is not forbidden.
562
+ */
563
+ hasWord(word: string, caseSensitive: boolean): boolean;
564
+ findWord(word: string, options?: FindWordOptions): FindFullResult;
565
+ /**
566
+ * Determine if a word is in the forbidden word list.
567
+ * @param word the word to lookup.
568
+ */
569
+ isForbiddenWord(word: string): boolean;
570
+ /**
571
+ * Provides an ordered sequence of words with the prefix of text.
572
+ */
573
+ completeWord(text: string): Iterable<string>;
574
+ /**
575
+ * Suggest spellings for `text`. The results are sorted by edit distance with changes near the beginning of a word having a greater impact.
576
+ * @param text - the text to search for
577
+ * @param maxNumSuggestions - the maximum number of suggestions to return.
578
+ * @param compoundMethod - Use to control splitting words.
579
+ * @param numChanges - the maximum number of changes allowed to text. This is an approximate value, since some changes cost less than others.
580
+ * the lower the value, the faster results are returned. Values less than 4 are best.
581
+ */
582
+ suggest(text: string, options: SuggestionOptions): string[];
583
+ /**
584
+ * Suggest spellings for `text`. The results are sorted by edit distance with changes near the beginning of a word having a greater impact.
585
+ * The results include the word and adjusted edit cost. This is useful for merging results from multiple tries.
586
+ */
587
+ suggestWithCost(text: string, options: SuggestionOptions): SuggestionResult[];
588
+ /**
589
+ * genSuggestions will generate suggestions and send them to `collector`. `collector` is responsible for returning the max acceptable cost.
590
+ * Costs are measured in weighted changes. A cost of 100 is the same as 1 edit. Some edits are considered cheaper.
591
+ * Returning a MaxCost < 0 will effectively cause the search for suggestions to stop.
592
+ */
593
+ genSuggestions(collector: SuggestionCollector, compoundMethod?: CompoundWordsMethod): void;
594
+ /**
595
+ * Returns an iterator that can be used to get all words in the trie. For some dictionaries, this can result in millions of words.
596
+ */
597
+ words(): Iterable<string>;
598
+ /**
599
+ * Allows iteration over the entire tree.
600
+ * On the returned Iterator, calling .next(goDeeper: boolean), allows for controlling the depth.
601
+ */
602
+ iterate(): WalkerIterator$1;
603
+ insert(word: string): this;
604
+ private calcIsLegacy;
605
+ static create(words: Iterable<string> | IterableIterator<string>, options?: PartialTrieInfo): Trie;
606
+ private createFindOptions;
607
+ private lastCreateFindOptionsMatchCaseMap;
608
+ private createFindOptionsMatchCase;
609
+ }
610
+ interface FindWordOptions {
611
+ caseSensitive?: boolean;
612
+ useLegacyWordCompounds?: boolean | number;
613
+ }
614
+
615
+ interface ParseDictionaryOptions {
616
+ compoundCharacter: string;
617
+ optionalCompoundCharacter: string;
618
+ forbiddenPrefix: string;
619
+ caseInsensitivePrefix: string;
620
+ /**
621
+ * Start of a single-line comment.
622
+ * @default "#"
623
+ */
624
+ commentCharacter: string;
625
+ /**
626
+ * If word starts with prefix, do not strip case or accents.
627
+ * @default false;
628
+ */
629
+ keepExactPrefix: string;
630
+ /**
631
+ * Tell the parser to automatically create case / accent insensitive forms.
632
+ * @default true
633
+ */
634
+ stripCaseAndAccents: boolean;
635
+ /**
636
+ * Tell the parser to keep non-case/accent version in both forms.
637
+ * @default false
638
+ */
639
+ stripCaseAndAccentsKeepDuplicate: boolean;
640
+ /**
641
+ * Tell the parser to keep non-case/accent version in both forms.
642
+ * @default false
643
+ */
644
+ stripCaseAndAccentsOnForbidden: boolean;
645
+ /**
646
+ * Tell the parser to split into words along spaces.
647
+ * @default false
648
+ */
649
+ split: boolean;
650
+ /**
651
+ * When splitting tells the parser to output both the split and non-split versions of the line.
652
+ * @default false
653
+ */
654
+ splitKeepBoth: boolean;
655
+ /**
656
+ * Specify the separator for splitting words.
657
+ */
658
+ splitSeparator: RegExp | string;
659
+ /**
660
+ * Do not normalize the compound character.
661
+ */
662
+ keepOptionalCompoundCharacter: boolean;
663
+ }
664
+ /**
665
+ * Normalizes a dictionary words based upon prefix / suffixes.
666
+ * Case insensitive versions are also generated.
667
+ * @param options - defines prefixes used when parsing lines.
668
+ * @returns words that have been normalized.
669
+ */
670
+ declare function createDictionaryLineParserMapper(options?: Partial<ParseDictionaryOptions>): Operator<string>;
671
+ /**
672
+ * Normalizes a dictionary words based upon prefix / suffixes.
673
+ * Case insensitive versions are also generated.
674
+ * @param lines - one word per line
675
+ * @param _options - defines prefixes used when parsing lines.
676
+ * @returns words that have been normalized.
677
+ */
678
+ declare function parseDictionaryLines(lines: Iterable<string> | string, options?: Partial<ParseDictionaryOptions>): Iterable<string>;
679
+ declare function parseDictionaryLegacy(text: string | string[], options?: Partial<ParseDictionaryOptions>): Trie;
680
+ declare function parseDictionary(text: string | Iterable<string>, options?: Partial<ParseDictionaryOptions>): ITrie;
681
+
682
+ /**
683
+ * Builds an optimized Trie from a Iterable<string>. It attempts to reduce the size of the trie
684
+ * by finding common endings.
685
+ * @param words Iterable set of words -- no processing is done on the words, they are inserted as is.
686
+ * @param trieOptions options for the Trie
687
+ */
688
+ declare function buildTrie(words: Iterable<string>, trieOptions?: PartialTrieInfo): Trie;
689
+ /**
690
+ * Builds a Trie from a Iterable<string>. NO attempt a reducing the size of the Trie is done.
691
+ * @param words Iterable set of words -- no processing is done on the words, they are inserted as is.
692
+ * @param trieOptions options for the Trie
693
+ */
694
+ declare function buildTrieFast(words: Iterable<string>, trieOptions?: PartialTrieInfo): Trie;
695
+ declare class TrieBuilder {
696
+ private count;
697
+ private readonly signatures;
698
+ private readonly cached;
699
+ private readonly transforms;
700
+ private _eow;
701
+ /** position 0 of lastPath is always the root */
702
+ private lastPath;
703
+ private tails;
704
+ trieOptions: TrieInfo;
705
+ private numWords;
706
+ private _debug_lastWordsInserted;
707
+ private _debug_mode;
708
+ constructor(words?: Iterable<string>, trieOptions?: PartialTrieInfo);
709
+ private get _root();
710
+ private signature;
711
+ private _canBeCached;
712
+ private tryCacheFrozen;
713
+ private freeze;
714
+ private tryToCache;
715
+ private storeTransform;
716
+ private addChild;
717
+ private buildTail;
718
+ private _insert;
719
+ insertWord(word: string): void;
720
+ insert(words: Iterable<string>): void;
721
+ /**
722
+ * Resets the builder
723
+ */
724
+ reset(): void;
725
+ build(consolidateSuffixes?: boolean): Trie;
726
+ private debugStack;
727
+ private debNodeInfo;
728
+ private logDebug;
729
+ private runDebug;
730
+ private copyIfFrozen;
731
+ private createNodeFrozen;
732
+ private createNode;
733
+ }
734
+
735
+ declare function insert(word: string, root?: TrieNode): TrieNode;
736
+ declare function isWordTerminationNode(node: TrieNode): boolean;
737
+ /**
738
+ * Sorts the nodes in a trie in place.
739
+ */
740
+ declare function orderTrie(node: TrieNode): void;
741
+ /**
742
+ * Generator an iterator that will walk the Trie parent then children in a depth first fashion that preserves sorted order.
743
+ */
744
+ declare function walk(node: TrieNode): Iterable<YieldResult$1>;
745
+ declare const iterateTrie: typeof walk;
746
+ /**
747
+ * Generate a Iterator that can walk a Trie and yield the words.
748
+ */
749
+ declare function iteratorTrieWords(node: TrieNode): Iterable<string>;
750
+ declare function createTrieRoot(options: PartialTrieInfo): TrieRoot;
751
+ declare function createTrieRootFromList(words: Iterable<string>, options?: PartialTrieInfo): TrieRoot;
752
+ declare function has(node: TrieNode, word: string): boolean;
753
+ declare function findNode(node: TrieNode, word: string): TrieNode | undefined;
754
+ declare function countNodes(root: TrieNode): number;
755
+ declare function countWords(root: TrieNode): number;
756
+ declare function isCircular(root: TrieNode): boolean;
757
+ declare function trieNodeToRoot(node: TrieNode, options: PartialTrieInfo): TrieRoot;
758
+
759
+ declare function isDefined<T>(t: T | undefined): t is T;
760
+
761
+ /**
762
+ * Creates a new object of type T based upon the field values from `value`.
763
+ * n[k] = value[k] ?? default[k] where k must be a field in default.
764
+ * Note: it will remove fields not in defaultValue!
765
+ * @param value
766
+ * @param defaultValue
767
+ */
768
+ declare function mergeDefaults<T extends object>(value: Readonly<PartialWithUndefined<T>> | undefined, defaultValue: T): T;
769
+
770
+ type ROPartialTrieOptions = Readonly<PartialTrieInfo>;
771
+ declare function mergeOptionalWithDefaults(options: ROPartialTrieOptions): TrieInfo;
772
+ declare function mergeOptionalWithDefaults(options: ROPartialTrieOptions, ...moreOptions: ROPartialTrieOptions[]): TrieInfo;
773
+
774
+ /**
775
+ * Normalize word unicode.
776
+ * @param text - text to normalize
777
+ * @returns returns a word normalized to `NFC`
778
+ */
779
+ declare const normalizeWord: (text: string) => string;
780
+ /**
781
+ * converts text to lower case and removes any accents.
782
+ * @param text - text to convert
783
+ * @returns lowercase word without accents
784
+ * @deprecated true
785
+ */
786
+ declare const normalizeWordToLowercase: (text: string) => string;
787
+ /**
788
+ * generate case insensitive forms of a word
789
+ * @param text - text to convert
790
+ * @returns the forms of the word.
791
+ */
792
+ declare const normalizeWordForCaseInsensitive: (text: string) => string[];
793
+
794
+ /**
795
+ * Expand a line into a set of characters.
796
+ *
797
+ * Example:
798
+ * - `a-c` -> `<a,b,c>`
799
+ * - `ac-` -> `<a,c,->`
800
+ * - `-abz` -> `<-,a,b,z>`
801
+ * - `\u0300-\u0308` -> `<accents>`
802
+ *
803
+ * @param line - set of characters
804
+ * @param rangeChar - the character to indicate ranges, set to empty to not have ranges.
805
+ */
806
+ declare function expandCharacterSet(line: string, rangeChar?: string): Set<string>;
807
+
808
+ export { CASE_INSENSITIVE_PREFIX, COMPOUND_FIX, type ChildMap, CompoundWordsMethod, type ExportOptions, FLAG_WORD, FORBID_PREFIX, type FindFullResult, type FindWordOptions, type HintedWalkerIterator, type Hinting, type ITrie, JOIN_SEPARATOR, type MaxCost, OPTIONAL_COMPOUND_FIX, type PartialTrieInfo as PartialTrieOptions, type SuggestionCollector, type SuggestionResult, Trie, TrieBuilder, type TrieNode, type TrieInfo as TrieOptions, type TrieRoot, WORD_SEPARATOR, type WalkerIterator$1 as WalkerIterator, type WeightMap, type YieldResult$1 as YieldResult, buildITrieFromWords, buildTrie, buildTrieFast, consolidate, countNodes, countWords, createDictionaryLineParserMapper as createDictionaryLineParser, createTrieRoot, createTrieRootFromList, createWeightedMap, decodeTrie, defaultTrieInfo, defaultTrieInfo as defaultTrieOptions, editDistance, editDistanceWeighted, expandCharacterSet, findNode, has, hintedWalker, impersonateCollector, importTrie, insert, isCircular, isDefined, isWordTerminationNode, iterateTrie, iteratorTrieWords, mapDictionaryInformationToWeightMap, mergeDefaults, mergeOptionalWithDefaults, normalizeWord, normalizeWordForCaseInsensitive, normalizeWordToLowercase, orderTrie, parseDictionary, parseDictionaryLegacy, parseDictionaryLines, serializeTrie, suggestionCollector, trieNodeToRoot, walk, walker };