fuzzies-node 1.0.0 → 1.1.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/README.md +4 -6
- package/index.d.ts +4 -3
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -10,16 +10,16 @@ npm install fuzzies-node
|
|
|
10
10
|
```javascript
|
|
11
11
|
const { Dictionary } = require('fuzzies-node');
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function main() {
|
|
14
14
|
// Prepare your raw text file (must be sorted lexicographically)
|
|
15
15
|
// Fuzzies provides a handy in-place sorter for convenience:
|
|
16
|
-
|
|
16
|
+
Dictionary.sort('words.txt');
|
|
17
17
|
|
|
18
18
|
// Build the immutable binary FST from the sorted text file
|
|
19
|
-
|
|
19
|
+
Dictionary.build('words.txt', 'words.fst');
|
|
20
20
|
|
|
21
21
|
// Load the dictionary (memory-mapped from disk)
|
|
22
|
-
const dict =
|
|
22
|
+
const dict = Dictionary.open('words.fst');
|
|
23
23
|
|
|
24
24
|
// Alternatively, build directly from an array in memory:
|
|
25
25
|
// const dict = Dictionary.fromArray(["apple", "banana", "cherry"]);
|
|
@@ -47,8 +47,6 @@ async function main() {
|
|
|
47
47
|
console.log(`Found: ${result.key} (distance: ${result.distance})`);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
main().catch(console.error);
|
|
52
50
|
```
|
|
53
51
|
|
|
54
52
|
## Missing Features
|
package/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export declare class Dictionary {
|
|
4
|
-
static open(path: string):
|
|
4
|
+
static open(path: string): Dictionary
|
|
5
5
|
static fromArray(keys: Array<string>): Dictionary
|
|
6
6
|
/** Compiles a byte-sorted text file into an immutable binary FST. */
|
|
7
|
-
static build(inputPath: string, outputPath: string):
|
|
7
|
+
static build(inputPath: string, outputPath: string): void
|
|
8
8
|
/** Sorts a newline-delimited text file in-place by byte order. */
|
|
9
|
-
static sort(path: string):
|
|
9
|
+
static sort(path: string): void
|
|
10
10
|
contains(key: string): boolean
|
|
11
|
+
isEmpty(): boolean
|
|
11
12
|
/** Returns the single top match for a query if it exists. */
|
|
12
13
|
suggest(query: string): SearchResult | null
|
|
13
14
|
/** Executes a fuzzy search query. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fuzzies-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Fast fuzzy search matching.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"keywords": [
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
12
|
+
"fst",
|
|
13
|
+
"levenshtein-automata",
|
|
14
|
+
"fuzzy-search",
|
|
15
|
+
"search",
|
|
16
|
+
"text-processing",
|
|
17
|
+
"rust",
|
|
18
|
+
"NAPI"
|
|
18
19
|
],
|
|
19
20
|
"files": [
|
|
20
21
|
"index.d.ts",
|
|
@@ -107,10 +108,10 @@
|
|
|
107
108
|
]
|
|
108
109
|
},
|
|
109
110
|
"optionalDependencies": {
|
|
110
|
-
"fuzzies-node-darwin-arm64": "1.
|
|
111
|
-
"fuzzies-node-linux-arm64-gnu": "1.
|
|
112
|
-
"fuzzies-node-darwin-x64": "1.
|
|
113
|
-
"fuzzies-node-win32-x64-msvc": "1.
|
|
114
|
-
"fuzzies-node-linux-x64-gnu": "1.
|
|
111
|
+
"fuzzies-node-darwin-arm64": "1.1.0",
|
|
112
|
+
"fuzzies-node-linux-arm64-gnu": "1.1.0",
|
|
113
|
+
"fuzzies-node-darwin-x64": "1.1.0",
|
|
114
|
+
"fuzzies-node-win32-x64-msvc": "1.1.0",
|
|
115
|
+
"fuzzies-node-linux-x64-gnu": "1.1.0"
|
|
115
116
|
}
|
|
116
117
|
}
|