cmpstr 2.0.2 → 3.0.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.
Files changed (172) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +75 -499
  3. package/dist/CmpStr.esm.js +4863 -0
  4. package/dist/CmpStr.esm.js.map +1 -0
  5. package/dist/CmpStr.esm.min.js +8 -0
  6. package/dist/CmpStr.esm.min.js.map +1 -0
  7. package/dist/CmpStr.umd.js +4875 -0
  8. package/dist/CmpStr.umd.js.map +1 -0
  9. package/dist/CmpStr.umd.min.js +8 -0
  10. package/dist/CmpStr.umd.min.js.map +1 -0
  11. package/dist/cjs/CmpStr.js +663 -0
  12. package/dist/cjs/CmpStr.js.map +1 -0
  13. package/dist/cjs/CmpStrAsync.js +336 -0
  14. package/dist/cjs/CmpStrAsync.js.map +1 -0
  15. package/dist/cjs/index.js +15 -0
  16. package/dist/cjs/index.js.map +1 -0
  17. package/dist/cjs/metric/Cosine.js +101 -0
  18. package/dist/cjs/metric/Cosine.js.map +1 -0
  19. package/dist/cjs/metric/DamerauLevenshtein.js +110 -0
  20. package/dist/cjs/metric/DamerauLevenshtein.js.map +1 -0
  21. package/dist/cjs/metric/DiceSorensen.js +91 -0
  22. package/dist/cjs/metric/DiceSorensen.js.map +1 -0
  23. package/dist/cjs/metric/Hamming.js +82 -0
  24. package/dist/cjs/metric/Hamming.js.map +1 -0
  25. package/dist/cjs/metric/Jaccard.js +76 -0
  26. package/dist/cjs/metric/Jaccard.js.map +1 -0
  27. package/dist/cjs/metric/JaroWinkler.js +114 -0
  28. package/dist/cjs/metric/JaroWinkler.js.map +1 -0
  29. package/dist/cjs/metric/LCS.js +89 -0
  30. package/dist/cjs/metric/LCS.js.map +1 -0
  31. package/dist/cjs/metric/Levenshtein.js +94 -0
  32. package/dist/cjs/metric/Levenshtein.js.map +1 -0
  33. package/dist/cjs/metric/Metric.js +445 -0
  34. package/dist/cjs/metric/Metric.js.map +1 -0
  35. package/dist/cjs/metric/NeedlemanWunsch.js +95 -0
  36. package/dist/cjs/metric/NeedlemanWunsch.js.map +1 -0
  37. package/dist/cjs/metric/SmithWaterman.js +98 -0
  38. package/dist/cjs/metric/SmithWaterman.js.map +1 -0
  39. package/dist/cjs/metric/qGram.js +91 -0
  40. package/dist/cjs/metric/qGram.js.map +1 -0
  41. package/dist/cjs/phonetic/Cologne.js +112 -0
  42. package/dist/cjs/phonetic/Cologne.js.map +1 -0
  43. package/dist/cjs/phonetic/Metaphone.js +172 -0
  44. package/dist/cjs/phonetic/Metaphone.js.map +1 -0
  45. package/dist/cjs/phonetic/Phonetic.js +413 -0
  46. package/dist/cjs/phonetic/Phonetic.js.map +1 -0
  47. package/dist/cjs/phonetic/Soundex.js +135 -0
  48. package/dist/cjs/phonetic/Soundex.js.map +1 -0
  49. package/dist/cjs/utils/DeepMerge.js +144 -0
  50. package/dist/cjs/utils/DeepMerge.js.map +1 -0
  51. package/dist/cjs/utils/DiffChecker.js +500 -0
  52. package/dist/cjs/utils/DiffChecker.js.map +1 -0
  53. package/dist/cjs/utils/Filter.js +189 -0
  54. package/dist/cjs/utils/Filter.js.map +1 -0
  55. package/dist/cjs/utils/HashTable.js +175 -0
  56. package/dist/cjs/utils/HashTable.js.map +1 -0
  57. package/dist/cjs/utils/Normalizer.js +144 -0
  58. package/dist/cjs/utils/Normalizer.js.map +1 -0
  59. package/dist/cjs/utils/Pool.js +196 -0
  60. package/dist/cjs/utils/Pool.js.map +1 -0
  61. package/dist/cjs/utils/Profiler.js +229 -0
  62. package/dist/cjs/utils/Profiler.js.map +1 -0
  63. package/dist/cjs/utils/Registry.js +148 -0
  64. package/dist/cjs/utils/Registry.js.map +1 -0
  65. package/dist/cjs/utils/TextAnalyzer.js +358 -0
  66. package/dist/cjs/utils/TextAnalyzer.js.map +1 -0
  67. package/dist/esm/CmpStr.js +662 -0
  68. package/dist/esm/CmpStr.js.map +1 -0
  69. package/dist/esm/CmpStrAsync.js +331 -0
  70. package/dist/esm/CmpStrAsync.js.map +1 -0
  71. package/dist/esm/index.js +7 -0
  72. package/dist/esm/index.js.map +1 -0
  73. package/dist/esm/metric/Cosine.js +99 -0
  74. package/dist/esm/metric/Cosine.js.map +1 -0
  75. package/dist/esm/metric/DamerauLevenshtein.js +108 -0
  76. package/dist/esm/metric/DamerauLevenshtein.js.map +1 -0
  77. package/dist/esm/metric/DiceSorensen.js +89 -0
  78. package/dist/esm/metric/DiceSorensen.js.map +1 -0
  79. package/dist/esm/metric/Hamming.js +77 -0
  80. package/dist/esm/metric/Hamming.js.map +1 -0
  81. package/dist/esm/metric/Jaccard.js +74 -0
  82. package/dist/esm/metric/Jaccard.js.map +1 -0
  83. package/dist/esm/metric/JaroWinkler.js +112 -0
  84. package/dist/esm/metric/JaroWinkler.js.map +1 -0
  85. package/dist/esm/metric/LCS.js +87 -0
  86. package/dist/esm/metric/LCS.js.map +1 -0
  87. package/dist/esm/metric/Levenshtein.js +92 -0
  88. package/dist/esm/metric/Levenshtein.js.map +1 -0
  89. package/dist/esm/metric/Metric.js +442 -0
  90. package/dist/esm/metric/Metric.js.map +1 -0
  91. package/dist/esm/metric/NeedlemanWunsch.js +93 -0
  92. package/dist/esm/metric/NeedlemanWunsch.js.map +1 -0
  93. package/dist/esm/metric/SmithWaterman.js +96 -0
  94. package/dist/esm/metric/SmithWaterman.js.map +1 -0
  95. package/dist/esm/metric/qGram.js +89 -0
  96. package/dist/esm/metric/qGram.js.map +1 -0
  97. package/dist/esm/phonetic/Cologne.js +114 -0
  98. package/dist/esm/phonetic/Cologne.js.map +1 -0
  99. package/dist/esm/phonetic/Metaphone.js +174 -0
  100. package/dist/esm/phonetic/Metaphone.js.map +1 -0
  101. package/dist/esm/phonetic/Phonetic.js +409 -0
  102. package/dist/esm/phonetic/Phonetic.js.map +1 -0
  103. package/dist/esm/phonetic/Soundex.js +137 -0
  104. package/dist/esm/phonetic/Soundex.js.map +1 -0
  105. package/dist/esm/utils/DeepMerge.js +139 -0
  106. package/dist/esm/utils/DeepMerge.js.map +1 -0
  107. package/dist/esm/utils/DiffChecker.js +498 -0
  108. package/dist/esm/utils/DiffChecker.js.map +1 -0
  109. package/dist/esm/utils/Filter.js +187 -0
  110. package/dist/esm/utils/Filter.js.map +1 -0
  111. package/dist/esm/utils/HashTable.js +173 -0
  112. package/dist/esm/utils/HashTable.js.map +1 -0
  113. package/dist/esm/utils/Normalizer.js +142 -0
  114. package/dist/esm/utils/Normalizer.js.map +1 -0
  115. package/dist/esm/utils/Pool.js +194 -0
  116. package/dist/esm/utils/Pool.js.map +1 -0
  117. package/dist/esm/utils/Profiler.js +227 -0
  118. package/dist/esm/utils/Profiler.js.map +1 -0
  119. package/dist/esm/utils/Registry.js +142 -0
  120. package/dist/esm/utils/Registry.js.map +1 -0
  121. package/dist/esm/utils/TextAnalyzer.js +356 -0
  122. package/dist/esm/utils/TextAnalyzer.js.map +1 -0
  123. package/dist/types/CmpStr.d.ts +472 -0
  124. package/dist/types/CmpStrAsync.d.ts +233 -0
  125. package/dist/types/index.d.ts +51 -0
  126. package/dist/types/metric/Cosine.d.ts +57 -0
  127. package/dist/types/metric/DamerauLevenshtein.d.ts +50 -0
  128. package/dist/types/metric/DiceSorensen.d.ts +57 -0
  129. package/dist/types/metric/Hamming.d.ts +49 -0
  130. package/dist/types/metric/Jaccard.d.ts +48 -0
  131. package/dist/types/metric/JaroWinkler.d.ts +50 -0
  132. package/dist/types/metric/LCS.d.ts +50 -0
  133. package/dist/types/metric/Levenshtein.d.ts +50 -0
  134. package/dist/types/metric/Metric.d.ts +261 -0
  135. package/dist/types/metric/NeedlemanWunsch.d.ts +47 -0
  136. package/dist/types/metric/SmithWaterman.d.ts +48 -0
  137. package/dist/types/metric/index.d.ts +41 -0
  138. package/dist/types/metric/qGram.d.ts +56 -0
  139. package/dist/types/phonetic/Cologne.d.ts +46 -0
  140. package/dist/types/phonetic/Metaphone.d.ts +50 -0
  141. package/dist/types/phonetic/Phonetic.d.ts +189 -0
  142. package/dist/types/phonetic/Soundex.d.ts +49 -0
  143. package/dist/types/phonetic/index.d.ts +30 -0
  144. package/dist/types/utils/DeepMerge.d.ts +70 -0
  145. package/dist/types/utils/DiffChecker.d.ts +137 -0
  146. package/dist/types/utils/Filter.d.ts +97 -0
  147. package/dist/types/utils/HashTable.d.ts +86 -0
  148. package/dist/types/utils/Normalizer.d.ts +76 -0
  149. package/dist/types/utils/Pool.d.ts +63 -0
  150. package/dist/types/utils/Profiler.d.ts +129 -0
  151. package/dist/types/utils/Registry.d.ts +57 -0
  152. package/dist/types/utils/TextAnalyzer.d.ts +199 -0
  153. package/dist/types/utils/Types.d.ts +313 -0
  154. package/package.json +62 -49
  155. package/src/CmpStr.d.ts +0 -70
  156. package/src/CmpStr.js +0 -912
  157. package/src/CmpStrAsync.d.ts +0 -19
  158. package/src/CmpStrAsync.js +0 -204
  159. package/src/algorithms/cosine.js +0 -86
  160. package/src/algorithms/damerau.js +0 -78
  161. package/src/algorithms/dice.js +0 -65
  162. package/src/algorithms/hamming.js +0 -44
  163. package/src/algorithms/jaccard.js +0 -34
  164. package/src/algorithms/jaroWinkler.js +0 -106
  165. package/src/algorithms/lcs.js +0 -58
  166. package/src/algorithms/levenshtein.js +0 -70
  167. package/src/algorithms/needlemanWunsch.js +0 -72
  168. package/src/algorithms/qGram.js +0 -63
  169. package/src/algorithms/smithWaterman.js +0 -78
  170. package/src/algorithms/soundex.js +0 -152
  171. package/src/index.d.ts +0 -3
  172. package/src/index.js +0 -47
