scrabble-solver 2.13.5-alpha.0 → 2.13.5-alpha.2
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/.gitattributes +2 -2
- package/.nx/cache/file-map.json +467 -484
- package/.nx/cache/lockfile.hash +1 -1
- package/.nx/cache/nx_files.nxt +0 -0
- package/.nx/cache/parsed-lock-file.json +46 -46
- package/.nx/cache/project-graph.json +52 -52
- package/README.md +23 -8
- package/lerna.json +1 -1
- package/package.json +5 -4
- package/packages/configs/build/getConfig.d.ts +1 -2
- package/packages/configs/build/getConfig.js +4 -3
- package/packages/configs/build/hasConfig.d.ts +1 -2
- package/packages/configs/build/hasConfig.js +4 -3
- package/packages/configs/build/index.d.ts +4 -7
- package/packages/configs/build/index.js +5 -10
- package/packages/configs/build/languages/english.d.ts +7 -0
- package/packages/configs/build/languages/english.js +199 -0
- package/packages/configs/build/languages/french.d.ts +2 -0
- package/packages/configs/build/languages/french.js +37 -0
- package/packages/configs/build/languages/german.d.ts +2 -0
- package/packages/configs/build/languages/german.js +40 -0
- package/packages/configs/build/languages/index.d.ts +7 -0
- package/packages/configs/build/languages/index.js +23 -0
- package/packages/configs/build/languages/persian.d.ts +2 -0
- package/packages/configs/build/languages/persian.js +43 -0
- package/packages/configs/build/languages/polish.d.ts +3 -0
- package/packages/configs/build/languages/polish.js +81 -0
- package/packages/configs/build/languages/romanian.d.ts +2 -0
- package/packages/configs/build/languages/romanian.js +36 -0
- package/packages/configs/build/languages/spanish.d.ts +2 -0
- package/packages/configs/build/languages/spanish.js +39 -0
- package/packages/configs/package.json +3 -3
- package/packages/configs/src/games/superScrabble.ts +2 -2
- package/packages/configs/src/getConfig.ts +3 -5
- package/packages/configs/src/hasConfig.ts +3 -5
- package/packages/configs/src/index.ts +4 -6
- package/packages/configs/src/languages/english.ts +203 -0
- package/packages/configs/src/languages/french.ts +36 -0
- package/packages/configs/src/languages/german.ts +39 -0
- package/packages/configs/src/languages/index.ts +7 -0
- package/packages/configs/src/languages/persian.ts +42 -0
- package/packages/configs/src/languages/polish.ts +81 -0
- package/packages/configs/src/languages/romanian.ts +35 -0
- package/packages/configs/src/languages/spanish.ts +38 -0
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/package-lock.json +2 -2
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package-lock.json +2 -2
- package/packages/logger/package.json +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +15 -24
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/packages/scrabble-solver/.next/cache/webpack/client-development/0.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/1.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/10.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/11.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/12.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/13.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/14.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/15.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/2.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/3.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/4.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/5.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/6.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/7.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/8.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/9.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/index.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development/index.pack.gz.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development-fallback/0.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-development-fallback/index.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/1.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/2.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/3.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/4.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/1.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/2.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/0.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/1.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/10.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/11.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/12.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/13.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/14.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/15.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/16.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/17.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/18.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/19.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/2.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/20.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/21.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/22.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/23.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/3.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/4.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/5.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/6.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/7.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/8.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/9.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/index.pack.gz +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-development/index.pack.gz.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/1.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/2.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/3.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/4.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/next-font-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js +3720 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js +86 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js +3742 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +1116 -2
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +1496 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js +946 -1
- package/packages/scrabble-solver/.next/server/pages/api/visit.js +176 -1
- package/packages/scrabble-solver/.next/server/pages/index.js +4312 -1
- package/packages/scrabble-solver/.next/server/pages-manifest.json +10 -1
- package/packages/scrabble-solver/.next/server/vendor-chunks/@swc.js +35 -0
- package/packages/scrabble-solver/.next/server/vendor-chunks/next.js +517 -0
- package/packages/scrabble-solver/.next/server/webpack-api-runtime.js +168 -1
- package/packages/scrabble-solver/.next/server/webpack-runtime.js +237 -1
- package/packages/scrabble-solver/.next/static/chunks/main.js +1285 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/_app.js +4854 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/_error.js +28 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index.js +717 -0
- package/packages/scrabble-solver/.next/static/chunks/react-refresh.js +62 -0
- package/packages/scrabble-solver/.next/static/chunks/webpack.js +1261 -0
- package/packages/scrabble-solver/.next/static/development/_buildManifest.js +1 -0
- package/packages/scrabble-solver/.next/static/development/_ssgManifest.js +1 -0
- package/packages/scrabble-solver/.next/static/webpack/29a2bd94727d51e6.webpack.hot-update.json +1 -0
- package/packages/scrabble-solver/.next/static/webpack/3754455b7d774808.webpack.hot-update.json +1 -0
- package/packages/scrabble-solver/.next/static/webpack/633457081244afec._.hot-update.json +1 -0
- package/packages/scrabble-solver/.next/static/webpack/b71388f846dd4d8b.webpack.hot-update.json +1 -0
- package/packages/scrabble-solver/.next/static/webpack/e7718e8f7cbe05a0.webpack.hot-update.json +1 -0
- package/packages/scrabble-solver/.next/static/webpack/pages/_app.29a2bd94727d51e6.hot-update.js +22 -0
- package/packages/scrabble-solver/.next/static/webpack/pages/_app.3754455b7d774808.hot-update.js +262 -0
- package/packages/scrabble-solver/.next/static/webpack/pages/_app.e7718e8f7cbe05a0.hot-update.js +251 -0
- package/packages/scrabble-solver/.next/static/webpack/pages/index.3754455b7d774808.hot-update.js +75 -0
- package/packages/scrabble-solver/.next/static/webpack/pages/index.b71388f846dd4d8b.hot-update.js +22 -0
- package/packages/scrabble-solver/.next/static/webpack/pages/index.e7718e8f7cbe05a0.hot-update.js +32 -0
- package/packages/scrabble-solver/.next/static/webpack/webpack.29a2bd94727d51e6.hot-update.js +18 -0
- package/packages/scrabble-solver/.next/static/webpack/webpack.3754455b7d774808.hot-update.js +18 -0
- package/packages/scrabble-solver/.next/static/webpack/webpack.b71388f846dd4d8b.hot-update.js +18 -0
- package/packages/scrabble-solver/.next/static/webpack/webpack.e7718e8f7cbe05a0.hot-update.js +18 -0
- package/packages/scrabble-solver/.next/trace +17 -44
- package/packages/scrabble-solver/package-lock.json +2 -4
- package/packages/scrabble-solver/package.json +9 -9
- package/packages/scrabble-solver/public/service-worker.js +2 -2
- package/packages/scrabble-solver/public/service-worker.js.map +1 -1
- package/packages/scrabble-solver/src/components/Board/Board.module.scss +14 -0
- package/packages/scrabble-solver/src/components/Board/Board.tsx +8 -1
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +76 -21
- package/packages/scrabble-solver/src/components/Board/hooks/useBackgroundImage.tsx +46 -7
- package/packages/scrabble-solver/src/components/Board/hooks/useBoardStyle.ts +8 -3
- package/packages/scrabble-solver/src/components/Board/lib/getCoordinate.ts +11 -0
- package/packages/scrabble-solver/src/components/Board/lib/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.tsx +17 -18
- package/packages/scrabble-solver/src/components/EmptyState/EmptyState.tsx +1 -1
- package/packages/scrabble-solver/src/components/Results/Results.module.scss +1 -0
- package/packages/scrabble-solver/src/hooks/useAppLayout.ts +18 -4
- package/packages/scrabble-solver/src/i18n/i18n.ts +15 -15
- package/packages/scrabble-solver/src/i18n/{en.json → languages/english.json} +4 -0
- package/packages/scrabble-solver/src/i18n/{fr.json → languages/french.json} +4 -0
- package/packages/scrabble-solver/src/i18n/{de.json → languages/german.json} +4 -0
- package/packages/scrabble-solver/src/i18n/{fa.json → languages/persian.json} +4 -0
- package/packages/scrabble-solver/src/i18n/{pl.json → languages/polish.json} +4 -0
- package/packages/scrabble-solver/src/i18n/{ro.json → languages/romanian.json} +4 -0
- package/packages/scrabble-solver/src/i18n/{es.json → languages/spanish.json} +4 -0
- package/packages/scrabble-solver/src/lib/extractCharacters.test.ts +3 -5
- package/packages/scrabble-solver/src/lib/extractCharactersByCase.test.ts +3 -5
- package/packages/scrabble-solver/src/modals/SettingsModal/SettingsModal.tsx +11 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.tsx +59 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/index.ts +1 -0
- package/packages/scrabble-solver/src/parameters/index.ts +1 -0
- package/packages/scrabble-solver/src/state/localStorage.ts +10 -1
- package/packages/scrabble-solver/src/state/sagas.ts +6 -3
- package/packages/scrabble-solver/src/state/selectors.ts +2 -0
- package/packages/scrabble-solver/src/state/slices/settingsInitialState.ts +6 -4
- package/packages/scrabble-solver/src/state/slices/settingsSlice.ts +6 -1
- package/packages/scrabble-solver/src/state/store.ts +1 -1
- package/packages/scrabble-solver/src/types/index.ts +4 -0
- package/packages/scrabble-solver/tsconfig.json +1 -0
- package/packages/solver/package-lock.json +2 -2
- package/packages/solver/package.json +5 -5
- package/packages/types/build/ShowCoordinates.d.ts +7 -0
- package/packages/types/build/ShowCoordinates.js +2 -0
- package/packages/types/build/index.d.ts +1 -0
- package/packages/types/package.json +2 -2
- package/packages/types/src/ShowCoordinates.ts +8 -0
- package/packages/types/src/index.ts +1 -0
- package/packages/word-definitions/build/crawl.d.ts +2 -0
- package/packages/word-definitions/build/crawl.js +19 -0
- package/packages/word-definitions/build/getWordDefinition.d.ts +1 -2
- package/packages/word-definitions/build/getWordDefinition.js +2 -1
- package/packages/word-definitions/build/index.d.ts +2 -1
- package/packages/word-definitions/build/index.js +2 -4
- package/packages/word-definitions/build/languages/english.d.ts +3 -0
- package/packages/word-definitions/build/languages/english.js +28 -0
- package/packages/word-definitions/build/languages/french.d.ts +3 -0
- package/packages/word-definitions/build/languages/french.js +22 -0
- package/packages/word-definitions/build/languages/german.d.ts +3 -0
- package/packages/word-definitions/build/languages/german.js +70 -0
- package/packages/word-definitions/build/languages/index.d.ts +7 -0
- package/packages/word-definitions/build/languages/index.js +33 -0
- package/packages/word-definitions/build/languages/persian.d.ts +3 -0
- package/packages/word-definitions/build/languages/persian.js +23 -0
- package/packages/word-definitions/build/languages/polish.d.ts +3 -0
- package/packages/word-definitions/build/languages/polish.js +24 -0
- package/packages/word-definitions/build/languages/romanian.d.ts +3 -0
- package/packages/word-definitions/build/languages/romanian.js +26 -0
- package/packages/word-definitions/build/languages/spanish.d.ts +3 -0
- package/packages/word-definitions/build/languages/spanish.js +39 -0
- package/packages/word-definitions/build/lib/index.d.ts +3 -3
- package/packages/word-definitions/build/lib/index.js +3 -6
- package/packages/word-definitions/build/lib/normalizeDefinition.d.ts +1 -2
- package/packages/word-definitions/build/lib/normalizeDefinition.js +3 -2
- package/packages/word-definitions/build/lib/request.d.ts +2 -2
- package/packages/word-definitions/build/lib/request.js +2 -1
- package/packages/word-definitions/build/lib/unique.d.ts +1 -2
- package/packages/word-definitions/build/lib/unique.js +2 -1
- package/packages/word-definitions/build/parse.d.ts +3 -0
- package/packages/word-definitions/build/parse.js +24 -0
- package/packages/word-definitions/build/types.d.ts +1 -1
- package/packages/word-definitions/package-lock.json +2 -2
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-definitions/src/crawl.ts +18 -0
- package/packages/word-definitions/src/getWordDefinition.ts +1 -3
- package/packages/word-definitions/src/index.ts +2 -1
- package/packages/word-definitions/src/{parse/parseEnglish.ts → languages/english.ts} +11 -4
- package/packages/word-definitions/src/languages/french.ts +22 -0
- package/packages/word-definitions/src/{parse/parseGerman.ts → languages/german.ts} +12 -5
- package/packages/word-definitions/src/languages/index.ts +7 -0
- package/packages/word-definitions/src/{parse/parseFarsi.ts → languages/persian.ts} +11 -4
- package/packages/word-definitions/src/{parse/parsePolish.ts → languages/polish.ts} +11 -4
- package/packages/word-definitions/src/{parse/parseRomanian.ts → languages/romanian.ts} +11 -4
- package/packages/word-definitions/src/{parse/parseSpanish.ts → languages/spanish.ts} +11 -4
- package/packages/word-definitions/src/lib/index.ts +3 -3
- package/packages/word-definitions/src/lib/normalizeDefinition.ts +1 -3
- package/packages/word-definitions/src/lib/request.ts +1 -3
- package/packages/word-definitions/src/lib/unique.ts +1 -3
- package/packages/word-definitions/src/{parse/parse.test.ts → parse.test.ts} +5 -7
- package/packages/word-definitions/src/parse.ts +25 -0
- package/packages/word-definitions/src/types.ts +1 -1
- package/packages/word-lists/build/getWordList.d.ts +1 -2
- package/packages/word-lists/build/getWordList.js +11 -20
- package/packages/word-lists/build/index.d.ts +2 -6
- package/packages/word-lists/build/index.js +3 -15
- package/packages/word-lists/build/languages/english.d.ts +2 -0
- package/packages/word-lists/build/languages/english.js +15 -0
- package/packages/word-lists/build/languages/french.d.ts +1 -0
- package/packages/word-lists/build/languages/french.js +11 -0
- package/packages/word-lists/build/languages/german.d.ts +1 -0
- package/packages/word-lists/build/languages/german.js +10 -0
- package/packages/word-lists/build/languages/index.d.ts +7 -0
- package/packages/word-lists/build/languages/index.js +33 -0
- package/packages/word-lists/build/languages/persian.d.ts +1 -0
- package/packages/word-lists/build/languages/persian.js +10 -0
- package/packages/word-lists/build/languages/polish.d.ts +1 -0
- package/packages/word-lists/build/languages/polish.js +42 -0
- package/packages/word-lists/build/languages/romanian.d.ts +1 -0
- package/packages/word-lists/build/languages/romanian.js +11 -0
- package/packages/word-lists/build/languages/spanish.d.ts +1 -0
- package/packages/word-lists/build/languages/spanish.js +19 -0
- package/packages/word-lists/package-lock.json +2 -2
- package/packages/word-lists/package.json +2 -2
- package/packages/word-lists/src/getWordList.ts +10 -19
- package/packages/word-lists/src/index.ts +2 -6
- package/packages/word-lists/src/languages/english.ts +14 -0
- package/packages/word-lists/src/{getFrFrWordList.ts → languages/french.ts} +2 -4
- package/packages/word-lists/src/{getDeDeWordList.ts → languages/german.ts} +2 -4
- package/packages/word-lists/src/languages/index.ts +7 -0
- package/packages/word-lists/src/{getFaIrWordList.ts → languages/persian.ts} +2 -4
- package/packages/word-lists/src/{getPlPlWordList.ts → languages/polish.ts} +2 -4
- package/packages/word-lists/src/{getRoRoWordList.ts → languages/romanian.ts} +2 -4
- package/packages/word-lists/src/{getEsEsWordList.ts → languages/spanish.ts} +2 -4
- package/tsconfig.jest.json +1 -0
- package/packages/configs/src/locales/deDe.ts +0 -43
- package/packages/configs/src/locales/enGb.ts +0 -105
- package/packages/configs/src/locales/enUs.ts +0 -105
- package/packages/configs/src/locales/esEs.ts +0 -42
- package/packages/configs/src/locales/faIr.ts +0 -46
- package/packages/configs/src/locales/frFr.ts +0 -40
- package/packages/configs/src/locales/index.ts +0 -8
- package/packages/configs/src/locales/plPl.ts +0 -84
- package/packages/configs/src/locales/roRo.ts +0 -39
- package/packages/scrabble-solver/.next/BUILD_ID +0 -1
- package/packages/scrabble-solver/.next/export-marker.json +0 -1
- package/packages/scrabble-solver/.next/images-manifest.json +0 -1
- package/packages/scrabble-solver/.next/next-minimal-server.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/next-server.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/prerender-manifest.js +0 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +0 -1
- package/packages/scrabble-solver/.next/required-server-files.json +0 -1
- package/packages/scrabble-solver/.next/routes-manifest.json +0 -1
- package/packages/scrabble-solver/.next/server/InjectManifest.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/chunks/28.js +0 -1
- package/packages/scrabble-solver/.next/server/chunks/331.js +0 -6
- package/packages/scrabble-solver/.next/server/chunks/577.js +0 -1
- package/packages/scrabble-solver/.next/server/chunks/911.js +0 -1
- package/packages/scrabble-solver/.next/server/chunks/977.js +0 -1
- package/packages/scrabble-solver/.next/server/chunks/font-manifest.json +0 -1
- package/packages/scrabble-solver/.next/server/font-manifest.json +0 -1
- package/packages/scrabble-solver/.next/server/functions-config-manifest.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +0 -1
- package/packages/scrabble-solver/.next/server/pages/404.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/500.html +0 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +0 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/api/visit.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/index.html +0 -1
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/pages/index.json +0 -1
- package/packages/scrabble-solver/.next/static/bQ-v-R6yKq5G7C4cYlhIp/_buildManifest.js +0 -1
- package/packages/scrabble-solver/.next/static/bQ-v-R6yKq5G7C4cYlhIp/_ssgManifest.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/framework-1728d40275bc359a.js +0 -49
- package/packages/scrabble-solver/.next/static/chunks/main-5fb7abbfc135de15.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/404-b6e238bb4117d451.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-b95404c40a0092e6.js +0 -17
- package/packages/scrabble-solver/.next/static/chunks/pages/_error-db043fa3544f8809.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/index-59d569ef79bc2580.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/webpack-6ef43a8d4a395f49.js +0 -1
- package/packages/scrabble-solver/.next/static/css/8fa2fb99b90e109e.css +0 -1
- package/packages/scrabble-solver/.next/static/css/c80ebc6fd13311f1.css +0 -2
- package/packages/word-definitions/src/crawl/crawl.ts +0 -26
- package/packages/word-definitions/src/crawl/crawlEnglish.ts +0 -11
- package/packages/word-definitions/src/crawl/crawlFarsi.ts +0 -11
- package/packages/word-definitions/src/crawl/crawlFrench.ts +0 -11
- package/packages/word-definitions/src/crawl/crawlGerman.ts +0 -11
- package/packages/word-definitions/src/crawl/crawlPolish.ts +0 -11
- package/packages/word-definitions/src/crawl/crawlRomanian.ts +0 -11
- package/packages/word-definitions/src/crawl/crawlSpanish.ts +0 -11
- package/packages/word-definitions/src/crawl/index.ts +0 -6
- package/packages/word-definitions/src/parse/index.ts +0 -8
- package/packages/word-definitions/src/parse/parse.ts +0 -34
- package/packages/word-definitions/src/parse/parseFrench.ts +0 -15
- package/packages/word-lists/src/getEnGbWordList.ts +0 -11
- package/packages/word-lists/src/getEnUsWordList.ts +0 -11
- /package/packages/scrabble-solver/.next/static/chunks/{polyfills-c67a75d1b6f99dc8.js → polyfills.js} +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/de-DE.hm.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/de-DE.ho.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/de-DE.kolla.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/de-DE.vom.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/en-US.awe.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/en-US.oe.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/en-US.pawn.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/en-US.pawnee.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/en-US.pean.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/en-US.wiz.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/es-ES.corma.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/es-ES.portero.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/expected/ro-RO.aciua.json +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/de-DE.hm.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/de-DE.ho.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/de-DE.kolla.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/de-DE.vom.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/en-US.awe.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/en-US.oe.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/en-US.pawn.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/en-US.pawnee.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/en-US.pean.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/en-US.wiz.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/es-ES.corma.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/es-ES.portero.html +0 -0
- /package/packages/word-definitions/src/{parse/__tests__ → __tests__}/input/ro-RO.aciua.html +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse = exports.crawl = void 0;
|
|
4
|
+
const cheerio_1 = require("cheerio");
|
|
5
|
+
const lib_1 = require("../lib");
|
|
6
|
+
const crawl = (word) => {
|
|
7
|
+
return (0, lib_1.request)({
|
|
8
|
+
protocol: 'https',
|
|
9
|
+
hostname: 'dexonline.ro',
|
|
10
|
+
path: `/definitie/${encodeURIComponent(word)}`,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
exports.crawl = crawl;
|
|
14
|
+
const parse = (html) => {
|
|
15
|
+
const $ = (0, cheerio_1.load)(html);
|
|
16
|
+
const $activeTab = $('.tab-pane.show.active');
|
|
17
|
+
$('.type-example').remove();
|
|
18
|
+
const $definitions = $activeTab.find('li.type-meaning.depth-0 > .meaningContainer .def.html');
|
|
19
|
+
$definitions.find('.meaningTree').remove();
|
|
20
|
+
const definitions = Array.from($definitions).map((definition) => $(definition).text().replace(/\n/g, ''));
|
|
21
|
+
return {
|
|
22
|
+
definitions,
|
|
23
|
+
exists: definitions.length > 0,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.parse = parse;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse = exports.crawl = void 0;
|
|
4
|
+
const cheerio_1 = require("cheerio");
|
|
5
|
+
const lib_1 = require("../lib");
|
|
6
|
+
const crawl = (word) => {
|
|
7
|
+
return (0, lib_1.request)({
|
|
8
|
+
protocol: 'https',
|
|
9
|
+
hostname: 'www.diccionarios.com',
|
|
10
|
+
path: `/diccionario/espanol/${encodeURIComponent(word)}`,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
exports.crawl = crawl;
|
|
14
|
+
const parse = (html) => {
|
|
15
|
+
const $ = (0, cheerio_1.load)(html);
|
|
16
|
+
$('.verdBold14 + .gris11 + .gris13').remove();
|
|
17
|
+
$('br + .gris13').remove();
|
|
18
|
+
$('.grisItalic13 + .gris13').remove();
|
|
19
|
+
$('font[class^="verd"]').remove();
|
|
20
|
+
$('font.gris11').remove();
|
|
21
|
+
$('font[class^="grisBold"]').remove();
|
|
22
|
+
$('font[class^="grisItalic"]').remove();
|
|
23
|
+
Array.from($('.gris13')).forEach((element) => {
|
|
24
|
+
const children = $(element).find('.gris13');
|
|
25
|
+
if (children && children.length > 0) {
|
|
26
|
+
children.remove();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const definitions = Array.from($('.dcom-search-result .gris13'));
|
|
30
|
+
return {
|
|
31
|
+
definitions: definitions
|
|
32
|
+
.map((definition) => $(definition).text().trim())
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.map((definition) => definition.replace(/\s+\.$/g, ''))
|
|
35
|
+
.map((definition) => (definition.endsWith('.') ? definition : `${definition}.`)),
|
|
36
|
+
exists: $('.wrapper > p > strong').text() !== 'No se ha encontrado la palabra exacta',
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
exports.parse = parse;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { normalizeDefinition } from './normalizeDefinition';
|
|
2
|
+
export { request } from './request';
|
|
3
|
+
export { unique } from './unique';
|
|
@@ -1,12 +1,9 @@
|
|
|
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
3
|
exports.unique = exports.request = exports.normalizeDefinition = void 0;
|
|
7
4
|
var normalizeDefinition_1 = require("./normalizeDefinition");
|
|
8
|
-
Object.defineProperty(exports, "normalizeDefinition", { enumerable: true, get: function () { return
|
|
5
|
+
Object.defineProperty(exports, "normalizeDefinition", { enumerable: true, get: function () { return normalizeDefinition_1.normalizeDefinition; } });
|
|
9
6
|
var request_1 = require("./request");
|
|
10
|
-
Object.defineProperty(exports, "request", { enumerable: true, get: function () { return
|
|
7
|
+
Object.defineProperty(exports, "request", { enumerable: true, get: function () { return request_1.request; } });
|
|
11
8
|
var unique_1 = require("./unique");
|
|
12
|
-
Object.defineProperty(exports, "unique", { enumerable: true, get: function () { return
|
|
9
|
+
Object.defineProperty(exports, "unique", { enumerable: true, get: function () { return unique_1.unique; } });
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const normalizeDefinition: (definition: string) => string;
|
|
2
|
-
export default normalizeDefinition;
|
|
1
|
+
export declare const normalizeDefinition: (definition: string) => string;
|
|
@@ -3,6 +3,7 @@ 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
|
+
exports.normalizeDefinition = void 0;
|
|
6
7
|
const striptags_1 = __importDefault(require("striptags"));
|
|
7
8
|
const EMPHASIS_TAGS = ['a', 'b', 'em', 'internalXref'];
|
|
8
9
|
const normalizeHtmlTags = (definition) => (0, striptags_1.default)((0, striptags_1.default)(definition, EMPHASIS_TAGS), undefined, '"');
|
|
@@ -40,6 +41,6 @@ const normalizers = [
|
|
|
40
41
|
const normalizeDefinition = (definition) => {
|
|
41
42
|
const normalized = normalizers.reduce((result, normalize) => normalize(result), definition);
|
|
42
43
|
const hasChanged = normalized !== definition;
|
|
43
|
-
return hasChanged ? normalizeDefinition(normalized) : normalized;
|
|
44
|
+
return hasChanged ? (0, exports.normalizeDefinition)(normalized) : normalized;
|
|
44
45
|
};
|
|
45
|
-
exports.
|
|
46
|
+
exports.normalizeDefinition = normalizeDefinition;
|
|
@@ -3,5 +3,5 @@ import { RequestOptions } from 'http';
|
|
|
3
3
|
interface Options extends RequestOptions {
|
|
4
4
|
protocol?: 'http' | 'https';
|
|
5
5
|
}
|
|
6
|
-
declare const request: ({ protocol, ...options }: Options) => Promise<string>;
|
|
7
|
-
export
|
|
6
|
+
export declare const request: ({ protocol, ...options }: Options) => Promise<string>;
|
|
7
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = void 0;
|
|
3
4
|
const follow_redirects_1 = require("follow-redirects");
|
|
4
5
|
const request = ({ protocol, ...options }) => {
|
|
5
6
|
const agent = protocol === 'https' ? follow_redirects_1.https : follow_redirects_1.http;
|
|
@@ -23,4 +24,4 @@ const request = ({ protocol, ...options }) => {
|
|
|
23
24
|
.on('error', reject);
|
|
24
25
|
});
|
|
25
26
|
};
|
|
26
|
-
exports.
|
|
27
|
+
exports.request = request;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const unique: <T>(array: T[]) => T[];
|
|
2
|
-
export default unique;
|
|
1
|
+
export declare const unique: <T>(array: T[]) => T[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse = void 0;
|
|
4
|
+
const types_1 = require("@scrabble-solver/types");
|
|
5
|
+
const languages_1 = require("./languages");
|
|
6
|
+
const lib_1 = require("./lib");
|
|
7
|
+
const parsePerLocale = {
|
|
8
|
+
[types_1.Locale.DE_DE]: languages_1.german.parse,
|
|
9
|
+
[types_1.Locale.EN_GB]: languages_1.english.parse,
|
|
10
|
+
[types_1.Locale.EN_US]: languages_1.english.parse,
|
|
11
|
+
[types_1.Locale.ES_ES]: languages_1.spanish.parse,
|
|
12
|
+
[types_1.Locale.FA_IR]: languages_1.persian.parse,
|
|
13
|
+
[types_1.Locale.FR_FR]: languages_1.french.parse,
|
|
14
|
+
[types_1.Locale.PL_PL]: languages_1.polish.parse,
|
|
15
|
+
[types_1.Locale.RO_RO]: languages_1.romanian.parse,
|
|
16
|
+
};
|
|
17
|
+
const parse = (locale, html) => {
|
|
18
|
+
const { definitions, exists } = parsePerLocale[locale](html);
|
|
19
|
+
return {
|
|
20
|
+
definitions: (0, lib_1.unique)(definitions.map(lib_1.normalizeDefinition).filter(Boolean)),
|
|
21
|
+
exists,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.parse = parse;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/word-definitions",
|
|
3
|
-
"version": "2.13.5-alpha.
|
|
3
|
+
"version": "2.13.5-alpha.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@scrabble-solver/word-definitions",
|
|
9
|
-
"version": "2.13.5-alpha.
|
|
9
|
+
"version": "2.13.5-alpha.2",
|
|
10
10
|
"license": "CC-BY-NC-ND-4.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"cheerio": "^1.0.0-rc.12",
|
|
@@ -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.2",
|
|
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.2",
|
|
27
27
|
"cheerio": "^1.0.0-rc.12",
|
|
28
28
|
"follow-redirects": "^1.15.5",
|
|
29
29
|
"striptags": "^3.2.0"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Locale } from '@scrabble-solver/types';
|
|
2
|
+
|
|
3
|
+
import { english, french, german, persian, polish, romanian, spanish } from './languages';
|
|
4
|
+
|
|
5
|
+
const crawlPerLocale: Record<Locale, (word: string) => Promise<string>> = {
|
|
6
|
+
[Locale.DE_DE]: german.crawl,
|
|
7
|
+
[Locale.EN_GB]: english.crawl,
|
|
8
|
+
[Locale.EN_US]: english.crawl,
|
|
9
|
+
[Locale.ES_ES]: spanish.crawl,
|
|
10
|
+
[Locale.FA_IR]: persian.crawl,
|
|
11
|
+
[Locale.FR_FR]: french.crawl,
|
|
12
|
+
[Locale.PL_PL]: polish.crawl,
|
|
13
|
+
[Locale.RO_RO]: romanian.crawl,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const crawl = (locale: Locale, word: string): Promise<string> => {
|
|
17
|
+
return crawlPerLocale[locale](word);
|
|
18
|
+
};
|
|
@@ -3,11 +3,9 @@ import { Locale, WordDefinition } from '@scrabble-solver/types';
|
|
|
3
3
|
import { crawl } from './crawl';
|
|
4
4
|
import { parse } from './parse';
|
|
5
5
|
|
|
6
|
-
const getWordDefinition = async (locale: Locale, word: string, isAllowed: boolean): Promise<WordDefinition> => {
|
|
6
|
+
export const getWordDefinition = async (locale: Locale, word: string, isAllowed: boolean): Promise<WordDefinition> => {
|
|
7
7
|
const html = await crawl(locale, word);
|
|
8
8
|
const { definitions, exists } = parse(locale, html);
|
|
9
9
|
const wordDefinition = new WordDefinition({ definitions, exists, isAllowed, word });
|
|
10
10
|
return wordDefinition;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
export default getWordDefinition;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { load } from 'cheerio';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { request } from '../lib';
|
|
4
|
+
import { ParsingResult } from '../types';
|
|
4
5
|
|
|
5
6
|
const DOES_NOT_EXIST_MESSAGE =
|
|
6
7
|
// eslint-disable-next-line max-len
|
|
7
8
|
"The word you've entered isn't in the dictionary. Click on a spelling suggestion below or try again using the search bar above.";
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
+
export const crawl = (word: string): Promise<string> => {
|
|
11
|
+
return request({
|
|
12
|
+
protocol: 'https',
|
|
13
|
+
hostname: 'www.merriam-webster.com',
|
|
14
|
+
path: `/dictionary/${encodeURIComponent(word)}`,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const parse = (html: string): ParsingResult => {
|
|
10
19
|
const $ = load(html);
|
|
11
20
|
$('strong.mw_t_bc').replaceWith(', ');
|
|
12
21
|
$('.text-lowercase').remove();
|
|
@@ -19,5 +28,3 @@ const parseEnglish = (html: string): ParseResult => {
|
|
|
19
28
|
exists: $('.spelling-suggestion-text').text().trim() !== DOES_NOT_EXIST_MESSAGE,
|
|
20
29
|
};
|
|
21
30
|
};
|
|
22
|
-
|
|
23
|
-
export default parseEnglish;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { load } from 'cheerio';
|
|
2
|
+
|
|
3
|
+
import { request } from '../lib';
|
|
4
|
+
import { ParsingResult } from '../types';
|
|
5
|
+
|
|
6
|
+
export const crawl = (word: string): Promise<string> => {
|
|
7
|
+
return request({
|
|
8
|
+
protocol: 'https',
|
|
9
|
+
hostname: 'www.cnrtl.fr',
|
|
10
|
+
path: `/definition/${encodeURIComponent(word)}`,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const parse = (html: string): ParsingResult => {
|
|
15
|
+
const $ = load(html);
|
|
16
|
+
const $definitions = $('.tlf_cdefinition');
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
definitions: Array.from($definitions).map((definition) => $(definition).text()),
|
|
20
|
+
exists: $('#vitemselected span').length > 0,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { Cheerio, CheerioAPI, Element, load } from 'cheerio';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { request } from '../lib';
|
|
4
|
+
import { ParsingResult } from '../types';
|
|
5
|
+
|
|
6
|
+
export const crawl = (word: string): Promise<string> => {
|
|
7
|
+
return request({
|
|
8
|
+
protocol: 'https',
|
|
9
|
+
hostname: 'www.dwds.de',
|
|
10
|
+
path: `/wb/${encodeURIComponent(word)}`,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
4
13
|
|
|
5
|
-
const
|
|
14
|
+
export const parse = (html: string): ParsingResult => {
|
|
6
15
|
const $ = load(html);
|
|
7
16
|
|
|
8
17
|
const definitions = [parseBedeutungsubersicht, parseBedeutungen, parseBedeutung].reduce<string[]>(
|
|
9
|
-
(results,
|
|
18
|
+
(results, parseDefinition) => (results.length === 0 ? parseDefinition($) : results),
|
|
10
19
|
[],
|
|
11
20
|
);
|
|
12
21
|
const exists = Array.from($('.label-danger')).every((label) => $(label).text() !== 'Hinweis');
|
|
@@ -76,5 +85,3 @@ const parseDefinitions = ($: CheerioAPI, $definitions: Cheerio<Element>) => {
|
|
|
76
85
|
.replace(/^[0-9]+\.\s/g, ''),
|
|
77
86
|
);
|
|
78
87
|
};
|
|
79
|
-
|
|
80
|
-
export default parseGerman;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * as english from './english';
|
|
2
|
+
export * as german from './german';
|
|
3
|
+
export * as french from './french';
|
|
4
|
+
export * as persian from './persian';
|
|
5
|
+
export * as polish from './polish';
|
|
6
|
+
export * as romanian from './romanian';
|
|
7
|
+
export * as spanish from './spanish';
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { load } from 'cheerio';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { request } from '../lib';
|
|
4
|
+
import { ParsingResult } from '../types';
|
|
4
5
|
|
|
5
6
|
const DOES_NOT_EXIST_MESSAGE = '404 Page Not Found';
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
+
export const crawl = (word: string): Promise<string> => {
|
|
9
|
+
return request({
|
|
10
|
+
protocol: 'https',
|
|
11
|
+
hostname: 'www.vajehyab.com',
|
|
12
|
+
path: `/moein/${encodeURIComponent(word)}`,
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const parse = (html: string): ParsingResult => {
|
|
8
17
|
const $ = load(html);
|
|
9
18
|
const $definitions = $('[itemprop=articleBody]');
|
|
10
19
|
|
|
@@ -13,5 +22,3 @@ const parseFarsi = (html: string): ParseResult => {
|
|
|
13
22
|
exists: $('#container h1').text() !== DOES_NOT_EXIST_MESSAGE,
|
|
14
23
|
};
|
|
15
24
|
};
|
|
16
|
-
|
|
17
|
-
export default parseFarsi;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { load } from 'cheerio';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { request } from '../lib';
|
|
4
|
+
import { ParsingResult } from '../types';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
export const crawl = (word: string): Promise<string> => {
|
|
7
|
+
return request({
|
|
8
|
+
protocol: 'https',
|
|
9
|
+
hostname: 'sjp.pl',
|
|
10
|
+
path: `/${encodeURIComponent(word)}`,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const parse = (html: string): ParsingResult => {
|
|
6
15
|
const $ = load(html);
|
|
7
16
|
const $header = $($('h1')[0]);
|
|
8
17
|
const $isAllowed = $header.next();
|
|
@@ -13,5 +22,3 @@ const parsePolish = (html: string): ParseResult => {
|
|
|
13
22
|
exists: $isAllowed.text().trim().indexOf('dopuszczalne w grach') >= 0,
|
|
14
23
|
};
|
|
15
24
|
};
|
|
16
|
-
|
|
17
|
-
export default parsePolish;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { load } from 'cheerio';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { request } from '../lib';
|
|
4
|
+
import { ParsingResult } from '../types';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
export const crawl = (word: string): Promise<string> => {
|
|
7
|
+
return request({
|
|
8
|
+
protocol: 'https',
|
|
9
|
+
hostname: 'dexonline.ro',
|
|
10
|
+
path: `/definitie/${encodeURIComponent(word)}`,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const parse = (html: string): ParsingResult => {
|
|
6
15
|
const $ = load(html);
|
|
7
16
|
|
|
8
17
|
const $activeTab = $('.tab-pane.show.active');
|
|
@@ -16,5 +25,3 @@ const parseRomanian = (html: string): ParseResult => {
|
|
|
16
25
|
exists: definitions.length > 0,
|
|
17
26
|
};
|
|
18
27
|
};
|
|
19
|
-
|
|
20
|
-
export default parseRomanian;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { load } from 'cheerio';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { request } from '../lib';
|
|
4
|
+
import { ParsingResult } from '../types';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
export const crawl = (word: string): Promise<string> => {
|
|
7
|
+
return request({
|
|
8
|
+
protocol: 'https',
|
|
9
|
+
hostname: 'www.diccionarios.com',
|
|
10
|
+
path: `/diccionario/espanol/${encodeURIComponent(word)}`,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const parse = (html: string): ParsingResult => {
|
|
6
15
|
const $ = load(html);
|
|
7
16
|
$('.verdBold14 + .gris11 + .gris13').remove();
|
|
8
17
|
$('br + .gris13').remove();
|
|
@@ -31,5 +40,3 @@ const parseSpanish = (html: string): ParseResult => {
|
|
|
31
40
|
exists: $('.wrapper > p > strong').text() !== 'No se ha encontrado la palabra exacta',
|
|
32
41
|
};
|
|
33
42
|
};
|
|
34
|
-
|
|
35
|
-
export default parseSpanish;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { normalizeDefinition } from './normalizeDefinition';
|
|
2
|
+
export { request } from './request';
|
|
3
|
+
export { unique } from './unique';
|
|
@@ -46,10 +46,8 @@ const normalizers: Normalize[] = [
|
|
|
46
46
|
(definition) => definition.trim(),
|
|
47
47
|
];
|
|
48
48
|
|
|
49
|
-
const normalizeDefinition = (definition: string): string => {
|
|
49
|
+
export const normalizeDefinition = (definition: string): string => {
|
|
50
50
|
const normalized = normalizers.reduce((result, normalize) => normalize(result), definition);
|
|
51
51
|
const hasChanged = normalized !== definition;
|
|
52
52
|
return hasChanged ? normalizeDefinition(normalized) : normalized;
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
export default normalizeDefinition;
|
|
@@ -5,7 +5,7 @@ interface Options extends RequestOptions {
|
|
|
5
5
|
protocol?: 'http' | 'https';
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const request = ({ protocol, ...options }: Options): Promise<string> => {
|
|
8
|
+
export const request = ({ protocol, ...options }: Options): Promise<string> => {
|
|
9
9
|
const agent = protocol === 'https' ? https : http;
|
|
10
10
|
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
@@ -27,5 +27,3 @@ const request = ({ protocol, ...options }: Options): Promise<string> => {
|
|
|
27
27
|
.on('error', reject);
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
export default request;
|
|
@@ -2,7 +2,7 @@ import { Locale } from '@scrabble-solver/types';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
|
-
import parse from './parse';
|
|
5
|
+
import { parse } from './parse';
|
|
6
6
|
|
|
7
7
|
export const readTestFile = (filepath: string): string => {
|
|
8
8
|
const absoluteFilepath = path.resolve(__dirname, '__tests__', filepath);
|
|
@@ -26,11 +26,9 @@ const tests = [
|
|
|
26
26
|
];
|
|
27
27
|
|
|
28
28
|
describe('parse', () => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
expect(parse(locale, input)).toEqual(JSON.parse(expected));
|
|
34
|
-
});
|
|
29
|
+
it.each(tests)(`[$locale] "$word"`, ({ locale, word }) => {
|
|
30
|
+
const input = readTestFile(`input/${locale}.${word}.html`);
|
|
31
|
+
const expected = readTestFile(`expected/${locale}.${word}.json`);
|
|
32
|
+
expect(parse(locale, input)).toEqual(JSON.parse(expected));
|
|
35
33
|
});
|
|
36
34
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Locale } from '@scrabble-solver/types';
|
|
2
|
+
|
|
3
|
+
import { english, french, german, persian, polish, romanian, spanish } from './languages';
|
|
4
|
+
import { normalizeDefinition, unique } from './lib';
|
|
5
|
+
import { ParsingResult } from './types';
|
|
6
|
+
|
|
7
|
+
const parsePerLocale: Record<Locale, (html: string) => ParsingResult> = {
|
|
8
|
+
[Locale.DE_DE]: german.parse,
|
|
9
|
+
[Locale.EN_GB]: english.parse,
|
|
10
|
+
[Locale.EN_US]: english.parse,
|
|
11
|
+
[Locale.ES_ES]: spanish.parse,
|
|
12
|
+
[Locale.FA_IR]: persian.parse,
|
|
13
|
+
[Locale.FR_FR]: french.parse,
|
|
14
|
+
[Locale.PL_PL]: polish.parse,
|
|
15
|
+
[Locale.RO_RO]: romanian.parse,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const parse = (locale: Locale, html: string): ParsingResult => {
|
|
19
|
+
const { definitions, exists } = parsePerLocale[locale](html);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
definitions: unique(definitions.map(normalizeDefinition).filter(Boolean)),
|
|
23
|
+
exists,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -1,26 +1,17 @@
|
|
|
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 });
|
|
3
|
+
exports.getWordList = void 0;
|
|
6
4
|
const types_1 = require("@scrabble-solver/types");
|
|
7
|
-
const
|
|
8
|
-
const getEnGbWordList_1 = __importDefault(require("./getEnGbWordList"));
|
|
9
|
-
const getEnUsWordList_1 = __importDefault(require("./getEnUsWordList"));
|
|
10
|
-
const getEsEsWordList_1 = __importDefault(require("./getEsEsWordList"));
|
|
11
|
-
const getFaIrWordList_1 = __importDefault(require("./getFaIrWordList"));
|
|
12
|
-
const getFrFrWordList_1 = __importDefault(require("./getFrFrWordList"));
|
|
13
|
-
const getPlPlWordList_1 = __importDefault(require("./getPlPlWordList"));
|
|
14
|
-
const getRoRoWordList_1 = __importDefault(require("./getRoRoWordList"));
|
|
5
|
+
const languages_1 = require("./languages");
|
|
15
6
|
const localeMap = {
|
|
16
|
-
[types_1.Locale.DE_DE]:
|
|
17
|
-
[types_1.Locale.EN_GB]:
|
|
18
|
-
[types_1.Locale.EN_US]:
|
|
19
|
-
[types_1.Locale.ES_ES]:
|
|
20
|
-
[types_1.Locale.FA_IR]:
|
|
21
|
-
[types_1.Locale.FR_FR]:
|
|
22
|
-
[types_1.Locale.PL_PL]:
|
|
23
|
-
[types_1.Locale.RO_RO]:
|
|
7
|
+
[types_1.Locale.DE_DE]: languages_1.german.getWordList,
|
|
8
|
+
[types_1.Locale.EN_GB]: languages_1.english.getWordListGb,
|
|
9
|
+
[types_1.Locale.EN_US]: languages_1.english.getWordListUs,
|
|
10
|
+
[types_1.Locale.ES_ES]: languages_1.spanish.getWordList,
|
|
11
|
+
[types_1.Locale.FA_IR]: languages_1.persian.getWordList,
|
|
12
|
+
[types_1.Locale.FR_FR]: languages_1.french.getWordList,
|
|
13
|
+
[types_1.Locale.PL_PL]: languages_1.polish.getWordList,
|
|
14
|
+
[types_1.Locale.RO_RO]: languages_1.romanian.getWordList,
|
|
24
15
|
};
|
|
25
16
|
const getWordList = (locale) => localeMap[locale]();
|
|
26
|
-
exports.
|
|
17
|
+
exports.getWordList = getWordList;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export { default as getFrFrWordList } from './getFrFrWordList';
|
|
4
|
-
export { default as getPlPlWordList } from './getPlPlWordList';
|
|
5
|
-
export { default as getDeDeWordList } from './getDeDeWordList';
|
|
6
|
-
export { default as getWordList } from './getWordList';
|
|
1
|
+
export { getWordList } from './getWordList';
|
|
2
|
+
export * from './languages';
|
|
7
3
|
export * from './lib';
|