thaizip 0.6.0 → 0.7.3
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/LICENSE +21 -0
- package/README.md +92 -263
- package/dist/data.cjs +98 -9
- package/dist/data.d.cts +25 -0
- package/dist/data.d.ts +25 -0
- package/dist/data.js +98 -9
- package/dist/index.cjs +380 -29
- package/dist/index.d.cts +187 -2
- package/dist/index.d.ts +187 -2
- package/dist/index.js +375 -30
- package/dist/react.cjs +267 -50
- package/dist/react.d.cts +49 -1
- package/dist/react.d.ts +49 -1
- package/dist/react.js +268 -51
- package/package.json +8 -5
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react.cjs.map +0 -1
- package/dist/react.js.map +0 -1
package/dist/data.d.cts
CHANGED
|
@@ -14,6 +14,31 @@ type TrigramIndex = {
|
|
|
14
14
|
map: Map<string, Set<number>>;
|
|
15
15
|
records: ThaiAddressRecord[];
|
|
16
16
|
zipIndex: Map<string, number[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Zip codes of `zipIndex` in ascending lexical order, with postings
|
|
19
|
+
* parallel in `sortedZipPostings`. Used by `lookupByZipCode` for
|
|
20
|
+
* O(log n + matches) prefix lookup instead of scanning every zip code.
|
|
21
|
+
* Optional: older-shaped or hand-built indexes without these fields fall
|
|
22
|
+
* back to the O(n_zips) scan.
|
|
23
|
+
*/
|
|
24
|
+
sortedZipKeys?: string[];
|
|
25
|
+
sortedZipPostings?: number[][];
|
|
26
|
+
/**
|
|
27
|
+
* Normalized Thai tambon names, parallel to `records` (same index).
|
|
28
|
+
* Used by the search ranker for exact/prefix match detection without
|
|
29
|
+
* re-normalizing on every query.
|
|
30
|
+
*/
|
|
31
|
+
normTambon: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Normalized English (RTGS) tambon names, parallel to `records`. Needed so
|
|
34
|
+
* romanized queries get the same own-name-beats-parent-name ranking that
|
|
35
|
+
* Thai queries get.
|
|
36
|
+
*/
|
|
37
|
+
normTambonEn: string[];
|
|
38
|
+
/** Record indices grouped by `provinceId`, in insertion order. */
|
|
39
|
+
byProvince: Map<number, number[]>;
|
|
40
|
+
/** Record indices grouped by `amphureId`, in insertion order. */
|
|
41
|
+
byAmphure: Map<number, number[]>;
|
|
17
42
|
};
|
|
18
43
|
|
|
19
44
|
declare function clearDefaultIndex(): void;
|
package/dist/data.d.ts
CHANGED
|
@@ -14,6 +14,31 @@ type TrigramIndex = {
|
|
|
14
14
|
map: Map<string, Set<number>>;
|
|
15
15
|
records: ThaiAddressRecord[];
|
|
16
16
|
zipIndex: Map<string, number[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Zip codes of `zipIndex` in ascending lexical order, with postings
|
|
19
|
+
* parallel in `sortedZipPostings`. Used by `lookupByZipCode` for
|
|
20
|
+
* O(log n + matches) prefix lookup instead of scanning every zip code.
|
|
21
|
+
* Optional: older-shaped or hand-built indexes without these fields fall
|
|
22
|
+
* back to the O(n_zips) scan.
|
|
23
|
+
*/
|
|
24
|
+
sortedZipKeys?: string[];
|
|
25
|
+
sortedZipPostings?: number[][];
|
|
26
|
+
/**
|
|
27
|
+
* Normalized Thai tambon names, parallel to `records` (same index).
|
|
28
|
+
* Used by the search ranker for exact/prefix match detection without
|
|
29
|
+
* re-normalizing on every query.
|
|
30
|
+
*/
|
|
31
|
+
normTambon: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Normalized English (RTGS) tambon names, parallel to `records`. Needed so
|
|
34
|
+
* romanized queries get the same own-name-beats-parent-name ranking that
|
|
35
|
+
* Thai queries get.
|
|
36
|
+
*/
|
|
37
|
+
normTambonEn: string[];
|
|
38
|
+
/** Record indices grouped by `provinceId`, in insertion order. */
|
|
39
|
+
byProvince: Map<number, number[]>;
|
|
40
|
+
/** Record indices grouped by `amphureId`, in insertion order. */
|
|
41
|
+
byAmphure: Map<number, number[]>;
|
|
17
42
|
};
|
|
18
43
|
|
|
19
44
|
declare function clearDefaultIndex(): void;
|