@@ -0,0 +1,472 @@
1
+ /**
2
+ * CmpStr Main API
3
+ * src/CmpStr.ts
4
+ *
5
+ * The CmpStr class provides a comprehensive, highly abstracted, and type-safe interface
6
+ * for string comparison, similarity measurement, phonetic indexing, filtering, normalization,
7
+ * and text analysis. It unifies all core features of the CmpStr package and exposes a
8
+ * consistent, user-friendly API for both single and batch operations.
9
+ *
10
+ * Features:
11
+ * - Centralized management of metrics, phonetic algorithms, and filters
12
+ * - Flexible normalization and filtering pipeline for all inputs
13
+ * - Batch, pairwise, and single string comparison with detailed results
14
+ * - Phonetic indexing and phonetic-aware search and comparison
15
+ * - Text analysis and unified diff utilities
16
+ * - Full TypeScript type safety and extensibility
17
+ *
18
+ * @module CmpStr
19
+ * @author Paul Köhler (komed3)
20
+ * @license MIT
21
+ */
22
+ import type { CmpStrOptions, CmpStrProcessors, CmpStrResult, NormalizeFlags, DiffOptions, PhoneticOptions, MetricRaw, MetricInput, MetricMode, MetricResult, MetricResultSingle, MetricResultBatch } from './utils/Types';
23
+ import { TextAnalyzer } from './utils/TextAnalyzer';
24
+ import { DiffChecker } from './utils/DiffChecker';
25
+ import { Normalizer } from './utils/Normalizer';
26
+ import { Filter } from './utils/Filter';
27
+ import { Metric } from './metric';
28
+ import { Phonetic } from './phonetic';
29
+ /**
30
+ * The main CmpStr class that provides a unified interface for string comparison,
31
+ * phonetic indexing, filtering, and text analysis.
32
+ *
33
+ * @template R - The type of the metric result, defaults to MetricRaw
34
+ */
35
+ export declare class CmpStr<R = MetricRaw> {
36
+ /**
37
+ * --------------------------------------------------------------------------------
38
+ * Static methods and properties for global access to CmpStr features
39
+ * --------------------------------------------------------------------------------
40
+ *
41
+ * These static methods provide a convenient way to access the core features of
42
+ * the CmpStr package without needing to instantiate a CmpStr object.
43
+ */
44
+ /**
45
+ * Adds, removes, pauses, resumes, lists, or clears global filters.
46
+ *
47
+ * @see Filter
48
+ */
49
+ static readonly filter: {
50
+ add: typeof Filter.add;
51
+ remove: typeof Filter.remove;
52
+ pause: typeof Filter.pause;
53
+ resume: typeof Filter.resume;
54
+ list: typeof Filter.list;
55
+ clear: typeof Filter.clear;
56
+ };
57
+ /**
58
+ * Adds, removes, checks, or lists available metrics.
59
+ *
60
+ * @see MetricRegistry
61
+ */
62
+ static readonly metric: {
63
+ add: (name: string, cls: import("./utils/Types").RegistryConstructor<Metric<MetricRaw>>, update?: boolean) => void;
64
+ remove: (name: string) => void;
65
+ has: (name: string) => boolean;
66
+ list: () => string[];
67
+ };
68
+ /**
69
+ * Adds, removes, checks, or lists available phonetic algorithms and mappings.
70
+ *
71
+ * @see PhoneticRegistry
72
+ */
73
+ static readonly phonetic: {
74
+ add: (name: string, cls: import("./utils/Types").RegistryConstructor<Phonetic>, update?: boolean) => void;
75
+ remove: (name: string) => void;
76
+ has: (name: string) => boolean;
77
+ list: () => string[];
78
+ map: {
79
+ add: (algo: string, id: string, map: import("./utils/Types").PhoneticMap, update?: boolean) => void;
80
+ remove: (algo: string, id: string) => void;
81
+ has: (algo: string, id: string) => boolean;
82
+ list: (algo: string) => string[];
83
+ };
84
+ };
85
+ /**
86
+ * Provides access to the global profiler services.
87
+ *
88
+ * @see Profiler
89
+ */
90
+ static readonly profiler: import("./utils/Types").ProfilerService<any>;
91
+ /**
92
+ * Clears the caches for normalizer, metric, and phonetic modules.
93
+ */
94
+ static readonly clearCache: {
95
+ normalizer: typeof Normalizer.clear;
96
+ metric: typeof Metric.clear;
97
+ phonetic: typeof Phonetic.clear;
98
+ };
99
+ /**
100
+ * Returns a TextAnalyzer instance for the given input string.
101
+ *
102
+ * @param {string} [input] - The input string
103
+ * @returns {TextAnalyzer} - The text analyzer
104
+ */
105
+ static analyze(input: string): TextAnalyzer;
106
+ /**
107
+ * Returns a DiffChecker instance for computing the unified diff between two texts.
108
+ *
109
+ * @param {string} a - The first (original) text
110
+ * @param {string} b - The second (modified) text
111
+ * @param {DiffOptions} [opt] - Optional diff configuration
112
+ * @returns {DiffChecker} - The diff checker instance
113
+ */
114
+ static diff(a: string, b: string, opt?: DiffOptions): DiffChecker;
115
+ /**
116
+ * --------------------------------------------------------------------------------
117
+ * Instanciate the CmpStr class
118
+ * --------------------------------------------------------------------------------
119
+ *
120
+ * Methods to create a new CmpStr instance with the given options.
121
+ * Using the static `create` method is recommended to ensure proper instantiation.
122
+ */
123
+ /**
124
+ * Creates a new CmpStr instance with the given options.
125
+ *
126
+ * @param {string|CmpStrOptions} [opt] - Optional serialized or options object
127
+ * @returns {CmpStr<R>} - A new CmpStr instance
128
+ */
129
+ static create<R = MetricRaw>(opt?: string | CmpStrOptions): CmpStr<R>;
130
+ protected options: CmpStrOptions;
131
+ /**
132
+ * Creates a new CmpStr instance with the given options.
133
+ * The constructor is protected to enforce the use of the static `create` method.
134
+ *
135
+ * @param {string|CmpStrOptions} [opt] - Optional serialized or options object
136
+ */
137
+ protected constructor(opt?: string | CmpStrOptions);
138
+ /**
139
+ * ---------------------------------------------------------------------------------
140
+ * Protected utility methods for internal use
141
+ * ---------------------------------------------------------------------------------
142
+ *
143
+ * These methods provide utility functions for converting inputs, merging options,
144
+ * normalizing inputs, filtering, and preparing inputs for comparison.
145
+ */
146
+ /**
147
+ * Assert a condition and throws if the condition is not met.
148
+ *
149
+ * @param {string} cond - The condition to met
150
+ * @param {any} [test] - Value to test for
151
+ * @throws {Error} If the condition is not met
152
+ */
153
+ protected assert(cond: string, test?: any): void;
154
+ /**
155
+ * Assert multiple conditions.
156
+ *
157
+ * @param {[ string, any? ][]} cond - Array of [ condition, value ] pairs
158
+ */
159
+ protected assertMany(...cond: [string, any?][]): void;
160
+ /**
161
+ * Resolves the options for the CmpStr instance, merging the provided options with
162
+ * the existing options.
163
+ *
164
+ * @param {CmpStrOptions} [opt] - Optional options to merge
165
+ * @returns {CmpStrOptions} - The resolved options
166
+ */
167
+ protected resolveOptions(opt?: CmpStrOptions): CmpStrOptions;
168
+ /**
169
+ * Normalizes the input string or array using the configured or provided flags.
170
+ *
171
+ * @param {MetricInput} input - The input string or array
172
+ * @param {NormalizeFlags} [flags] - Normalization flags
173
+ * @returns {MetricInput} - The normalized input
174
+ */
175
+ protected normalize(input: MetricInput, flags?: NormalizeFlags): MetricInput;
176
+ /**
177
+ * Applies all active filters to the input string or array.
178
+ *
179
+ * @param {MetricInput} input - The input string or array
180
+ * @param {string} [hook='input'] - The filter hook
181
+ * @returns {MetricInput} - The filtered string(s)
182
+ */
183
+ protected filter(input: MetricInput, hook: string): MetricInput;
184
+ /**
185
+ * Prepares the input by normalizing and filtering.
186
+ *
187
+ * @param {MetricInput} [input] - The input string or array
188
+ * @param {CmpStrOptions} [opt] - Optional options to use
189
+ * @returns {MetricInput} - The prepared input
190
+ */
191
+ protected prepare(input: MetricInput, opt?: CmpStrOptions): MetricInput;
192
+ /**
193
+ * Post-process the results of the metric computation.
194
+ *
195
+ * @param {MetricResult<R>} result - The metric result
196
+ * @returns {MetricResult<R>} - The post-processed results
197
+ */
198
+ protected postProcess(result: MetricResult<R>, opt?: CmpStrOptions): MetricResult<R>;
199
+ /**
200
+ * Computes the phonetic index for the given input using the specified phonetic algorithm.
201
+ *
202
+ * @param {MetricInput} input - The input string or array
203
+ * @param {{ algo: string, opt?: PhoneticOptions }} options - The phonetic algorithm and options
204
+ * @returns {MetricInput} - The phonetic index for the given input
205
+ */
206
+ protected index(input: MetricInput, { algo, opt }: {
207
+ algo: string;
208
+ opt?: PhoneticOptions;
209
+ }): MetricInput;
210
+ /**
211
+ * Computes the metric result for the given inputs, applying normalization and
212
+ * filtering as configured.
213
+ *
214
+ * @template T - The type of the metric result
215
+ * @param {MetricInput} a - The first input string or array
216
+ * @param {MetricInput} b - The second input string or array
217
+ * @param {CmpStrOptions} [opt] - Optional options to use
218
+ * @param {MetricMode} [mode='single'] - The metric mode to use
219
+ * @param {boolean} [raw=false] - Whether to return raw results
220
+ * @param {boolean} [skip=false] - Whether to skip normalization and filtering
221
+ * @returns {T} - The computed metric result
222
+ */
223
+ protected compute<T extends MetricResult<R> | CmpStrResult | CmpStrResult[]>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions, mode?: MetricMode, raw?: boolean, skip?: boolean): T;
224
+ /**
225
+ * Resolves the result format (raw or formatted).
226
+ *
227
+ * @template T - The type of the metric result
228
+ * @param {MetricResult<R>} result - The metric result
229
+ * @param {boolean} [raw] - Whether to return raw results
230
+ * @returns {T} - The resolved result
231
+ */
232
+ protected output<T extends MetricResult<R> | CmpStrResult | CmpStrResult[]>(result: MetricResult<R>, raw?: boolean): T;
233
+ /**
234
+ * ---------------------------------------------------------------------------------
235
+ * Managing methods for CmpStr
236
+ * ---------------------------------------------------------------------------------
237
+ *
238
+ * These methods provides an interface to set and get properties of the CmpStr
239
+ * instance, such as options, metric, phonetic algorithm, and more.
240
+ */
241
+ /**
242
+ * Creates a shallow clone of the current instance.
243
+ *
244
+ * @returns {CmpStr<R>} - The cloned instance
245
+ */
246
+ clone(): CmpStr<R>;
247
+ /**
248
+ * Resets the instance, clearing all data and options.
249
+ *
250
+ * @returns {this}
251
+ */
252
+ reset(): this;
253
+ /**
254
+ * Sets / replaces the full options object.
255
+ *
256
+ * @param {CmpStrOptions} opt - The options
257
+ * @returns {this}
258
+ */
259
+ setOptions(opt: CmpStrOptions): this;
260
+ /**
261
+ * Deep merges and sets new options.
262
+ *
263
+ * @param {CmpStrOptions} opt - The options to merge
264
+ * @returns {this}
265
+ */
266
+ mergeOptions(opt: CmpStrOptions): this;
267
+ /**
268
+ * Sets the serialized options from a JSON string.
269
+ *
270
+ * @param {string} opt - The serialized options
271
+ * @returns {this}
272
+ */
273
+ setSerializedOptions(opt: string): this;
274
+ /**
275
+ * Sets a specific option at the given path.
276
+ *
277
+ * @param {string} path - The path to the option
278
+ * @param {any} value - The value to set
279
+ * @returns {this}
280
+ */
281
+ setOption(path: string, value: any): this;
282
+ /**
283
+ * Removes an option at the given path.
284
+ *
285
+ * @param {string} path - The path to the option
286
+ * @returns {this}
287
+ */
288
+ rmvOption(path: string): this;
289
+ /**
290
+ * Enable or disable raw output.
291
+ *
292
+ * @param {boolean} enable - Whether to enable or disable raw output
293
+ * @returns {this}
294
+ */
295
+ setRaw(enable: boolean): this;
296
+ /**
297
+ * Sets the similatity metric to use (e.g., 'levenshtein', 'dice').
298
+ *
299
+ * @param {string} name - The metric name
300
+ * @returns {this}
301
+ */
302
+ setMetric(name: string): this;
303
+ /**
304
+ * Sets the normalization flags (e.g., 'itw', 'nfc').
305
+ *
306
+ * @param {NormalizeFlags} flags - The normalization flags
307
+ * @returns {this}
308
+ */
309
+ setFlags(flags: NormalizeFlags): this;
310
+ /**
311
+ * Removes the normalization flags entirely.
312
+ *
313
+ * @return {this}
314
+ */
315
+ rmvFlags(): this;
316
+ /**
317
+ * Sets the pre-processors to use for preparing the input.
318
+ *
319
+ * @param {CmpStrProcessors} opt - The processors to set
320
+ * @returns {this}
321
+ */
322
+ setProcessors(opt: CmpStrProcessors): this;
323
+ /**
324
+ * Removes the processors entirely.
325
+ *
326
+ * @returns {this}
327
+ */
328
+ rmvProcessors(): this;
329
+ /**
330
+ * Returns the current options object.
331
+ *
332
+ * @returns {CmpStrOptions} - The options
333
+ */
334
+ getOptions(): CmpStrOptions;
335
+ /**
336
+ * Returns the options as a JSON string.
337
+ *
338
+ * @returns {string} - The serialized options
339
+ */
340
+ getSerializedOptions(): string;
341
+ /**
342
+ * Returns a specific option value by path.
343
+ *
344
+ * @param {string} path - The path to the option
345
+ * @returns {any} - The option value
346
+ */
347
+ getOption(path: string): any;
348
+ /**
349
+ * ---------------------------------------------------------------------------------
350
+ * Public core methods for string comparison
351
+ * ---------------------------------------------------------------------------------
352
+ *
353
+ * These methods provide the core functionality of the CmpStr class, allowing for
354
+ * string comparison, phonetic indexing, filtering, and text search.
355
+ */
356
+ /**
357
+ * Performs a single metric comparison between the source and target.
358
+ *
359
+ * @template T - The type of the metric result
360
+ * @param {string} a - The source string
361
+ * @param {string} b - The target string
362
+ * @param {CmpStrOptions} [opt] - Optional options
363
+ * @returns {T} - The metric result
364
+ */
365
+ test<T extends CmpStrResult | MetricResultSingle<R>>(a: string, b: string, opt?: CmpStrOptions): T;
366
+ /**
367
+ * Performs a single metric comparison and returns only the numeric score.
368
+ *
369
+ * @param {string} a - The source string
370
+ * @param {string} b - The target string
371
+ * @param {CmpStrOptions} [opt] - Optional options
372
+ * @returns {number} - The similarity score (0..1)
373
+ */
374
+ compare(a: string, b: string, opt?: CmpStrOptions): number;
375
+ /**
376
+ * Performs a batch metric comparison between source and target strings
377
+ * or array of strings.
378
+ *
379
+ * @template T - The type of the metric result
380
+ * @param {MetricInput} a - The source string or array of strings
381
+ * @param {MetricInput} b - The target string or array of strings
382
+ * @param {CmpStrOptions} [opt] - Optional options
383
+ * @returns {T} - The batch metric results
384
+ */
385
+ batchTest<T extends CmpStrResult[] | MetricResultBatch<R>>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): T;
386
+ /**
387
+ * Performs a batch metric comparison and returns results sorted by score.
388
+ *
389
+ * @template T - The type of the metric result
390
+ * @param {MetricInput} a - The source string or array of strings
391
+ * @param {MetricInput} b - The target string or array of strings
392
+ * @param {'desc'|'asc'} [dir='desc'] - Sort direction (desc, asc)
393
+ * @param {CmpStrOptions} [opt] - Optional options
394
+ * @returns {T} - The sorted batch results
395
+ */
396
+ batchSorted<T extends CmpStrResult[] | MetricResultBatch<R>>(a: MetricInput, b: MetricInput, dir?: 'desc' | 'asc', opt?: CmpStrOptions): T;
397
+ /**
398
+ * Performs a pairwise metric comparison between source and target strings
399
+ * or array of strings.
400
+ *
401
+ * Input arrays needs of the same length to perform pairwise comparison,
402
+ * otherwise the method will throw an error.
403
+ *
404
+ * @template T - The type of the metric result
405
+ * @param {MetricInput} a - The source string or array of strings
406
+ * @param {MetricInput} b - The target string or array of strings
407
+ * @param {CmpStrOptions} [opt] - Optional options
408
+ * @returns {T} - The pairwise metric results
409
+ */
410
+ pairs<T extends CmpStrResult[] | MetricResultBatch<R>>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): T;
411
+ /**
412
+ * Performs a batch comparison and returns only results above the threshold.
413
+ *
414
+ * @template T - The type of the metric result
415
+ * @param {MetricInput} a - The source string or array of strings
416
+ * @param {MetricInput} b - The target string or array of strings
417
+ * @param {number} threshold - The similarity threshold (0..1)
418
+ * @param {CmpStrOptions} [opt] - Optional options
419
+ * @returns {T} - The filtered batch results
420
+ */
421
+ match<T extends CmpStrResult[] | MetricResultBatch<R>>(a: MetricInput, b: MetricInput, threshold: number, opt?: CmpStrOptions): T;
422
+ /**
423
+ * Returns the n closest matches from a batch comparison.
424
+ *
425
+ * @template T - The type of the metric result
426
+ * @param {MetricInput} a - The source string or array of strings
427
+ * @param {MetricInput} b - The target string or array of strings
428
+ * @param {number} [n=1] - Number of closest matches
429
+ * @param {CmpStrOptions} [opt] - Optional options
430
+ * @returns {T} - The closest matches
431
+ */
432
+ closest<T extends CmpStrResult[] | MetricResultBatch<R>>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): T;
433
+ /**
434
+ * Returns the n furthest matches from a batch comparison.
435
+ *
436
+ * @template T - The type of the metric result
437
+ * @param {MetricInput} a - The source string or array of strings
438
+ * @param {MetricInput} b - The target string or array of strings
439
+ * @param {number} [n=1] - Number of furthest matches
440
+ * @param {CmpStrOptions} [opt] - Optional options
441
+ * @returns {T} - The furthest matches
442
+ */
443
+ furthest<T extends CmpStrResult[] | MetricResultBatch<R>>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): T;
444
+ /**
445
+ * Performs a normalized and filtered substring search.
446
+ *
447
+ * @param {string} needle - The search string
448
+ * @param {string[]} haystack - The array to search in
449
+ * @param {NormalizeFlags} [flags] - Normalization flags
450
+ * @param {CmpStrProcessors} [processors] - Pre-processors to apply
451
+ * @returns {string[]} - Array of matching entries
452
+ */
453
+ search(needle: string, haystack: string[], flags?: NormalizeFlags, processors?: CmpStrProcessors): string[];
454
+ /**
455
+ * Computes a similarity matrix for the given input array.
456
+ *
457
+ * @param {string[]} input - The input array
458
+ * @param {CmpStrOptions} [opt] - Optional options
459
+ * @returns {number[][]} - The similarity matrix
460
+ */
461
+ matrix(input: string[], opt?: CmpStrOptions): number[][];
462
+ /**
463
+ * Computes the phonetic index for a string using the configured
464
+ * or given algorithm.
465
+ *
466
+ * @param {string} [input] - The input string
467
+ * @param {string} [algo] - The phonetic algorithm to use
468
+ * @param {PhoneticOptions} [opt] - Optional phonetic options
469
+ * @returns {string} - The phonetic index as a string
470
+ */
471
+ phoneticIndex(input: string, algo?: string, opt?: PhoneticOptions): string;
472
+ }