@scrabble-solver/word-lists 2.13.0 → 2.13.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/build/getEsEsWordList.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const types_1 = require("@scrabble-solver/types");
|
|
7
|
+
const latinize_1 = __importDefault(require("latinize"));
|
|
4
8
|
const lib_1 = require("./lib");
|
|
5
|
-
const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/
|
|
9
|
+
const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/scrabble-dictionaries/master/spanish/fise-2.txt';
|
|
10
|
+
const N_PLACEHOLDER = '---n---';
|
|
6
11
|
const getEsEsWordList = async () => {
|
|
7
12
|
const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.ES_ES);
|
|
8
|
-
return words
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return word.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
13
|
+
return words
|
|
14
|
+
.map((word) => word.replaceAll('ñ', N_PLACEHOLDER))
|
|
15
|
+
.map(latinize_1.default)
|
|
16
|
+
.map((word) => word.replaceAll(N_PLACEHOLDER, 'ñ'));
|
|
13
17
|
};
|
|
14
18
|
exports.default = getEsEsWordList;
|
package/build/getFrFrWordList.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const types_1 = require("@scrabble-solver/types");
|
|
7
|
+
const latinize_1 = __importDefault(require("latinize"));
|
|
4
8
|
const lib_1 = require("./lib");
|
|
5
9
|
const FILE_URL = 'https://raw.githubusercontent.com/Thecoolsim/French-Scrabble-ODS8/main/French%20ODS%20dictionary.txt';
|
|
6
10
|
const getFrFrWordList = async () => {
|
|
7
11
|
const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.FR_FR);
|
|
8
|
-
return words.map(
|
|
9
|
-
};
|
|
10
|
-
const normalizeWord = (word) => {
|
|
11
|
-
// normalization from https://stackoverflow.com/a/37511463
|
|
12
|
-
return word.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
12
|
+
return words.map(latinize_1.default);
|
|
13
13
|
};
|
|
14
14
|
exports.default = getFrFrWordList;
|
package/build/getRoRoWordList.js
CHANGED
|
@@ -3,21 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const types_1 = require("@scrabble-solver/types");
|
|
7
|
+
const latinize_1 = __importDefault(require("latinize"));
|
|
7
8
|
const lib_1 = require("./lib");
|
|
8
|
-
const FILE_URL = 'https://
|
|
9
|
-
const FILE_TO_EXTRACT_FROM_ZIP = 'loc-flexiuni-5.0.txt';
|
|
9
|
+
const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/scrabble-dictionaries/master/romanian/loc-5.0.txt';
|
|
10
10
|
const getRoRoWordList = async () => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
await (0, lib_1.unzip)(zipTempFilename, FILE_TO_EXTRACT_FROM_ZIP, tempFilepath);
|
|
14
|
-
fs_1.default.unlinkSync(zipTempFilename);
|
|
15
|
-
const file = fs_1.default.readFileSync(tempFilepath, 'utf-8');
|
|
16
|
-
fs_1.default.unlinkSync(tempFilepath);
|
|
17
|
-
const words = (0, lib_1.extractWords)(replaceDiacritics(file.toLocaleString()), 'ro-RO');
|
|
18
|
-
return words;
|
|
19
|
-
};
|
|
20
|
-
const replaceDiacritics = (file) => {
|
|
21
|
-
return file.replaceAll('ă', 'a').replaceAll('â', 'a').replaceAll('î', 'i').replaceAll('ș', 's').replaceAll('ț', 't');
|
|
11
|
+
const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.RO_RO);
|
|
12
|
+
return words.map(latinize_1.default);
|
|
22
13
|
};
|
|
23
14
|
exports.default = getRoRoWordList;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/word-lists",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"description": "Scrabble Solver 2 - Word lists",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -24,14 +24,16 @@
|
|
|
24
24
|
"clean:force": "npm run clean && rimraf package-lock.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@scrabble-solver/types": "^2.13.
|
|
27
|
+
"@scrabble-solver/types": "^2.13.1",
|
|
28
28
|
"cheerio": "^1.0.0-rc.12",
|
|
29
29
|
"follow-redirects": "^1.15.2",
|
|
30
|
+
"latinize": "^1.0.0",
|
|
30
31
|
"unzipper": "^0.10.11"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/follow-redirects": "^1.14.1",
|
|
35
|
+
"@types/latinize": "^0.2.17",
|
|
34
36
|
"@types/unzipper": "^0.10.5"
|
|
35
37
|
},
|
|
36
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "0588fd5c88be44c2f3e96d8cf8cc6fa7166c924c"
|
|
37
39
|
}
|
package/src/getEsEsWordList.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Locale } from '@scrabble-solver/types';
|
|
2
|
+
import latinize from 'latinize';
|
|
2
3
|
|
|
3
4
|
import { getTxtWordList } from './lib';
|
|
4
5
|
|
|
5
|
-
const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/
|
|
6
|
+
const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/scrabble-dictionaries/master/spanish/fise-2.txt';
|
|
7
|
+
const N_PLACEHOLDER = '---n---';
|
|
6
8
|
|
|
7
9
|
const getEsEsWordList = async (): Promise<string[]> => {
|
|
8
10
|
const words = await getTxtWordList(FILE_URL, Locale.ES_ES);
|
|
9
|
-
return words.map(normalizeWord);
|
|
10
|
-
};
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
return words
|
|
13
|
+
.map((word) => word.replaceAll('ñ', N_PLACEHOLDER))
|
|
14
|
+
.map(latinize)
|
|
15
|
+
.map((word) => word.replaceAll(N_PLACEHOLDER, 'ñ'));
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export default getEsEsWordList;
|
package/src/getFrFrWordList.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Locale } from '@scrabble-solver/types';
|
|
2
|
+
import latinize from 'latinize';
|
|
2
3
|
|
|
3
4
|
import { getTxtWordList } from './lib';
|
|
4
5
|
|
|
@@ -6,12 +7,7 @@ const FILE_URL = 'https://raw.githubusercontent.com/Thecoolsim/French-Scrabble-O
|
|
|
6
7
|
|
|
7
8
|
const getFrFrWordList = async (): Promise<string[]> => {
|
|
8
9
|
const words = await getTxtWordList(FILE_URL, Locale.FR_FR);
|
|
9
|
-
return words.map(
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const normalizeWord = (word: string): string => {
|
|
13
|
-
// normalization from https://stackoverflow.com/a/37511463
|
|
14
|
-
return word.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
10
|
+
return words.map(latinize);
|
|
15
11
|
};
|
|
16
12
|
|
|
17
13
|
export default getFrFrWordList;
|
package/src/getRoRoWordList.ts
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Locale } from '@scrabble-solver/types';
|
|
2
|
+
import latinize from 'latinize';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import { getTxtWordList } from './lib';
|
|
4
5
|
|
|
5
|
-
const FILE_URL = 'https://
|
|
6
|
-
const FILE_TO_EXTRACT_FROM_ZIP = 'loc-flexiuni-5.0.txt';
|
|
6
|
+
const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/scrabble-dictionaries/master/romanian/loc-5.0.txt';
|
|
7
7
|
|
|
8
8
|
const getRoRoWordList = async (): Promise<string[]> => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
await unzip(zipTempFilename, FILE_TO_EXTRACT_FROM_ZIP, tempFilepath);
|
|
12
|
-
fs.unlinkSync(zipTempFilename);
|
|
13
|
-
const file = fs.readFileSync(tempFilepath, 'utf-8');
|
|
14
|
-
fs.unlinkSync(tempFilepath);
|
|
15
|
-
const words = extractWords(replaceDiacritics(file.toLocaleString()), 'ro-RO');
|
|
16
|
-
return words;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const replaceDiacritics = (file: string): string => {
|
|
20
|
-
return file.replaceAll('ă', 'a').replaceAll('â', 'a').replaceAll('î', 'i').replaceAll('ș', 's').replaceAll('ț', 't');
|
|
9
|
+
const words = await getTxtWordList(FILE_URL, Locale.RO_RO);
|
|
10
|
+
return words.map(latinize);
|
|
21
11
|
};
|
|
22
12
|
|
|
23
13
|
export default getRoRoWordList;
|