wordsninja 1.1.0 → 2.0.1
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/CHANGELOG.md +71 -0
- package/NOTICE +21 -0
- package/README.md +309 -124
- package/index.d.mts +10 -0
- package/index.d.ts +100 -0
- package/index.js +642 -167
- package/index.mjs +4 -0
- package/package.json +73 -29
- package/words-en.json +0 -2
- package/example.js +0 -15
package/index.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,29 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "wordsninja",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Split
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "wordsninja",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Split an English string that has no spaces into words. Zero dependencies, offset-aware, with custom dictionaries and TypeScript types.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"module": "index.mjs",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./index.d.mts",
|
|
12
|
+
"default": "./index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"default": "./index.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.js",
|
|
24
|
+
"index.mjs",
|
|
25
|
+
"index.d.ts",
|
|
26
|
+
"index.d.mts",
|
|
27
|
+
"words-en.json",
|
|
28
|
+
"NOTICE",
|
|
29
|
+
"CHANGELOG.md"
|
|
30
|
+
],
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"test": "node --test test/wordsninja.test.js test/robustness.test.js",
|
|
37
|
+
"test:watch": "node --test --watch test/wordsninja.test.js test/robustness.test.js",
|
|
38
|
+
"build:dictionary": "node scripts/build-dictionary.js",
|
|
39
|
+
"bench": "node bench/bench.js",
|
|
40
|
+
"bench:accuracy": "node bench/accuracy.js",
|
|
41
|
+
"prepublishOnly": "npm test"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"split",
|
|
45
|
+
"text",
|
|
46
|
+
"sentence",
|
|
47
|
+
"english",
|
|
48
|
+
"ninja",
|
|
49
|
+
"words",
|
|
50
|
+
"word",
|
|
51
|
+
"splitter",
|
|
52
|
+
"tokenizer",
|
|
53
|
+
"tokenize",
|
|
54
|
+
"segmentation",
|
|
55
|
+
"text-segmentation",
|
|
56
|
+
"word-segmentation",
|
|
57
|
+
"wordninja",
|
|
58
|
+
"no-spaces",
|
|
59
|
+
"capitalize",
|
|
60
|
+
"camelcase",
|
|
61
|
+
"camel-case"
|
|
62
|
+
],
|
|
63
|
+
"author": "Parsa Kafi <parselearn@gmail.com> (https://parsa.ws)",
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "git+https://github.com/parsakafi/wordsninja.git"
|
|
68
|
+
},
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/parsakafi/wordsninja/issues"
|
|
71
|
+
},
|
|
72
|
+
"homepage": "https://parsa.ws/projects/wordsninja-js-package"
|
|
73
|
+
}
|
package/words-en.json
CHANGED
|
@@ -125620,7 +125620,6 @@
|
|
|
125620
125620
|
"reintegrate",
|
|
125621
125621
|
"reitz",
|
|
125622
125622
|
"wester",
|
|
125623
|
-
"reit",
|
|
125624
125623
|
"unabashedly",
|
|
125625
125624
|
"rediffusion",
|
|
125626
125625
|
"reinstituted",
|
|
@@ -125857,7 +125856,6 @@
|
|
|
125857
125856
|
"deighton",
|
|
125858
125857
|
"thibault",
|
|
125859
125858
|
"stelmach",
|
|
125860
|
-
"sofas",
|
|
125861
125859
|
"sniffer",
|
|
125862
125860
|
"priddy",
|
|
125863
125861
|
"o'dwyer",
|
package/example.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const WordsNinjaPack = require("./index.js");
|
|
2
|
-
const WordsNinja = new WordsNinjaPack();
|
|
3
|
-
|
|
4
|
-
(async () => {
|
|
5
|
-
await WordsNinja.loadDictionary();
|
|
6
|
-
|
|
7
|
-
let string = 'youneedtolearnfromyourmistakes';
|
|
8
|
-
let words = WordsNinja.splitSentence(string,
|
|
9
|
-
{
|
|
10
|
-
camelCaseSplitter: false, // Camel case splitting
|
|
11
|
-
capitalizeFirstLetter: false, // Capitalize first letter of result
|
|
12
|
-
joinWords: false // Join words with space
|
|
13
|
-
});
|
|
14
|
-
console.log(words);
|
|
15
|
-
})();
|