@scrabble-solver/word-definitions 2.13.5-alpha.2 → 2.13.5-alpha.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/package.json +3 -3
- package/build/crawl/crawl.d.ts +0 -3
- package/build/crawl/crawl.js +0 -27
- package/build/crawl/crawlEnglish.d.ts +0 -2
- package/build/crawl/crawlEnglish.js +0 -11
- package/build/crawl/crawlFarsi.d.ts +0 -2
- package/build/crawl/crawlFarsi.js +0 -11
- package/build/crawl/crawlFrench.d.ts +0 -2
- package/build/crawl/crawlFrench.js +0 -11
- package/build/crawl/crawlGerman.d.ts +0 -2
- package/build/crawl/crawlGerman.js +0 -11
- package/build/crawl/crawlPolish.d.ts +0 -2
- package/build/crawl/crawlPolish.js +0 -11
- package/build/crawl/crawlRomanian.d.ts +0 -2
- package/build/crawl/crawlRomanian.js +0 -11
- package/build/crawl/crawlSpanish.d.ts +0 -2
- package/build/crawl/crawlSpanish.js +0 -11
- package/build/crawl/index.d.ts +0 -6
- package/build/crawl/index.js +0 -18
- package/build/parse/index.d.ts +0 -8
- package/build/parse/index.js +0 -22
- package/build/parse/parse.d.ts +0 -4
- package/build/parse/parse.js +0 -32
- package/build/parse/parseEnglish.d.ts +0 -3
- package/build/parse/parseEnglish.js +0 -18
- package/build/parse/parseFarsi.d.ts +0 -3
- package/build/parse/parseFarsi.js +0 -13
- package/build/parse/parseFrench.d.ts +0 -3
- package/build/parse/parseFrench.js +0 -12
- package/build/parse/parseGerman.d.ts +0 -3
- package/build/parse/parseGerman.js +0 -60
- package/build/parse/parsePolish.d.ts +0 -3
- package/build/parse/parsePolish.js +0 -14
- package/build/parse/parseRomanian.d.ts +0 -3
- package/build/parse/parseRomanian.js +0 -16
- package/build/parse/parseSpanish.d.ts +0 -3
- package/build/parse/parseSpanish.js +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/word-definitions",
|
|
3
|
-
"version": "2.13.5-alpha.
|
|
3
|
+
"version": "2.13.5-alpha.3",
|
|
4
4
|
"description": "Scrabble Solver 2 - Word definitions",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "rimraf build/"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@scrabble-solver/types": "^2.13.5-alpha.
|
|
26
|
+
"@scrabble-solver/types": "^2.13.5-alpha.3",
|
|
27
27
|
"cheerio": "^1.0.0-rc.12",
|
|
28
28
|
"follow-redirects": "^1.15.5",
|
|
29
29
|
"striptags": "^3.2.0"
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/follow-redirects": "^1.14.4"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "df3cb16543b0664e0acae735b9010f2ff0607784"
|
|
35
35
|
}
|
package/build/crawl/crawl.d.ts
DELETED
package/build/crawl/crawl.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const types_1 = require("@scrabble-solver/types");
|
|
7
|
-
const crawlEnglish_1 = __importDefault(require("./crawlEnglish"));
|
|
8
|
-
const crawlFarsi_1 = __importDefault(require("./crawlFarsi"));
|
|
9
|
-
const crawlFrench_1 = __importDefault(require("./crawlFrench"));
|
|
10
|
-
const crawlGerman_1 = __importDefault(require("./crawlGerman"));
|
|
11
|
-
const crawlPolish_1 = __importDefault(require("./crawlPolish"));
|
|
12
|
-
const crawlRomanian_1 = __importDefault(require("./crawlRomanian"));
|
|
13
|
-
const crawlSpanish_1 = __importDefault(require("./crawlSpanish"));
|
|
14
|
-
const crawlPerLocale = {
|
|
15
|
-
[types_1.Locale.DE_DE]: crawlGerman_1.default,
|
|
16
|
-
[types_1.Locale.EN_GB]: crawlEnglish_1.default,
|
|
17
|
-
[types_1.Locale.EN_US]: crawlEnglish_1.default,
|
|
18
|
-
[types_1.Locale.ES_ES]: crawlSpanish_1.default,
|
|
19
|
-
[types_1.Locale.FA_IR]: crawlFarsi_1.default,
|
|
20
|
-
[types_1.Locale.FR_FR]: crawlFrench_1.default,
|
|
21
|
-
[types_1.Locale.PL_PL]: crawlPolish_1.default,
|
|
22
|
-
[types_1.Locale.RO_RO]: crawlRomanian_1.default,
|
|
23
|
-
};
|
|
24
|
-
const crawl = (locale, word) => {
|
|
25
|
-
return crawlPerLocale[locale](word);
|
|
26
|
-
};
|
|
27
|
-
exports.default = crawl;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const crawlEnglish = (word) => {
|
|
5
|
-
return (0, lib_1.request)({
|
|
6
|
-
protocol: 'https',
|
|
7
|
-
hostname: 'www.merriam-webster.com',
|
|
8
|
-
path: `/dictionary/${encodeURIComponent(word)}`,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.default = crawlEnglish;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const crawlFarsi = (word) => {
|
|
5
|
-
return (0, lib_1.request)({
|
|
6
|
-
protocol: 'https',
|
|
7
|
-
hostname: 'www.vajehyab.com',
|
|
8
|
-
path: `/moein/${encodeURIComponent(word)}`,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.default = crawlFarsi;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const crawlFrench = (word) => {
|
|
5
|
-
return (0, lib_1.request)({
|
|
6
|
-
protocol: 'https',
|
|
7
|
-
hostname: 'www.cnrtl.fr',
|
|
8
|
-
path: `/definition/${encodeURIComponent(word)}`,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.default = crawlFrench;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const crawlGerman = (word) => {
|
|
5
|
-
return (0, lib_1.request)({
|
|
6
|
-
protocol: 'https',
|
|
7
|
-
hostname: 'www.dwds.de',
|
|
8
|
-
path: `/wb/${encodeURIComponent(word)}`,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.default = crawlGerman;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const crawlPolish = (word) => {
|
|
5
|
-
return (0, lib_1.request)({
|
|
6
|
-
protocol: 'https',
|
|
7
|
-
hostname: 'sjp.pl',
|
|
8
|
-
path: `/${encodeURIComponent(word)}`,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.default = crawlPolish;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const crawlRomanian = (word) => {
|
|
5
|
-
return (0, lib_1.request)({
|
|
6
|
-
protocol: 'https',
|
|
7
|
-
hostname: 'dexonline.ro',
|
|
8
|
-
path: `/definitie/${encodeURIComponent(word)}`,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.default = crawlRomanian;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const crawlSpanish = (word) => {
|
|
5
|
-
return (0, lib_1.request)({
|
|
6
|
-
protocol: 'https',
|
|
7
|
-
hostname: 'www.diccionarios.com',
|
|
8
|
-
path: `/diccionario/espanol/${encodeURIComponent(word)}`,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.default = crawlSpanish;
|
package/build/crawl/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as crawl } from './crawl';
|
|
2
|
-
export { default as crawlEnglish } from './crawlEnglish';
|
|
3
|
-
export { default as crawlFrench } from './crawlFrench';
|
|
4
|
-
export { default as crawlPolish } from './crawlPolish';
|
|
5
|
-
export { default as crawlSpanish } from './crawlSpanish';
|
|
6
|
-
export { default as crawlGerman } from './crawlGerman';
|
package/build/crawl/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.crawlGerman = exports.crawlSpanish = exports.crawlPolish = exports.crawlFrench = exports.crawlEnglish = exports.crawl = void 0;
|
|
7
|
-
var crawl_1 = require("./crawl");
|
|
8
|
-
Object.defineProperty(exports, "crawl", { enumerable: true, get: function () { return __importDefault(crawl_1).default; } });
|
|
9
|
-
var crawlEnglish_1 = require("./crawlEnglish");
|
|
10
|
-
Object.defineProperty(exports, "crawlEnglish", { enumerable: true, get: function () { return __importDefault(crawlEnglish_1).default; } });
|
|
11
|
-
var crawlFrench_1 = require("./crawlFrench");
|
|
12
|
-
Object.defineProperty(exports, "crawlFrench", { enumerable: true, get: function () { return __importDefault(crawlFrench_1).default; } });
|
|
13
|
-
var crawlPolish_1 = require("./crawlPolish");
|
|
14
|
-
Object.defineProperty(exports, "crawlPolish", { enumerable: true, get: function () { return __importDefault(crawlPolish_1).default; } });
|
|
15
|
-
var crawlSpanish_1 = require("./crawlSpanish");
|
|
16
|
-
Object.defineProperty(exports, "crawlSpanish", { enumerable: true, get: function () { return __importDefault(crawlSpanish_1).default; } });
|
|
17
|
-
var crawlGerman_1 = require("./crawlGerman");
|
|
18
|
-
Object.defineProperty(exports, "crawlGerman", { enumerable: true, get: function () { return __importDefault(crawlGerman_1).default; } });
|
package/build/parse/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as parse } from './parse';
|
|
2
|
-
export { default as parseEnglish } from './parseEnglish';
|
|
3
|
-
export { default as parseFarsi } from './parseFarsi';
|
|
4
|
-
export { default as parseFrench } from './parseFrench';
|
|
5
|
-
export { default as parseGerman } from './parseGerman';
|
|
6
|
-
export { default as parsePolish } from './parsePolish';
|
|
7
|
-
export { default as parseRomanian } from './parseRomanian';
|
|
8
|
-
export { default as parseSpanish } from './parseSpanish';
|
package/build/parse/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseSpanish = exports.parseRomanian = exports.parsePolish = exports.parseGerman = exports.parseFrench = exports.parseFarsi = exports.parseEnglish = exports.parse = void 0;
|
|
7
|
-
var parse_1 = require("./parse");
|
|
8
|
-
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return __importDefault(parse_1).default; } });
|
|
9
|
-
var parseEnglish_1 = require("./parseEnglish");
|
|
10
|
-
Object.defineProperty(exports, "parseEnglish", { enumerable: true, get: function () { return __importDefault(parseEnglish_1).default; } });
|
|
11
|
-
var parseFarsi_1 = require("./parseFarsi");
|
|
12
|
-
Object.defineProperty(exports, "parseFarsi", { enumerable: true, get: function () { return __importDefault(parseFarsi_1).default; } });
|
|
13
|
-
var parseFrench_1 = require("./parseFrench");
|
|
14
|
-
Object.defineProperty(exports, "parseFrench", { enumerable: true, get: function () { return __importDefault(parseFrench_1).default; } });
|
|
15
|
-
var parseGerman_1 = require("./parseGerman");
|
|
16
|
-
Object.defineProperty(exports, "parseGerman", { enumerable: true, get: function () { return __importDefault(parseGerman_1).default; } });
|
|
17
|
-
var parsePolish_1 = require("./parsePolish");
|
|
18
|
-
Object.defineProperty(exports, "parsePolish", { enumerable: true, get: function () { return __importDefault(parsePolish_1).default; } });
|
|
19
|
-
var parseRomanian_1 = require("./parseRomanian");
|
|
20
|
-
Object.defineProperty(exports, "parseRomanian", { enumerable: true, get: function () { return __importDefault(parseRomanian_1).default; } });
|
|
21
|
-
var parseSpanish_1 = require("./parseSpanish");
|
|
22
|
-
Object.defineProperty(exports, "parseSpanish", { enumerable: true, get: function () { return __importDefault(parseSpanish_1).default; } });
|
package/build/parse/parse.d.ts
DELETED
package/build/parse/parse.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const types_1 = require("@scrabble-solver/types");
|
|
7
|
-
const lib_1 = require("../lib");
|
|
8
|
-
const parseEnglish_1 = __importDefault(require("./parseEnglish"));
|
|
9
|
-
const parseFarsi_1 = __importDefault(require("./parseFarsi"));
|
|
10
|
-
const parseFrench_1 = __importDefault(require("./parseFrench"));
|
|
11
|
-
const parseGerman_1 = __importDefault(require("./parseGerman"));
|
|
12
|
-
const parsePolish_1 = __importDefault(require("./parsePolish"));
|
|
13
|
-
const parseRomanian_1 = __importDefault(require("./parseRomanian"));
|
|
14
|
-
const parseSpanish_1 = __importDefault(require("./parseSpanish"));
|
|
15
|
-
const parsePerLocale = {
|
|
16
|
-
[types_1.Locale.DE_DE]: parseGerman_1.default,
|
|
17
|
-
[types_1.Locale.EN_GB]: parseEnglish_1.default,
|
|
18
|
-
[types_1.Locale.EN_US]: parseEnglish_1.default,
|
|
19
|
-
[types_1.Locale.ES_ES]: parseSpanish_1.default,
|
|
20
|
-
[types_1.Locale.FA_IR]: parseFarsi_1.default,
|
|
21
|
-
[types_1.Locale.FR_FR]: parseFrench_1.default,
|
|
22
|
-
[types_1.Locale.PL_PL]: parsePolish_1.default,
|
|
23
|
-
[types_1.Locale.RO_RO]: parseRomanian_1.default,
|
|
24
|
-
};
|
|
25
|
-
const parse = (locale, html) => {
|
|
26
|
-
const { definitions, exists } = parsePerLocale[locale](html);
|
|
27
|
-
return {
|
|
28
|
-
definitions: (0, lib_1.unique)(definitions.map(lib_1.normalizeDefinition).filter(Boolean)),
|
|
29
|
-
exists,
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.default = parse;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cheerio_1 = require("cheerio");
|
|
4
|
-
const DOES_NOT_EXIST_MESSAGE =
|
|
5
|
-
// eslint-disable-next-line max-len
|
|
6
|
-
"The word you've entered isn't in the dictionary. Click on a spelling suggestion below or try again using the search bar above.";
|
|
7
|
-
const parseEnglish = (html) => {
|
|
8
|
-
const $ = (0, cheerio_1.load)(html);
|
|
9
|
-
$('strong.mw_t_bc').replaceWith(', ');
|
|
10
|
-
$('.text-lowercase').remove();
|
|
11
|
-
$('.sub-content-thread').remove();
|
|
12
|
-
const $definitions = $('[id^=dictionary-entry]').find('.dtText, .cxl-ref');
|
|
13
|
-
return {
|
|
14
|
-
definitions: Array.from($definitions).map((definition) => $(definition).text().replace(/\n/g, '')),
|
|
15
|
-
exists: $('.spelling-suggestion-text').text().trim() !== DOES_NOT_EXIST_MESSAGE,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
exports.default = parseEnglish;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cheerio_1 = require("cheerio");
|
|
4
|
-
const DOES_NOT_EXIST_MESSAGE = '404 Page Not Found';
|
|
5
|
-
const parseFarsi = (html) => {
|
|
6
|
-
const $ = (0, cheerio_1.load)(html);
|
|
7
|
-
const $definitions = $('[itemprop=articleBody]');
|
|
8
|
-
return {
|
|
9
|
-
definitions: Array.from($definitions).map((definition) => $(definition).text()),
|
|
10
|
-
exists: $('#container h1').text() !== DOES_NOT_EXIST_MESSAGE,
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
exports.default = parseFarsi;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cheerio_1 = require("cheerio");
|
|
4
|
-
const parseFrench = (html) => {
|
|
5
|
-
const $ = (0, cheerio_1.load)(html);
|
|
6
|
-
const $definitions = $('.tlf_cdefinition');
|
|
7
|
-
return {
|
|
8
|
-
definitions: Array.from($definitions).map((definition) => $(definition).text()),
|
|
9
|
-
exists: $('#vitemselected span').length > 0,
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
exports.default = parseFrench;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cheerio_1 = require("cheerio");
|
|
4
|
-
const parseGerman = (html) => {
|
|
5
|
-
const $ = (0, cheerio_1.load)(html);
|
|
6
|
-
const definitions = [parseBedeutungsubersicht, parseBedeutungen, parseBedeutung].reduce((results, parse) => (results.length === 0 ? parse($) : results), []);
|
|
7
|
-
const exists = Array.from($('.label-danger')).every((label) => $(label).text() !== 'Hinweis');
|
|
8
|
-
return { definitions, exists };
|
|
9
|
-
};
|
|
10
|
-
const parseBedeutungsubersicht = ($) => {
|
|
11
|
-
Array.from($('.bedeutungsuebersicht ol > li > a')).forEach((item) => {
|
|
12
|
-
$(item).text($(item).text().replace(/\n/g, ''));
|
|
13
|
-
});
|
|
14
|
-
Array.from($('.bedeutungsuebersicht ol > li > ol > li')).forEach((item) => {
|
|
15
|
-
const text = `\n${$(item).text().replace(/\n/g, '')}`;
|
|
16
|
-
const $text = $(`<div>${text}</div>`);
|
|
17
|
-
$(item).replaceWith($text);
|
|
18
|
-
});
|
|
19
|
-
Array.from($('.bedeutungsuebersicht ol > li > ol')).forEach((list) => {
|
|
20
|
-
const $list = $(list);
|
|
21
|
-
const html = $list.html() || '';
|
|
22
|
-
const $html = $(`<div>${html}</div>`);
|
|
23
|
-
const $prev = $list.prev('a');
|
|
24
|
-
if ($prev) {
|
|
25
|
-
$prev.append($html);
|
|
26
|
-
$(list).remove();
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
$(list).replaceWith($html);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return parseDefinitions($, $('.bedeutungsuebersicht ol > li'));
|
|
33
|
-
};
|
|
34
|
-
const parseBedeutung = ($) => {
|
|
35
|
-
return parseDefinitions($, $('.dwdswb-lesart .dwdswb-definition-spezifizierung'));
|
|
36
|
-
};
|
|
37
|
-
const parseBedeutungen = ($) => {
|
|
38
|
-
const definitions = parseDefinitions($, $('.dwdswb-lesart .dwdswb-definition'));
|
|
39
|
-
if (definitions.length > 0) {
|
|
40
|
-
return definitions;
|
|
41
|
-
}
|
|
42
|
-
const $references = $('.dwdswb-lesart .dwdswb-verweis');
|
|
43
|
-
const references = Array.from($references).reduce((result, reference) => {
|
|
44
|
-
const html = reference.attribs['data-content'] || '<span />';
|
|
45
|
-
const values = $(html)
|
|
46
|
-
.text()
|
|
47
|
-
.split(';')
|
|
48
|
-
.map((value) => value.trim());
|
|
49
|
-
return result.concat(values);
|
|
50
|
-
}, []);
|
|
51
|
-
return references;
|
|
52
|
-
};
|
|
53
|
-
const parseDefinitions = ($, $definitions) => {
|
|
54
|
-
return Array.from($definitions).map((definition) => $(definition)
|
|
55
|
-
.text()
|
|
56
|
-
.replace(/[ ]+/g, ' ')
|
|
57
|
-
.replace(/[ ]\n/g, '\n')
|
|
58
|
-
.replace(/^[0-9]+\.\s/g, ''));
|
|
59
|
-
};
|
|
60
|
-
exports.default = parseGerman;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cheerio_1 = require("cheerio");
|
|
4
|
-
const parsePolish = (html) => {
|
|
5
|
-
const $ = (0, cheerio_1.load)(html);
|
|
6
|
-
const $header = $($('h1')[0]);
|
|
7
|
-
const $isAllowed = $header.next();
|
|
8
|
-
const $definitions = $header.next().next().next().next();
|
|
9
|
-
return {
|
|
10
|
-
definitions: $definitions.text().trim().split(/\d+\./),
|
|
11
|
-
exists: $isAllowed.text().trim().indexOf('dopuszczalne w grach') >= 0,
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
exports.default = parsePolish;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cheerio_1 = require("cheerio");
|
|
4
|
-
const parseRomanian = (html) => {
|
|
5
|
-
const $ = (0, cheerio_1.load)(html);
|
|
6
|
-
const $activeTab = $('.tab-pane.show.active');
|
|
7
|
-
$('.type-example').remove();
|
|
8
|
-
const $definitions = $activeTab.find('li.type-meaning.depth-0 > .meaningContainer .def.html');
|
|
9
|
-
$definitions.find('.meaningTree').remove();
|
|
10
|
-
const definitions = Array.from($definitions).map((definition) => $(definition).text().replace(/\n/g, ''));
|
|
11
|
-
return {
|
|
12
|
-
definitions,
|
|
13
|
-
exists: definitions.length > 0,
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
exports.default = parseRomanian;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cheerio_1 = require("cheerio");
|
|
4
|
-
const parseSpanish = (html) => {
|
|
5
|
-
const $ = (0, cheerio_1.load)(html);
|
|
6
|
-
$('.verdBold14 + .gris11 + .gris13').remove();
|
|
7
|
-
$('br + .gris13').remove();
|
|
8
|
-
$('.grisItalic13 + .gris13').remove();
|
|
9
|
-
$('font[class^="verd"]').remove();
|
|
10
|
-
$('font.gris11').remove();
|
|
11
|
-
$('font[class^="grisBold"]').remove();
|
|
12
|
-
$('font[class^="grisItalic"]').remove();
|
|
13
|
-
Array.from($('.gris13')).forEach((element) => {
|
|
14
|
-
const children = $(element).find('.gris13');
|
|
15
|
-
if (children && children.length > 0) {
|
|
16
|
-
children.remove();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const definitions = Array.from($('.dcom-search-result .gris13'));
|
|
20
|
-
return {
|
|
21
|
-
definitions: definitions
|
|
22
|
-
.map((definition) => $(definition).text().trim())
|
|
23
|
-
.filter(Boolean)
|
|
24
|
-
.map((definition) => definition.replace(/\s+\.$/g, ''))
|
|
25
|
-
.map((definition) => (definition.endsWith('.') ? definition : `${definition}.`)),
|
|
26
|
-
exists: $('.wrapper > p > strong').text() !== 'No se ha encontrado la palabra exacta',
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
exports.default = parseSpanish;
|