fix get-words

This commit is contained in:
lingdocs 2022-05-17 17:02:03 -05:00
parent c80b8980be
commit 6e939cc46d
9 changed files with 64 additions and 34 deletions

View File

@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.3.0",
"@lingdocs/lingdocs-main": "^0.3.1",
"@lingdocs/pashto-inflector": "^2.5.5",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",

View File

@ -1,6 +1,6 @@
const fs = require("fs");
const fetch = require("node-fetch");
const { readDictionary } = require("@lingdocs/pashto-inflector");
// const { readDictionary } = require("@lingdocs/pashto-inflector");
const path = require("path");
const wordsPath = path.join(".", "src", "words");
const wordsFile = "raw-words.ts";
@ -27,9 +27,8 @@ const allAdverbTsS = adverbTsFiles.flatMap(fileName => [
console.log("getting words from dictionary...");
fetch(process.env.LINGDOCS_DICTIONARY_URL).then(res => res.arrayBuffer()).then(buffer => {
const dictionary = readDictionary(buffer);
const entries = dictionary.entries;
fetch(process.env.LINGDOCS_DICTIONARY_URL + ".json").then(res => res.json()).then(data => {
const { entries } = data;
// MAKE VERBS FILE
const allWords = [
...getVerbsFromTsS(entries),

View File

@ -0,0 +1,16 @@
import {
Types as T,
EPExplorer,
} from "@lingdocs/pashto-inflector";
import entryFeeder from "../lib/entry-feeder";
function EPBuilder({ opts }: { opts: T.TextOptions }) {
return <div className="mb-4">
<EPExplorer
entryFeeder={entryFeeder}
opts={opts}
/>
</div>;
}
export default EPBuilder;

View File

@ -2,16 +2,15 @@ import {
Types as T,
NPPicker,
} from "@lingdocs/pashto-inflector";
import entryFeeder from "../lib/entry-feeder";
import { useState } from "react";
import PhraseDiagram from "./phrase-diagram/PhraseDiagram";
import entryFeeder from "../lib/entry-feeder";
function NPPlayground({ opts, npIn }: {
opts: T.TextOptions,
npIn: T.NPSelection | undefined,
}) {
const [np, setNp] = useState<T.NPSelection | undefined>(npIn);
console.log({ np });
return <div className="d-flex flex-column align-items-center">
<div style={{ maxWidth: "225px", marginBottom: "2rem" }}>
<NPPicker

View File

@ -1,16 +1,11 @@
---
title: Equative Explorer 🌎
fullWidth: true
---
import {
EPExplorer,
defaultTextOptions,
defaultTextOptions,
} from "@lingdocs/pashto-inflector";
import entryFeeder from "../../lib/entry-feeder";
import EPBuilder from "../../components/EPBuilder";
<div className="mb-4">
<EPExplorer
entryFeeder={entryFeeder}
opts={defaultTextOptions}
/>
</div>
<EPBuilder opts={defaultTextOptions} />

View File

@ -1,9 +1,28 @@
import {
dictionary,
DT,
entryFeeder,
} from "@lingdocs/lingdocs-main";
import { useEffect, useState } from "react";
function useDictionary() {
imp
const [dictionaryStatus, setDictionaryStatus] = useState<DT.DictionaryStatus>("loading");
useEffect(() => {
console.log("starting here");
setDictionaryStatus("loading");
dictionary.initialize().then(() => {
setDictionaryStatus("ready");
}).catch((err) => {
console.log("out of fetch", err);
console.error(err);
setDictionaryStatus("error loading");
});
}, []);
return {
dictionary,
dictionaryStatus,
entryFeeder,
};
}
export default useDictionary;

View File

@ -5,7 +5,6 @@ module.exports = [
{ ts: 1588857967561, e: `bull` }, // غوایه - ghwaayú
{ ts: 1527817108, e: `look, gaze, examination, inspection, spying` }, // کاته - kaatu
{ ts: 1527817768, e: `raven, crow` }, // کارګه - kaargu
{ ts: 1527819245, e: `master of house, head of family, married man` }, // کوربانه - korbaanú
{ ts: 1527818516, e: `swimming, bathing` }, // لمبېده - lambedú
{ ts: 1527813986, e: `sunset, west` }, // لمر پرېواته - lmarprewaatu
{ ts: 1527813992, e: `sunset` }, // لمر لوېده - lmarlwedu

File diff suppressed because one or more lines are too long

View File

@ -1638,16 +1638,19 @@
"@types/yargs" "^16.0.0"
chalk "^4.0.0"
"@lingdocs/lingdocs-main@^0.2.5":
version "0.2.5"
resolved "https://npm.lingdocs.com/@lingdocs%2flingdocs-main/-/lingdocs-main-0.2.5.tgz#435f2f1f8557ffc3aedcead2e7c0c9855b2e8699"
integrity sha512-+Ee+4L1MjaML3DZUmw6BHSj4Pm2HtkBOjK+ZRwOkWSgz4q3tyQxvBVizpsNas6MxvTT0VamVbJHiE6PVrFKWeQ==
"@lingdocs/lingdocs-main@^0.3.1":
version "0.3.1"
resolved "https://npm.lingdocs.com/@lingdocs%2flingdocs-main/-/lingdocs-main-0.3.1.tgz#b09b2d5e1881ee09db136618e28b7777471b66f6"
integrity sha512-TN8sAACCIjnGMFFYvkIp/tVis9z+LevasZrdG9VUrZlaNJ4U8GjbmgLeaY8VthwtivL+pFR1Gtp8BUb5ceeccw==
dependencies:
"@lingdocs/pashto-inflector" "^1.4.4"
"@lingdocs/pashto-inflector" "^2.5.5"
lokijs "^1.5.12"
nano "^9.0.5"
passport-github2 "^0.1.12"
passport-google-oauth "^2.0.0"
passport-twitter "^1.0.4"
relevancy "^0.2.0"
supermemo "^2.0.17"
"@lingdocs/mdx-loader@^0.0.8":
version "0.0.8"
@ -1675,16 +1678,6 @@
typographic-quotes "^1.2.1"
unist-util-visit "^1.4.0"
"@lingdocs/pashto-inflector@^1.4.4":
version "1.9.9"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.9.9.tgz#1882a52a9b6284dd67b6af3c7b0faecec8474b19"
integrity sha512-Ml1tOIM7Fa8zLkpQjBDSxBZG4ge9cizef0VI4AcSwORKXaHmnhji22VLO/a+qq3Uy0fti8DMnVFBDtc5unwKVA==
dependencies:
classnames "^2.2.6"
pbf "^3.2.1"
rambda "^6.7.0"
react-select "^5.2.2"
"@lingdocs/pashto-inflector@^2.5.5":
version "2.5.5"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-2.5.5.tgz#1d42acb3d7bc98400973d75d5a190f8b07ffa5e3"
@ -10720,6 +10713,11 @@ relateurl@^0.2.7:
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
relevancy@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/relevancy/-/relevancy-0.2.0.tgz#230600b24b465f26055e23730a1378b6f329cedb"
integrity sha1-IwYAsktGXyYFXiNzChN4tvMpzts=
remark-footnotes@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/remark-footnotes/-/remark-footnotes-2.0.0.tgz#9001c4c2ffebba55695d2dd80ffb8b82f7e6303f"
@ -11942,6 +11940,11 @@ stylis@^4.0.10:
resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.10.tgz#446512d1097197ab3f02fb3c258358c3f7a14240"
integrity sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==
supermemo@^2.0.17:
version "2.0.17"
resolved "https://registry.yarnpkg.com/supermemo/-/supermemo-2.0.17.tgz#03341ccd1bb824a3726111e7818092e98acff99f"
integrity sha512-c/BMAkG+IDYtAP1AR97DVU4x4gs8vfvLA4ejND7lHKdzjaAWwxixtcZjnQNfcyAKfZn2ovIYKJAGpTG45dr8ug==
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"