This commit is contained in:
parent
fc9dfe0299
commit
bbc1187684
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,7 @@
|
||||||
"main": "lib/functions/src/index.js",
|
"main": "lib/functions/src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/storage": "^5.8.1",
|
"@google-cloud/storage": "^5.8.1",
|
||||||
"@lingdocs/pashto-inflector": "2.1.9",
|
"@lingdocs/pashto-inflector": "2.3.1",
|
||||||
"@types/cors": "^2.8.10",
|
"@types/cors": "^2.8.10",
|
||||||
"@types/google-spreadsheet": "^3.0.2",
|
"@types/google-spreadsheet": "^3.0.2",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
@ -35,6 +35,6 @@
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@lingdocs/pashto-inflector": "2.1.9"
|
"@lingdocs/pashto-inflector": "2.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,7 @@
|
||||||
"url": "git@github.com-lingdocs:lingdocs/lingdocs-main.git"
|
"url": "git@github.com-lingdocs:lingdocs/lingdocs-main.git"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@lingdocs/pashto-inflector": "2.1.9"
|
"@lingdocs/pashto-inflector": "2.3.1"
|
||||||
},
|
},
|
||||||
"author": "lingdocs.com",
|
"author": "lingdocs.com",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
"passport-github2": "^0.1.12",
|
"passport-github2": "^0.1.12",
|
||||||
"passport-google-oauth": "^2.0.0",
|
"passport-google-oauth": "^2.0.0",
|
||||||
"passport-twitter": "^1.0.4",
|
"passport-twitter": "^1.0.4",
|
||||||
"@lingdocs/pashto-inflector": "2.1.9"
|
"@lingdocs/pashto-inflector": "2.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/passport-github2": "^1.2.5",
|
"@types/passport-github2": "^1.2.5",
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^5.15.2",
|
"@fortawesome/fontawesome-free": "^5.15.2",
|
||||||
"@lingdocs/pashto-inflector": "2.1.9",
|
"@lingdocs/pashto-inflector": "2.3.1",
|
||||||
"@testing-library/jest-dom": "^5.11.4",
|
"@testing-library/jest-dom": "^5.11.4",
|
||||||
"@testing-library/react": "^11.1.0",
|
"@testing-library/react": "^11.1.0",
|
||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
|
@ -100,6 +100,6 @@
|
||||||
"user-event": "^4.0.0"
|
"user-event": "^4.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@lingdocs/pashto-inflector": "2.1.9"
|
"@lingdocs/pashto-inflector": "2.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,12 +357,39 @@ export function allEntries() {
|
||||||
return dictDb.collection.find();
|
return dictDb.collection.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNounByTs(ts: number): undefined | T.NounEntry {
|
function makeLookupPortal<X extends T.DictionaryEntry>(tpFilter: (x: T.DictionaryEntry) => x is X): T.EntryLookupPortal<X> {
|
||||||
|
return {
|
||||||
|
search: (s: string) => fuzzyLookup({
|
||||||
|
searchString: s,
|
||||||
|
language: "Pashto",
|
||||||
|
page: 1,
|
||||||
|
tpFilter,
|
||||||
|
}),
|
||||||
|
getByTs: (ts: number) => {
|
||||||
const res = dictDb.findOneByTs(ts);
|
const res = dictDb.findOneByTs(ts);
|
||||||
if (!res) return undefined;
|
if (!res) return undefined;
|
||||||
return tp.isNounEntry(res) ? res : undefined;
|
return tpFilter(res) ? res : undefined;
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export function getVerbByTs(ts: number): undefined | T.VerbEntry {
|
|
||||||
|
function makeVerbLookupPortal(): T.EntryLookupPortal<T.VerbEntry> {
|
||||||
|
return {
|
||||||
|
search: (s: string) => {
|
||||||
|
const vEntries = fuzzyLookup({
|
||||||
|
searchString: s,
|
||||||
|
language: "Pashto",
|
||||||
|
page: 1,
|
||||||
|
tpFilter: tp.isVerbDictionaryEntry,
|
||||||
|
});
|
||||||
|
return vEntries.map((entry): T.VerbEntry => ({
|
||||||
|
entry,
|
||||||
|
complement: (entry.c?.includes("comp.") && entry.l)
|
||||||
|
? dictionary.findOneByTs(entry.l)
|
||||||
|
: undefined,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
getByTs: (ts: number): T.VerbEntry | undefined => {
|
||||||
const entry = dictDb.findOneByTs(ts);
|
const entry = dictDb.findOneByTs(ts);
|
||||||
if (!entry) return undefined;
|
if (!entry) return undefined;
|
||||||
if (!tp.isVerbDictionaryEntry(entry)) {
|
if (!tp.isVerbDictionaryEntry(entry)) {
|
||||||
|
@ -381,31 +408,15 @@ export function getVerbByTs(ts: number): undefined | T.VerbEntry {
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
return { entry, complement };
|
return { entry, complement };
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function searchNouns(s: string): T.NounEntry[] {
|
export const entryFeeder: T.EntryFeeder = {
|
||||||
console.log("searching nouns");
|
nouns: makeLookupPortal(tp.isNounEntry),
|
||||||
return fuzzyLookup({
|
verbs: makeVerbLookupPortal(),
|
||||||
searchString: s,
|
adjectives: makeLookupPortal(tp.isAdjectiveEntry),
|
||||||
language: "Pashto",
|
locativeAdverbs: makeLookupPortal(tp.isLocativeAdverbEntry),
|
||||||
page: 1,
|
|
||||||
tpFilter: tp.isNounEntry,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function searchVerbs(s: string): T.VerbEntry[] {
|
|
||||||
const vEntries = fuzzyLookup({
|
|
||||||
searchString: s,
|
|
||||||
language: "Pashto",
|
|
||||||
page: 1,
|
|
||||||
tpFilter: tp.isVerbDictionaryEntry,
|
|
||||||
});
|
|
||||||
return vEntries.map((entry): T.VerbEntry => ({
|
|
||||||
entry,
|
|
||||||
complement: (entry.c?.includes("comp.") && entry.l)
|
|
||||||
? dictionary.findOneByTs(entry.l)
|
|
||||||
: undefined,
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dictionary: DictionaryAPI = {
|
export const dictionary: DictionaryAPI = {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { VPExplorer } from "@lingdocs/pashto-inflector";
|
||||||
|
import { entryFeeder } from "../lib/dictionary";
|
||||||
import {
|
import {
|
||||||
ConjugationViewer,
|
ConjugationViewer,
|
||||||
InflectionsTable,
|
InflectionsTable,
|
||||||
|
@ -16,6 +18,7 @@ import {
|
||||||
Types as T,
|
Types as T,
|
||||||
InlinePs,
|
InlinePs,
|
||||||
validateEntry,
|
validateEntry,
|
||||||
|
typePredicates,
|
||||||
} from "@lingdocs/pashto-inflector";
|
} from "@lingdocs/pashto-inflector";
|
||||||
import Entry from "../components/Entry";
|
import Entry from "../components/Entry";
|
||||||
import * as FT from "../types/functions-types";
|
import * as FT from "../types/functions-types";
|
||||||
|
@ -338,6 +341,19 @@ function EntryEditor({ isolatedEntry, dictionary, searchParams, textOptions, use
|
||||||
{inf && "plural" in inf && inf.plural !== undefined && <InflectionsTable inf={inf.plural} textOptions={textOptions} />}
|
{inf && "plural" in inf && inf.plural !== undefined && <InflectionsTable inf={inf.plural} textOptions={textOptions} />}
|
||||||
{inf && "arabicPlural" in inf && inf.arabicPlural !== undefined && <InflectionsTable inf={inf.arabicPlural} textOptions={textOptions} />}
|
{inf && "arabicPlural" in inf && inf.arabicPlural !== undefined && <InflectionsTable inf={inf.arabicPlural} textOptions={textOptions} />}
|
||||||
{/* TODO: aay tail from state options */}
|
{/* TODO: aay tail from state options */}
|
||||||
|
{typePredicates.isVerbEntry({ entry, complement }) && <div className="pb-4">
|
||||||
|
<VPExplorer
|
||||||
|
verb={{
|
||||||
|
// TODO: CLEAN THIS UP!
|
||||||
|
// @ts-ignore
|
||||||
|
entry,
|
||||||
|
complement,
|
||||||
|
}}
|
||||||
|
opts={textOptions}
|
||||||
|
entryFeeder={entryFeeder}
|
||||||
|
handleLinkClick="none"
|
||||||
|
/>
|
||||||
|
</div>}
|
||||||
<ConjugationViewer
|
<ConjugationViewer
|
||||||
entry={entry}
|
entry={entry}
|
||||||
complement={complement}
|
complement={complement}
|
||||||
|
|
|
@ -33,12 +33,7 @@ import AudioPlayButton from "../components/AudioPlayButton";
|
||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
import { Modal } from "react-bootstrap";
|
import { Modal } from "react-bootstrap";
|
||||||
import { getTextOptions } from "../lib/get-text-options";
|
import { getTextOptions } from "../lib/get-text-options";
|
||||||
import {
|
import { entryFeeder } from "../lib/dictionary";
|
||||||
searchNouns,
|
|
||||||
searchVerbs,
|
|
||||||
getNounByTs,
|
|
||||||
getVerbByTs,
|
|
||||||
} from "../lib/dictionary";
|
|
||||||
|
|
||||||
function IsolatedEntry({ state, dictionary, isolateEntry }: {
|
function IsolatedEntry({ state, dictionary, isolateEntry }: {
|
||||||
state: State,
|
state: State,
|
||||||
|
@ -214,10 +209,7 @@ function IsolatedEntry({ state, dictionary, isolateEntry }: {
|
||||||
complement,
|
complement,
|
||||||
}}
|
}}
|
||||||
opts={textOptions}
|
opts={textOptions}
|
||||||
nouns={searchNouns}
|
entryFeeder={entryFeeder}
|
||||||
verbs={searchVerbs}
|
|
||||||
getNounByTs={getNounByTs}
|
|
||||||
getVerbByTs={getVerbByTs}
|
|
||||||
handleLinkClick={isolateEntry}
|
handleLinkClick={isolateEntry}
|
||||||
/>
|
/>
|
||||||
</div>}
|
</div>}
|
||||||
|
|
|
@ -1585,10 +1585,10 @@
|
||||||
"@types/yargs" "^16.0.0"
|
"@types/yargs" "^16.0.0"
|
||||||
chalk "^4.0.0"
|
chalk "^4.0.0"
|
||||||
|
|
||||||
"@lingdocs/pashto-inflector@2.1.9":
|
"@lingdocs/pashto-inflector@2.3.1":
|
||||||
version "2.1.9"
|
version "2.3.1"
|
||||||
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-2.1.9.tgz#a906d118d687e4eafd2f0d91aac0cd80b888b8df"
|
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-2.3.1.tgz#bfb5be4e2d821671389a3224ca704affedf1997d"
|
||||||
integrity sha512-r2rh9EWG3GpgXiqEuc52QZTRwXrL61uolZSCEbjnXV+k2kG07JjPmnchQORZfbPmjsx301rzzoywR5Ko+F2qpw==
|
integrity sha512-ODJJo8UZFs6hO6rNQYNaxKNsPyeIEeARqRxrMKfwm4G2hdqx5k5CHoSM8fSRXsrne4dAhll+biexlqvSNXNn4w==
|
||||||
dependencies:
|
dependencies:
|
||||||
classnames "^2.2.6"
|
classnames "^2.2.6"
|
||||||
pbf "^3.2.1"
|
pbf "^3.2.1"
|
||||||
|
|
|
@ -168,10 +168,10 @@
|
||||||
"resolved" "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz"
|
"resolved" "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz"
|
||||||
"version" "9.2.1"
|
"version" "9.2.1"
|
||||||
|
|
||||||
"@lingdocs/pashto-inflector@2.1.9":
|
"@lingdocs/pashto-inflector@2.3.0":
|
||||||
"integrity" "sha512-r2rh9EWG3GpgXiqEuc52QZTRwXrL61uolZSCEbjnXV+k2kG07JjPmnchQORZfbPmjsx301rzzoywR5Ko+F2qpw=="
|
"integrity" "sha512-XWiQqgjS4pEusMQSj6IVoIhmgP2z2I7ZNR1cID1yOJ5yxtEN1V8Hq8vAAGxf+RhvIZ+qTPID6FEtGXxUmQbAjg=="
|
||||||
"resolved" "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-2.1.9.tgz"
|
"resolved" "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-2.3.0.tgz"
|
||||||
"version" "2.1.9"
|
"version" "2.3.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"classnames" "^2.2.6"
|
"classnames" "^2.2.6"
|
||||||
"pbf" "^3.2.1"
|
"pbf" "^3.2.1"
|
||||||
|
|
Loading…
Reference in New Issue