scrabble-solver 2.9.1 → 2.9.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.
Files changed (119) hide show
  1. package/.eslintrc.js +8 -1
  2. package/LICENSE +1 -1
  3. package/README.md +82 -34
  4. package/lerna.json +1 -1
  5. package/package.json +4 -4
  6. package/packages/configs/package.json +5 -5
  7. package/packages/constants/package.json +3 -3
  8. package/packages/dictionaries/package-lock.json +2 -2
  9. package/packages/dictionaries/package.json +6 -6
  10. package/packages/logger/package-lock.json +2 -2
  11. package/packages/logger/package.json +3 -3
  12. package/packages/scrabble-solver/.next/BUILD_ID +1 -1
  13. package/packages/scrabble-solver/.next/build-manifest.json +9 -9
  14. package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
  15. package/packages/scrabble-solver/.next/cache/eslint/.cache_8dgz12 +1 -1
  16. package/packages/scrabble-solver/.next/cache/next-server.js.nft.json +1 -1
  17. package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
  18. package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
  19. package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/0.pack +0 -0
  20. package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
  21. package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
  22. package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
  23. package/packages/scrabble-solver/.next/next-server.js.nft.json +1 -1
  24. package/packages/scrabble-solver/.next/prerender-manifest.json +1 -1
  25. package/packages/scrabble-solver/.next/required-server-files.json +1 -1
  26. package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
  27. package/packages/scrabble-solver/.next/server/chunks/413.js +6 -2
  28. package/packages/scrabble-solver/.next/server/chunks/44.js +894 -3
  29. package/packages/scrabble-solver/.next/server/chunks/515.js +119 -27
  30. package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
  31. package/packages/scrabble-solver/.next/server/pages/404.html +2 -2
  32. package/packages/scrabble-solver/.next/server/pages/404.js.nft.json +1 -1
  33. package/packages/scrabble-solver/.next/server/pages/500.html +2 -2
  34. package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
  35. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +121 -65
  36. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
  37. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +1 -1
  38. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
  39. package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -1
  40. package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
  41. package/packages/scrabble-solver/.next/server/pages/api/verify.js +1 -1
  42. package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
  43. package/packages/scrabble-solver/.next/server/pages/index.html +1 -13
  44. package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
  45. package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
  46. package/packages/scrabble-solver/.next/static/chunks/880-18e3aea6915aebe7.js +1 -0
  47. package/packages/scrabble-solver/.next/static/chunks/pages/{404-7082923654d5996f.js → 404-8650986dc56dab75.js} +1 -1
  48. package/packages/scrabble-solver/.next/static/chunks/pages/{_app-10893b318367f97c.js → _app-183f598b1d4d480b.js} +1 -1
  49. package/packages/scrabble-solver/.next/static/chunks/pages/index-f1cef1e67e14d022.js +1 -0
  50. package/packages/scrabble-solver/.next/static/css/e8de67ad5ea35427.css +1 -0
  51. package/packages/scrabble-solver/.next/static/s5pE_3C3ebZuSfaqE7xat/_buildManifest.js +1 -0
  52. package/packages/scrabble-solver/.next/static/{Oki2Ia4sgLw021iM7byAe → s5pE_3C3ebZuSfaqE7xat}/_ssgManifest.js +0 -0
  53. package/packages/scrabble-solver/.next/trace +52 -52
  54. package/packages/scrabble-solver/package-lock.json +2 -2
  55. package/packages/scrabble-solver/package.json +10 -10
  56. package/packages/scrabble-solver/src/components/Dictionary/Dictionary.module.scss +1 -0
  57. package/packages/scrabble-solver/src/components/Dictionary/Dictionary.tsx +7 -2
  58. package/packages/scrabble-solver/src/components/Logo/Logo.svg +62 -0
  59. package/packages/scrabble-solver/src/components/Logo/index.ts +1 -1
  60. package/packages/scrabble-solver/src/i18n/en.json +2 -2
  61. package/packages/scrabble-solver/src/pages/api/dictionary/[locale]/[word].ts +3 -1
  62. package/packages/solver/package-lock.json +2 -2
  63. package/packages/solver/package.json +7 -7
  64. package/packages/types/build/WordDefinition.d.ts +8 -5
  65. package/packages/types/build/WordDefinition.js +5 -1
  66. package/packages/types/build/WordDefinitionJson.d.ts +7 -0
  67. package/packages/types/package.json +4 -4
  68. package/packages/types/src/WordDefinition.ts +13 -1
  69. package/packages/types/src/WordDefinitionJson.ts +7 -0
  70. package/packages/word-definitions/build/getWordDefinition.d.ts +1 -1
  71. package/packages/word-definitions/build/getWordDefinition.js +3 -3
  72. package/packages/word-definitions/build/lib/normalizeDefinition.js +3 -1
  73. package/packages/word-definitions/build/parse/parse.js +2 -2
  74. package/packages/word-definitions/build/parse/parseEnglish.js +7 -7
  75. package/packages/word-definitions/build/parse/parseFrench.js +3 -6
  76. package/packages/word-definitions/build/parse/parseGerman.js +54 -16
  77. package/packages/word-definitions/build/parse/parsePolish.js +3 -6
  78. package/packages/word-definitions/build/parse/parseSpanish.js +3 -6
  79. package/packages/word-definitions/build/types.d.ts +1 -1
  80. package/packages/word-definitions/package-lock.json +8 -8
  81. package/packages/word-definitions/package.json +4 -4
  82. package/packages/word-definitions/src/getWordDefinition.ts +3 -3
  83. package/packages/word-definitions/src/lib/normalizeDefinition.ts +4 -1
  84. package/packages/word-definitions/src/parse/__tests__/expected/de-DE.hm.json +4 -0
  85. package/packages/word-definitions/src/parse/__tests__/expected/de-DE.ho.json +9 -0
  86. package/packages/word-definitions/src/parse/__tests__/expected/de-DE.kolla.json +4 -0
  87. package/packages/word-definitions/src/parse/__tests__/expected/de-DE.vom.json +16 -0
  88. package/packages/word-definitions/src/parse/__tests__/expected/en-US.awe.json +1 -1
  89. package/packages/word-definitions/src/parse/__tests__/expected/en-US.pawn.json +1 -1
  90. package/packages/word-definitions/src/parse/__tests__/expected/en-US.pawnee.json +1 -1
  91. package/packages/word-definitions/src/parse/__tests__/expected/en-US.pean.json +1 -1
  92. package/packages/word-definitions/src/parse/__tests__/expected/en-US.wiz.json +1 -1
  93. package/packages/word-definitions/src/parse/__tests__/expected/es-ES.corma.json +1 -1
  94. package/packages/word-definitions/src/parse/__tests__/expected/es-ES.portero.json +1 -1
  95. package/packages/word-definitions/src/parse/__tests__/input/de-DE.hm.html +873 -0
  96. package/packages/word-definitions/src/parse/__tests__/input/de-DE.ho.html +1144 -0
  97. package/packages/word-definitions/src/parse/__tests__/input/de-DE.kolla.html +980 -0
  98. package/packages/word-definitions/src/parse/__tests__/input/de-DE.vom.html +738 -0
  99. package/packages/word-definitions/src/parse/parse.test.ts +4 -0
  100. package/packages/word-definitions/src/parse/parse.ts +2 -2
  101. package/packages/word-definitions/src/parse/parseEnglish.ts +8 -4
  102. package/packages/word-definitions/src/parse/parseFrench.ts +3 -3
  103. package/packages/word-definitions/src/parse/parseGerman.ts +71 -12
  104. package/packages/word-definitions/src/parse/parsePolish.ts +3 -3
  105. package/packages/word-definitions/src/parse/parseSpanish.ts +3 -3
  106. package/packages/word-definitions/src/types.ts +1 -1
  107. package/packages/word-lists/build/getDeDeWordList.js +1 -1
  108. package/packages/word-lists/build/getPlPlWordList.js +2 -2
  109. package/packages/word-lists/package-lock.json +2 -2
  110. package/packages/word-lists/package.json +4 -4
  111. package/packages/word-lists/src/getDeDeWordList.ts +1 -1
  112. package/packages/word-lists/src/getPlPlWordList.ts +2 -2
  113. package/img/logo.png +0 -0
  114. package/packages/scrabble-solver/.next/server/chunks/452.js +0 -894
  115. package/packages/scrabble-solver/.next/static/Oki2Ia4sgLw021iM7byAe/_buildManifest.js +0 -1
  116. package/packages/scrabble-solver/.next/static/chunks/317-e7d5d859f1f95938.js +0 -1
  117. package/packages/scrabble-solver/.next/static/chunks/pages/index-b1ffeaddd9fb64b5.js +0 -1
  118. package/packages/scrabble-solver/.next/static/css/e3d218f4ea72c5fb.css +0 -1
  119. package/packages/scrabble-solver/public/robots.txt +0 -4
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@scrabble-solver/scrabble-solver",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@scrabble-solver/scrabble-solver",
9
- "version": "2.9.1",
9
+ "version": "2.9.3",
10
10
  "license": "CC BY-NC-ND 4.0",
11
11
  "dependencies": {
12
12
  "@kamilmielnik/trie": "^2.0.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/scrabble-solver",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "Scrabble Solver 2 - App",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "author": {
13
13
  "name": "Kamil Mielnik",
14
- "email": "kamil.adam.mielnik@gmail.com",
15
- "url": "https://kamilmielnik.com/"
14
+ "email": "kamil@kamilmielnik.com",
15
+ "url": "https://kamilmielnik.com"
16
16
  },
17
17
  "license": "CC BY-NC-ND 4.0",
18
18
  "bugs": {
@@ -31,13 +31,13 @@
31
31
  "@kamilmielnik/trie": "^2.0.1",
32
32
  "@popperjs/core": "^2.11.6",
33
33
  "@reduxjs/toolkit": "^1.8.6",
34
- "@scrabble-solver/configs": "^2.9.1",
35
- "@scrabble-solver/constants": "^2.9.1",
36
- "@scrabble-solver/dictionaries": "^2.9.1",
37
- "@scrabble-solver/logger": "^2.9.1",
38
- "@scrabble-solver/solver": "^2.9.1",
39
- "@scrabble-solver/types": "^2.9.1",
40
- "@scrabble-solver/word-definitions": "^2.9.1",
34
+ "@scrabble-solver/configs": "^2.9.3",
35
+ "@scrabble-solver/constants": "^2.9.3",
36
+ "@scrabble-solver/dictionaries": "^2.9.3",
37
+ "@scrabble-solver/logger": "^2.9.3",
38
+ "@scrabble-solver/solver": "^2.9.3",
39
+ "@scrabble-solver/types": "^2.9.3",
40
+ "@scrabble-solver/word-definitions": "^2.9.3",
41
41
  "classnames": "^2.3.2",
42
42
  "next": "^12.3.1",
43
43
  "normalize.css": "^8.0.1",
@@ -53,6 +53,7 @@
53
53
 
54
54
  .definition {
55
55
  margin-bottom: var(--spacing--s);
56
+ white-space: pre-wrap;
56
57
 
57
58
  &:last-child {
58
59
  margin-bottom: 0;
@@ -31,7 +31,7 @@ const Dictionary: FunctionComponent<Props> = ({ className }) => {
31
31
  </EmptyState>
32
32
  )}
33
33
 
34
- {results.map(({ definitions, isAllowed, word }) => (
34
+ {results.map(({ definitions, exists, isAllowed, word }) => (
35
35
  <div
36
36
  className={classNames(styles.result, {
37
37
  [styles.isAllowed]: isAllowed === true,
@@ -51,7 +51,12 @@ const Dictionary: FunctionComponent<Props> = ({ className }) => {
51
51
 
52
52
  {isAllowed === true && (
53
53
  <>
54
- {definitions.length === 0 && <div>{translate('dictionary.empty-state.no-definitions')}</div>}
54
+ {definitions.length === 0 && (
55
+ <>
56
+ {exists && <div>{translate('dictionary.empty-state.no-definitions')}</div>}
57
+ {!exists && <div>{translate('dictionary.empty-state.no-results')}</div>}
58
+ </>
59
+ )}
55
60
 
56
61
  {definitions.length > 0 && (
57
62
  <ul className={styles.definitions}>
@@ -0,0 +1,62 @@
1
+ <svg viewBox="0 0 682 166" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
2
+ <g transform="rotate(0, 40, 40)">
3
+ <path fill="#efe3ae" d="M 0,0 H 80 V 80 H 0 Z" />
4
+ <path aria-label="S" d="m 51.167969,47.628907 q 0,3.046875 -1.476563,5.296875 -1.476562,2.25 -4.3125,3.46875 -2.8125,1.21875 -6.84375,1.21875 -1.78125,0 -3.492187,-0.234375 -1.6875,-0.234375 -3.257813,-0.679687 -1.546875,-0.46875 -2.953125,-1.148438 v -6.75 q 2.4375,1.078125 5.0625,1.945313 2.625,0.867187 5.203125,0.867187 1.78125,0 2.859375,-0.46875 1.101563,-0.46875 1.59375,-1.289062 0.492188,-0.820313 0.492188,-1.875 0,-1.289063 -0.867188,-2.203125 -0.867187,-0.914063 -2.390625,-1.710938 -1.5,-0.796875 -3.398437,-1.710937 -1.195313,-0.5625 -2.601563,-1.359375 -1.40625,-0.820313 -2.671875,-1.992188 -1.265625,-1.171875 -2.085937,-2.835937 -0.796875,-1.6875 -0.796875,-4.03125 0,-3.070313 1.40625,-5.25 1.40625,-2.179688 4.007812,-3.328125 2.625,-1.171875 6.1875,-1.171875 2.671875,0 5.085938,0.632812 2.4375,0.609375 5.085937,1.78125 l -2.34375,5.648438 q -2.367187,-0.960938 -4.242187,-1.476563 -1.875,-0.539062 -3.820313,-0.539062 -1.359375,0 -2.320312,0.445312 -0.960938,0.421875 -1.453125,1.21875 -0.492188,0.773438 -0.492188,1.804688 0,1.21875 0.703125,2.0625 0.726563,0.820312 2.15625,1.59375 1.453125,0.773437 3.609375,1.804687 2.625,1.242188 4.476563,2.601563 1.875,1.335937 2.882812,3.164062 1.007813,1.804688 1.007813,4.5 z" />
5
+ </g>
6
+ <g transform="rotate(0, 126, 40)">
7
+ <path fill="#c7d8f9" d="m 86,0 h 80 V 80 H 86 Z" />
8
+ <path aria-label="C" d="m 129.57422,28.433595 q -2.08594,0 -3.70313,0.820312 -1.59375,0.796875 -2.69531,2.320313 -1.07812,1.523437 -1.64062,3.679687 -0.5625,2.15625 -0.5625,4.851563 0,3.632812 0.89062,6.210937 0.91406,2.554688 2.8125,3.914063 1.89844,1.335937 4.89844,1.335937 2.08594,0 4.17187,-0.46875 2.10938,-0.46875 4.57032,-1.335937 v 6.09375 q -2.27344,0.9375 -4.47657,1.335937 -2.20312,0.421875 -4.94531,0.421875 -5.29687,0 -8.71875,-2.179687 -3.39844,-2.203125 -5.03906,-6.140625 -1.64063,-3.960938 -1.64063,-9.234375 0,-3.890625 1.05469,-7.125 1.05469,-3.234375 3.09375,-5.601563 2.03906,-2.367187 5.03906,-3.65625 3,-1.289062 6.89063,-1.289062 2.55469,0 5.10937,0.65625 2.57813,0.632812 4.92188,1.757812 l -2.34375,5.90625 q -1.92188,-0.914062 -3.86719,-1.59375 -1.94531,-0.679687 -3.82031,-0.679687 z" />
9
+ </g>
10
+ <g transform="rotate(0, 212, 40)">
11
+ <path fill="#efe3ae" d="m 172,0 h 80 v 80 h -80 z" />
12
+ <path aria-label="R" d="m 210.45312,22.867188 q 4.66407,0 7.6875,1.125 3.04688,1.125 4.52344,3.398438 1.47656,2.273437 1.47656,5.742187 0,2.34375 -0.89062,4.101563 -0.89063,1.757812 -2.34375,2.976562 -1.45313,1.21875 -3.14063,1.992188 l 10.07813,14.929687 h -8.0625 l -8.17969,-13.148437 h -3.86719 v 13.148437 h -7.26562 V 22.867188 Z m -0.51562,5.953125 h -2.20313 v 9.257813 h 2.34375 q 3.60938,0 5.15625,-1.195313 1.57032,-1.21875 1.57032,-3.5625 0,-2.4375 -1.6875,-3.46875 -1.66407,-1.03125 -5.17969,-1.03125 z" />
13
+ </g>
14
+ <g transform="rotate(0, 298, 40)">
15
+ <path fill="#efe3ae" d="m 258,0 h 80 v 80 h -80 z" />
16
+ <path aria-label="A" d="m 306.73047,57.203126 -2.48438,-8.15625 h -12.49218 l -2.48438,8.15625 h -7.82812 l 12.09375,-34.40625 h 8.88281 l 12.14062,34.40625 z m -4.21875,-14.25 -2.48438,-7.96875 q -0.23437,-0.796875 -0.63281,-2.039063 -0.375,-1.265625 -0.77344,-2.554687 -0.375,-1.3125 -0.60937,-2.273438 -0.23438,0.960938 -0.65625,2.390625 -0.39844,1.40625 -0.77344,2.671875 -0.375,1.265625 -0.53906,1.804688 l -2.46094,7.96875 z" />
17
+ </g>
18
+ <g transform="rotate(0, 384, 40)">
19
+ <path fill="#c7d8f9" d="m 344,0 h 80 v 80 h -80 z" />
20
+ <path aria-label="B" d="m 372.1875,22.867188 h 10.66406 q 6.84375,0 10.35938,1.921875 3.51562,1.921875 3.51562,6.75 0,1.945313 -0.63281,3.515625 -0.60938,1.570313 -1.78125,2.578125 -1.17188,1.007813 -2.85938,1.3125 v 0.234375 q 1.71094,0.351563 3.09375,1.21875 1.38282,0.84375 2.20313,2.484375 0.84375,1.617188 0.84375,4.3125 0,3.117188 -1.52344,5.34375 -1.52344,2.226563 -4.35937,3.421875 -2.8125,1.171875 -6.70313,1.171875 H 372.1875 Z m 7.26562,13.570313 h 4.21875 q 3.16407,0 4.38282,-0.984375 1.21875,-1.007813 1.21875,-2.953125 0,-1.96875 -1.45313,-2.8125 -1.42969,-0.867188 -4.54687,-0.867188 h -3.82032 z m 0,5.765625 v 8.929687 h 4.73438 q 3.28125,0 4.57031,-1.265625 1.28906,-1.265625 1.28906,-3.398437 0,-1.265625 -0.5625,-2.226563 -0.5625,-0.960937 -1.89843,-1.5 -1.3125,-0.539062 -3.63282,-0.539062 z" />
21
+ </g>
22
+ <g transform="rotate(0, 470, 40)">
23
+ <path fill="#c7d8f9" d="m 430,0 h 80 v 80 h -80 z" />
24
+ <path aria-label="B" d="m 458.1875,22.867188 h 10.66406 q 6.84375,0 10.35938,1.921875 3.51562,1.921875 3.51562,6.75 0,1.945313 -0.63281,3.515625 -0.60938,1.570313 -1.78125,2.578125 -1.17188,1.007813 -2.85938,1.3125 v 0.234375 q 1.71094,0.351563 3.09375,1.21875 1.38282,0.84375 2.20313,2.484375 0.84375,1.617188 0.84375,4.3125 0,3.117188 -1.52344,5.34375 -1.52344,2.226563 -4.35937,3.421875 -2.8125,1.171875 -6.70313,1.171875 H 458.1875 Z m 7.26562,13.570313 h 4.21875 q 3.16407,0 4.38282,-0.984375 1.21875,-1.007813 1.21875,-2.953125 0,-1.96875 -1.45313,-2.8125 -1.42969,-0.867188 -4.54687,-0.867188 h -3.82032 z m 0,5.765625 v 8.929687 h 4.73438 q 3.28125,0 4.57031,-1.265625 1.28906,-1.265625 1.28906,-3.398437 0,-1.265625 -0.5625,-2.226563 -0.5625,-0.960937 -1.89843,-1.5 -1.3125,-0.539062 -3.63282,-0.539062 z" />
25
+ </g>
26
+ <g transform="rotate(0, 556, 40)">
27
+ <path fill="#efe3ae" d="m 516,0 h 80 v 80 h -80 z" />
28
+ <path aria-label="L" d="M 546.75391,57.132813 V 22.867188 h 7.26562 v 28.265625 h 13.89844 v 6 z" />
29
+ </g>
30
+ <g transform="rotate(0, 642, 40)">
31
+ <path fill="#efe3ae" d="m 602,0 h 80 v 80 h -80 z" />
32
+ <path aria-label="E" d="M 652.60547,57.132813 H 632.87109 V 22.867188 h 19.73438 v 5.953125 h -12.46875 v 7.523438 h 11.60156 v 5.953125 h -11.60156 v 8.835937 h 12.46875 z" />
33
+ </g>
34
+ <g transform="rotate(0, 40, 40)">
35
+ <path fill="#efe3ae" d="m 0,86 h 80 v 80 H 0 Z" />
36
+ <path aria-label="S" d="m 51.320312,133.6289 q 0,3.04688 -1.476562,5.29688 -1.476563,2.25 -4.3125,3.46875 -2.8125,1.21875 -6.84375,1.21875 -1.78125,0 -3.492188,-0.23438 -1.6875,-0.23437 -3.257812,-0.67968 -1.546875,-0.46875 -2.953125,-1.14844 v -6.75 q 2.4375,1.07812 5.0625,1.94531 2.625,0.86719 5.203125,0.86719 1.78125,0 2.859375,-0.46875 1.101562,-0.46875 1.59375,-1.28906 0.492187,-0.82032 0.492187,-1.875 0,-1.28907 -0.867187,-2.20313 -0.867188,-0.91406 -2.390625,-1.71094 -1.5,-0.79687 -3.398438,-1.71093 -1.195312,-0.5625 -2.601562,-1.35938 -1.40625,-0.82031 -2.671875,-1.99219 Q 31,123.83203 30.179687,122.16797 q -0.796875,-1.6875 -0.796875,-4.03125 0,-3.07032 1.40625,-5.25 1.40625,-2.17969 4.007813,-3.32813 2.625,-1.17187 6.1875,-1.17187 2.671875,0 5.085937,0.63281 2.4375,0.60937 5.085938,1.78125 l -2.34375,5.64844 q -2.367188,-0.96094 -4.242188,-1.47657 -1.875,-0.53906 -3.820312,-0.53906 -1.359375,0 -2.320313,0.44531 -0.960937,0.42188 -1.453125,1.21875 -0.492187,0.77344 -0.492187,1.80469 0,1.21875 0.703125,2.0625 0.726562,0.82031 2.15625,1.59375 1.453125,0.77344 3.609375,1.80469 2.625,1.24219 4.476562,2.60156 1.875,1.33594 2.882813,3.16406 1.007812,1.80469 1.007812,4.5 z" />
37
+ </g>
38
+ <g transform="rotate(0, 126, 40)">
39
+ <path fill="#efe3ae" d="m 86,86 h 80 v 80 H 86 Z" />
40
+ <path aria-label="O" d="m 142.3125,125.98828 q 0,3.96094 -0.98438,7.21875 -0.98437,3.23437 -3,5.57812 -1.99218,2.34375 -5.0625,3.60938 -3.07031,1.24219 -7.26562,1.24219 -4.19531,0 -7.26562,-1.24219 -3.07032,-1.26563 -5.08594,-3.60938 -1.99219,-2.34375 -2.97656,-5.60156 -0.98438,-3.25781 -0.98438,-7.24219 0,-5.32031 1.73438,-9.25781 1.75781,-3.96094 5.39062,-6.14062 3.63281,-2.17969 9.23438,-2.17969 5.57812,0 9.16406,2.17969 3.60937,2.17968 5.34375,6.14062 1.75781,3.96094 1.75781,9.30469 z m -25.00781,0 q 0,3.58594 0.89062,6.1875 0.91407,2.57812 2.83594,3.98437 1.92188,1.38282 4.96875,1.38282 3.09375,0 5.01562,-1.38282 1.92188,-1.40625 2.78907,-3.98437 0.89062,-2.60156 0.89062,-6.1875 0,-5.39063 -2.01562,-8.48438 -2.01563,-3.09375 -6.63281,-3.09375 -3.07032,0 -5.01563,1.40625 -1.92187,1.38282 -2.83594,3.98438 -0.89062,2.57812 -0.89062,6.1875 z" />
41
+ </g>
42
+ <g transform="rotate(0, 212, 40)">
43
+ <path fill="#efe3ae" d="m 172,86 h 80 v 80 h -80 z" />
44
+ <path aria-label="L" d="m 202.75391,143.13281 v -34.26563 h 7.26562 v 28.26563 h 13.89844 v 6 z" />
45
+ </g>
46
+ <g transform="rotate(0, 298, 40)">
47
+ <path fill="#f7c2aa" d="m 258,86 h 80 v 80 h -80 z" />
48
+ <path aria-label="V" d="m 313.59766,108.86718 -11.64844,34.26563 h -7.92188 l -11.625,-34.26563 h 7.33594 l 6.44531,20.39063 q 0.16407,0.51562 0.53907,1.94531 0.375,1.40625 0.75,3 0.39843,1.57031 0.53906,2.60156 0.14062,-1.03125 0.49219,-2.60156 0.375,-1.57031 0.72656,-2.97656 0.375,-1.42969 0.53906,-1.96875 l 6.49219,-20.39063 z" />
49
+ </g>
50
+ <g transform="rotate(0, 384, 40)">
51
+ <path fill="#efe3ae" d="m 344,86 h 80 v 80 h -80 z" />
52
+ <path aria-label="E" d="m 394.60547,143.13281 h -19.73438 v -34.26563 h 19.73438 v 5.95313 h -12.46875 v 7.52344 h 11.60156 v 5.95312 h -11.60156 v 8.83594 h 12.46875 z" />
53
+ </g>
54
+ <g transform="rotate(0, 470, 40)">
55
+ <path fill="#efe3ae" d="m 430,86 h 80 v 80 h -80 z" />
56
+ <path aria-label="R" d="m 468.45312,108.86718 q 4.66407,0 7.6875,1.125 3.04688,1.125 4.52344,3.39844 1.47656,2.27344 1.47656,5.74219 0,2.34375 -0.89062,4.10156 -0.89063,1.75781 -2.34375,2.97656 -1.45313,1.21875 -3.14063,1.99219 l 10.07813,14.92969 h -8.0625 l -8.17969,-13.14844 h -3.86719 v 13.14844 h -7.26562 v -34.26563 z m -0.51562,5.95313 h -2.20313 v 9.25781 h 2.34375 q 3.60938,0 5.15625,-1.19531 1.57032,-1.21875 1.57032,-3.5625 0,-2.4375 -1.6875,-3.46875 -1.66407,-1.03125 -5.17969,-1.03125 z" />
57
+ </g>
58
+ <g transform="rotate(0, 642, 40)">
59
+ <path fill="#bae3ba" d="m 602,86 h 80 v 80 h -80 z" />
60
+ <path aria-label="2" d="m 654.15234,143.3789 h -23.95312 v -5.03906 l 8.60156,-8.69531 q 2.60156,-2.67188 4.17188,-4.45313 1.59375,-1.80468 2.29687,-3.28125 0.72656,-1.47656 0.72656,-3.16406 0,-2.03906 -1.14843,-3.04687 -1.125,-1.03125 -3.02344,-1.03125 -1.99219,0 -3.86719,0.91406 -1.875,0.91406 -3.91406,2.60156 l -3.9375,-4.66406 q 1.47656,-1.26563 3.11719,-2.39063 1.66406,-1.125 3.84375,-1.80468 2.20312,-0.70313 5.27343,-0.70313 3.375,0 5.78907,1.21875 2.4375,1.21875 3.75,3.32813 1.3125,2.08593 1.3125,4.73437 0,2.83594 -1.125,5.17969 -1.125,2.34375 -3.28125,4.64062 -2.13282,2.29688 -5.15625,5.08594 l -4.40625,4.14844 v 0.32812 h 14.92968 z" />
61
+ </g>
62
+ </svg>
@@ -1 +1 @@
1
- export { default } from './Logo';
1
+ export { default } from './Logo.svg';
@@ -15,9 +15,9 @@
15
15
  "common.word": "Word",
16
16
  "common.words": "Words",
17
17
  "dictionary.empty-state.no-definitions": "Word exists in the dictionary but it does not have a definition.",
18
- "dictionary.empty-state.no-results": "Unable to find word definition in dictionary.",
18
+ "dictionary.empty-state.no-results": "Unable to find word definition in the dictionary.",
19
19
  "dictionary.empty-state.not-allowed": "This word is not allowed.",
20
- "dictionary.empty-state.uninitialized": "Dictionary definition of the last highlighted word will be shown here.",
20
+ "dictionary.empty-state.uninitialized": "Dictionary definition of the most recently highlighted word will be shown here.",
21
21
  "dictionary.input.placeholder": "Search dictionary...",
22
22
  "empty-state.error": "Error",
23
23
  "empty-state.info": "Info",
@@ -1,4 +1,5 @@
1
1
  import { scrabble } from '@scrabble-solver/configs';
2
+ import { dictionaries } from '@scrabble-solver/dictionaries';
2
3
  import logger from '@scrabble-solver/logger';
3
4
  import { isLocale, Locale } from '@scrabble-solver/types';
4
5
  import { getWordDefinition } from '@scrabble-solver/word-definitions';
@@ -27,7 +28,8 @@ const dictionary = async (request: NextApiRequest, response: NextApiResponse): P
27
28
  },
28
29
  });
29
30
 
30
- const results = await Promise.all(words.map((word) => getWordDefinition(locale, word)));
31
+ const trie = await dictionaries.get(locale);
32
+ const results = await Promise.all(words.map((word) => getWordDefinition(locale, word, trie.has(word))));
31
33
  response.status(200).send(results.map((result) => result.toJson()));
32
34
  } catch (error) {
33
35
  const message = error instanceof Error ? error.message : 'Unknown error';
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@scrabble-solver/solver",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@scrabble-solver/solver",
9
- "version": "2.9.1",
9
+ "version": "2.9.3",
10
10
  "license": "CC-BY-NC-ND-4.0",
11
11
  "dependencies": {
12
12
  "@kamilmielnik/trie": "^2.0.1"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/solver",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "Scrabble Solver 2 - Solver",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  },
11
11
  "author": {
12
12
  "name": "Kamil Mielnik",
13
- "email": "kamil.adam.mielnik@gmail.com",
14
- "url": "https://kamilmielnik.com/"
13
+ "email": "kamil@kamilmielnik.com",
14
+ "url": "https://kamilmielnik.com"
15
15
  },
16
16
  "license": "CC-BY-NC-ND-4.0",
17
17
  "bugs": {
@@ -25,12 +25,12 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@kamilmielnik/trie": "^2.0.1",
28
- "@scrabble-solver/types": "^2.9.1"
28
+ "@scrabble-solver/types": "^2.9.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@scrabble-solver/configs": "^2.9.1",
32
- "@scrabble-solver/constants": "^2.9.1",
33
- "@scrabble-solver/dictionaries": "^2.9.1"
31
+ "@scrabble-solver/configs": "^2.9.3",
32
+ "@scrabble-solver/constants": "^2.9.3",
33
+ "@scrabble-solver/dictionaries": "^2.9.3"
34
34
  },
35
35
  "gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
36
36
  }
@@ -3,13 +3,16 @@ declare class WordDefinition {
3
3
  static fromJson(json: WordDefinitionJson | null): WordDefinition;
4
4
  static readonly Null: WordDefinition;
5
5
  readonly definitions: string[];
6
+ /**
7
+ * Does the word have an entry in a corresponding online dictionary?
8
+ */
9
+ readonly exists: boolean;
10
+ /**
11
+ * Can the word be legally used in the game?
12
+ */
6
13
  readonly isAllowed: boolean;
7
14
  readonly word: string;
8
- constructor({ definitions, isAllowed, word }: {
9
- definitions: string[];
10
- isAllowed: boolean;
11
- word: string;
12
- });
15
+ constructor({ definitions, exists, isAllowed, word }: WordDefinitionJson);
13
16
  toJson(): WordDefinitionJson | null;
14
17
  }
15
18
  export default WordDefinition;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class WordDefinition {
4
- constructor({ definitions, isAllowed, word }) {
4
+ constructor({ definitions, exists, isAllowed, word }) {
5
5
  this.definitions = definitions;
6
+ this.exists = exists;
6
7
  this.isAllowed = isAllowed;
7
8
  this.word = word;
8
9
  }
@@ -12,6 +13,7 @@ class WordDefinition {
12
13
  }
13
14
  return new WordDefinition({
14
15
  definitions: json.definitions,
16
+ exists: json.exists,
15
17
  isAllowed: json.isAllowed,
16
18
  word: json.word,
17
19
  });
@@ -19,6 +21,7 @@ class WordDefinition {
19
21
  toJson() {
20
22
  return {
21
23
  definitions: this.definitions,
24
+ exists: this.exists,
22
25
  isAllowed: this.isAllowed,
23
26
  word: this.word,
24
27
  };
@@ -26,6 +29,7 @@ class WordDefinition {
26
29
  }
27
30
  WordDefinition.Null = Object.freeze({
28
31
  definitions: [],
32
+ exists: false,
29
33
  isAllowed: false,
30
34
  word: '',
31
35
  toJson: () => null,
@@ -1,5 +1,12 @@
1
1
  interface WordDefinitionJson {
2
2
  definitions: string[];
3
+ /**
4
+ * Does the word have an entry in a corresponding online dictionary?
5
+ */
6
+ exists: boolean;
7
+ /**
8
+ * Can the word be legally used in the game?
9
+ */
3
10
  isAllowed: boolean;
4
11
  word: string;
5
12
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/types",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "Scrabble Solver 2 - Types",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  },
11
11
  "author": {
12
12
  "name": "Kamil Mielnik",
13
- "email": "kamil.adam.mielnik@gmail.com",
14
- "url": "https://kamilmielnik.com/"
13
+ "email": "kamil@kamilmielnik.com",
14
+ "url": "https://kamilmielnik.com"
15
15
  },
16
16
  "license": "CC-BY-NC-ND-4.0",
17
17
  "bugs": {
@@ -24,7 +24,7 @@
24
24
  "clean:force": "npm run clean && rimraf package-lock.json"
25
25
  },
26
26
  "dependencies": {
27
- "@scrabble-solver/constants": "^2.9.1"
27
+ "@scrabble-solver/constants": "^2.9.3"
28
28
  },
29
29
  "gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
30
30
  }
@@ -8,6 +8,7 @@ class WordDefinition {
8
8
 
9
9
  return new WordDefinition({
10
10
  definitions: json.definitions,
11
+ exists: json.exists,
11
12
  isAllowed: json.isAllowed,
12
13
  word: json.word,
13
14
  });
@@ -15,6 +16,7 @@ class WordDefinition {
15
16
 
16
17
  public static readonly Null: WordDefinition = Object.freeze({
17
18
  definitions: [],
19
+ exists: false,
18
20
  isAllowed: false,
19
21
  word: '',
20
22
  toJson: () => null,
@@ -22,12 +24,21 @@ class WordDefinition {
22
24
 
23
25
  public readonly definitions: string[];
24
26
 
27
+ /**
28
+ * Does the word have an entry in a corresponding online dictionary?
29
+ */
30
+ public readonly exists: boolean;
31
+
32
+ /**
33
+ * Can the word be legally used in the game?
34
+ */
25
35
  public readonly isAllowed: boolean;
26
36
 
27
37
  public readonly word: string;
28
38
 
29
- constructor({ definitions, isAllowed, word }: { definitions: string[]; isAllowed: boolean; word: string }) {
39
+ constructor({ definitions, exists, isAllowed, word }: WordDefinitionJson) {
30
40
  this.definitions = definitions;
41
+ this.exists = exists;
31
42
  this.isAllowed = isAllowed;
32
43
  this.word = word;
33
44
  }
@@ -35,6 +46,7 @@ class WordDefinition {
35
46
  public toJson(): WordDefinitionJson | null {
36
47
  return {
37
48
  definitions: this.definitions,
49
+ exists: this.exists,
38
50
  isAllowed: this.isAllowed,
39
51
  word: this.word,
40
52
  };
@@ -1,5 +1,12 @@
1
1
  interface WordDefinitionJson {
2
2
  definitions: string[];
3
+ /**
4
+ * Does the word have an entry in a corresponding online dictionary?
5
+ */
6
+ exists: boolean;
7
+ /**
8
+ * Can the word be legally used in the game?
9
+ */
3
10
  isAllowed: boolean;
4
11
  word: string;
5
12
  }
@@ -1,3 +1,3 @@
1
1
  import { Locale, WordDefinition } from '@scrabble-solver/types';
2
- declare const getWordDefinition: (locale: Locale, word: string) => Promise<WordDefinition>;
2
+ declare const getWordDefinition: (locale: Locale, word: string, isAllowed: boolean) => Promise<WordDefinition>;
3
3
  export default getWordDefinition;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("@scrabble-solver/types");
4
4
  const crawl_1 = require("./crawl");
5
5
  const parse_1 = require("./parse");
6
- const getWordDefinition = async (locale, word) => {
6
+ const getWordDefinition = async (locale, word, isAllowed) => {
7
7
  const html = await (0, crawl_1.crawl)(locale, word);
8
- const { definitions, isAllowed } = (0, parse_1.parse)(locale, html);
9
- const wordDefinition = new types_1.WordDefinition({ definitions, isAllowed, word });
8
+ const { definitions, exists } = (0, parse_1.parse)(locale, html);
9
+ const wordDefinition = new types_1.WordDefinition({ definitions, exists, isAllowed, word });
10
10
  return wordDefinition;
11
11
  };
12
12
  exports.default = getWordDefinition;
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const striptags_1 = __importDefault(require("striptags"));
7
7
  const EMPHASIS_TAGS = ['a', 'b', 'em', 'internalXref'];
8
8
  const normalizeHtmlTags = (definition) => (0, striptags_1.default)((0, striptags_1.default)(definition, EMPHASIS_TAGS), undefined, '"');
9
- const normalizeLineBreaks = (definition) => definition.replace(/[\r\n]/g, '');
9
+ const normalizeLineBreaks = (definition) => definition.replace(/\r\n/g, '\n');
10
+ const normalizeWhitespace = (definition) => definition.replace(/[ ]+/g, ' ');
10
11
  const normalizeQuotes = (definition) => definition.replace(/\."/g, '".');
11
12
  /**
12
13
  * `(1.2) definition` -> `definition`
@@ -26,6 +27,7 @@ const normalizers = [
26
27
  normalizeMarkers,
27
28
  normalizeQuotes,
28
29
  normalizeLineBreaks,
30
+ normalizeWhitespace,
29
31
  normalizeTrailingSymbols,
30
32
  normalizeLeadingSymbols,
31
33
  normalizeNonWords,
@@ -19,10 +19,10 @@ const parsePerLocale = {
19
19
  [types_1.Locale.PL_PL]: parsePolish_1.default,
20
20
  };
21
21
  const parse = (locale, html) => {
22
- const { definitions, isAllowed } = parsePerLocale[locale](html);
22
+ const { definitions, exists } = parsePerLocale[locale](html);
23
23
  return {
24
24
  definitions: (0, lib_1.unique)(definitions.map(lib_1.normalizeDefinition).filter(Boolean)),
25
- isAllowed,
25
+ exists,
26
26
  };
27
27
  };
28
28
  exports.default = parse;
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const cheerio_1 = __importDefault(require("cheerio"));
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
7
  const parseEnglish = (html) => {
8
- const $ = cheerio_1.default.load(html);
8
+ const $ = (0, cheerio_1.load)(html);
9
9
  $('strong.mw_t_bc').replaceWith(', ');
10
10
  $('.text-lowercase').remove();
11
11
  $('[id^=dictionary-entry]').find('.dtText > *:not(a)').remove();
12
12
  const $definitions = $('[id^=dictionary-entry]').find('.dtText, .cxl-ref');
13
13
  return {
14
- definitions: Array.from($definitions).map((definition) => $(definition).text()),
15
- isAllowed: $definitions.length > 0,
14
+ definitions: Array.from($definitions).map((definition) => $(definition).text().replace(/\n/g, '')),
15
+ exists: $('.spelling-suggestion-text').text().trim() !== DOES_NOT_EXIST_MESSAGE,
16
16
  };
17
17
  };
18
18
  exports.default = parseEnglish;
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const cheerio_1 = __importDefault(require("cheerio"));
3
+ const cheerio_1 = require("cheerio");
7
4
  const parseFrench = (html) => {
8
- const $ = cheerio_1.default.load(html);
5
+ const $ = (0, cheerio_1.load)(html);
9
6
  const $definitions = $('.tlf_cdefinition');
10
7
  return {
11
8
  definitions: Array.from($definitions).map((definition) => $(definition).text()),
12
- isAllowed: $('#vitemselected span').length > 0,
9
+ exists: $('#vitemselected span').length > 0,
13
10
  };
14
11
  };
15
12
  exports.default = parseFrench;
@@ -1,22 +1,60 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const cheerio_1 = __importDefault(require("cheerio"));
3
+ const cheerio_1 = require("cheerio");
7
4
  const parseGerman = (html) => {
8
- const $ = cheerio_1.default.load(html);
9
- const $meaningOverview = $('.bedeutungsuebersicht');
10
- let $definitions;
11
- if ($meaningOverview.length > 0) {
12
- $definitions = $('.bedeutungsuebersicht > ol > li > a');
13
- }
14
- else {
15
- $definitions = $('.dwdswb-lesart .dwdswb-definition');
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;
16
41
  }
17
- return {
18
- definitions: Array.from($definitions).map((definition) => $(definition).text().replace('/\n/', '')),
19
- isAllowed: $definitions.length > 0,
20
- };
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, ''));
21
59
  };
22
60
  exports.default = parseGerman;
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const cheerio_1 = __importDefault(require("cheerio"));
3
+ const cheerio_1 = require("cheerio");
7
4
  const parsePolish = (html) => {
8
- const $ = cheerio_1.default.load(html);
5
+ const $ = (0, cheerio_1.load)(html);
9
6
  const $header = $($('h1')[0]);
10
7
  const $isAllowed = $header.next();
11
8
  const $definitions = $header.next().next().next().next();
12
9
  return {
13
10
  definitions: $definitions.text().trim().split(/\d+\./),
14
- isAllowed: $isAllowed.text().trim().indexOf('dopuszczalne w grach') >= 0,
11
+ exists: $isAllowed.text().trim().indexOf('dopuszczalne w grach') >= 0,
15
12
  };
16
13
  };
17
14
  exports.default = parsePolish;
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const cheerio_1 = __importDefault(require("cheerio"));
3
+ const cheerio_1 = require("cheerio");
7
4
  const parseSpanish = (html) => {
8
- const $ = cheerio_1.default.load(html);
5
+ const $ = (0, cheerio_1.load)(html);
9
6
  $('.verdBold14 + .gris11 + .gris13').remove();
10
7
  $('br + .gris13').remove();
11
8
  $('.grisItalic13 + .gris13').remove();
@@ -26,7 +23,7 @@ const parseSpanish = (html) => {
26
23
  .filter(Boolean)
27
24
  .map((definition) => definition.replace(/\s+\.$/g, ''))
28
25
  .map((definition) => (definition.endsWith('.') ? definition : `${definition}.`)),
29
- isAllowed: definitions.length > 0,
26
+ exists: $('.wrapper > p > strong').text() !== 'No se ha encontrado la palabra exacta',
30
27
  };
31
28
  };
32
29
  exports.default = parseSpanish;
@@ -1,4 +1,4 @@
1
1
  export interface ParseResult {
2
2
  definitions: string[];
3
- isAllowed: boolean;
3
+ exists: boolean;
4
4
  }