big refactor with word typings

This commit is contained in:
lingdocs 2021-10-18 00:39:35 -04:00
parent 672d9dac40
commit f5e2ed40a7
18 changed files with 109 additions and 135 deletions

View File

@ -5,7 +5,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.2.0",
"@lingdocs/pashto-inflector": "^1.2.7",
"@lingdocs/pashto-inflector": "^1.2.8",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",

View File

@ -14,7 +14,7 @@ import {
assembleEquativeOutput,
PredicateInput,
} from "../lib/equative-machine";
import { words } from "../words/words";
import words from "../words/words";
function uniqueSort(arr: Adjective[]): Adjective[];
function uniqueSort(arr: UnisexNoun[]): UnisexNoun[];
@ -58,7 +58,7 @@ function makeBlock(e: PredicateInput): T.VerbBlock {
}
type PredicateType = "adjectives" | "unisexNouns";
type SubjectType = "pronouns" | "nouns";
// type SubjectType = "pronouns" | "nouns";
// TODO: Plural nouns like shoode
const defaultTs = 1527815306;
@ -67,9 +67,9 @@ const defaultPe = inputs.adjectives.find(a => a.ts === defaultTs) || inputs.adje
function EquativeExplorer() {
// TODO: Use sticky state
const predicateTypes: PredicateType[] = ["adjectives", "unisexNouns"];
const subjectTypes: SubjectType[] = ["pronouns", "nouns"];
// const subjectTypes: SubjectType[] = ["pronouns", "nouns"];
const [predicate, setPredicate] = useState<number>(defaultTs);
const [subjectType, setSubjectType] = useState<SubjectType>("pronouns");
// const [subjectType, setSubjectType] = useState<SubjectType>("pronouns");
const [predicateType, setPredicateType] = useState<PredicateType>("adjectives");
function makeOptionLabel(e: T.DictionaryEntry): string {
@ -86,11 +86,11 @@ function EquativeExplorer() {
setPredicateType(pt);
setPredicate(inputs[pt][0].ts);
}
function handleSubjectTypeSelect(e: React.ChangeEvent<HTMLInputElement>) {
const st = e.target.value as SubjectType;
setSubjectType(st);
// setPredicate(inputs[pt][0].ts);
}
// function handleSubjectTypeSelect(e: React.ChangeEvent<HTMLInputElement>) {
// const st = e.target.value as SubjectType;
// setSubjectType(st);
// // setPredicate(inputs[pt][0].ts);
// }
// @ts-ignore
const pe = (inputs[predicateType].find((a: AdjectiveInput | UnisexNounInput) => (
a.ts === predicate
@ -109,7 +109,7 @@ function EquativeExplorer() {
return <>
<div className="d-flex flex-row">
<div className="form-group">
{/* <div className="form-group">
<label htmlFor="subject-select"><strong>Subject:</strong></label>
<div className="form-check">
<input
@ -139,7 +139,7 @@ function EquativeExplorer() {
Nouns
</label>
</div>
</div>
</div> */}
<div className="form-group">
<label htmlFor="predicate-select"><strong>Predicate:</strong></label>
<div className="form-check">

View File

@ -25,7 +25,7 @@ import {
} from "@lingdocs/pashto-inflector";
import shuffle from "../../lib/shuffle-array";
import InflectionCarousel from "../../components/InflectionCarousel";
import { words } from "../../words/words";
import { nouns } from "../../words/words";
import Link from "../../components/Link";
import Table from "../../components/Table";
import { startingWord } from "../../lib/starting-word";
@ -35,7 +35,7 @@ import {
isPattern7FemNoun,
} from "../../lib/type-predicates";
export const femNouns = words.nouns.filter(w => isFemNoun(w));
export const femNouns = nouns.filter(isFemNoun);
The <Link to="/inflection/inflection-patterns/">5 basic patterns in the last chapter</Link> work with both masculine and feminine words (nouns and adjectives).

View File

@ -32,13 +32,13 @@ import {
isUnisexNoun,
} from "../../lib/type-predicates";
import InflectionCarousel from "../../components/InflectionCarousel";
import { words as w } from "../../words/words";
import { nouns, adjectives } from "../../words/words";
import { startingWord } from "../../lib/starting-word";
import Link from "../../components/Link";
export const words = [
...w.nouns.filter(isUnisexNoun),
...w.adjectives,
...nouns.filter(isUnisexNoun),
...adjectives,
];
In the <Link to="/inflection/inflection-intro/">previous chapter</Link> we talked about **why** words inflect. Now we will explain **how** words inflect. What actualy happens to them? How do they change?

View File

@ -14,12 +14,12 @@ import psmd from "../../lib/psmd";
import Carousel from "../../components/Carousel";
import Link from "../../components/Link";
import Formula from "../../components/formula/Formula";
import { words } from "../../words/words";
import { verbs } from "../../words/words";
import shuffleArray from "../../lib/shuffle-array";
import imperfectiveFuture from "./imperfective-future-graph.svg";
import perfectiveFuture from "./perfective-future-graph.svg";
export const basicVerbs = words.verbs.filter((v) => !v.entry.c?.includes("gramm. trans."));
export const basicVerbs = verbs.filter((v) => !v.entry.c?.includes("gramm. trans."));
There are two kinds of future forms in Pashto:

View File

@ -13,7 +13,7 @@ import psmd from "../../lib/psmd";
import Carousel from "../../components/Carousel";
import Link from "../../components/Link";
import Formula from "../../components/formula/Formula";
import { words } from "../../words/words";
import { verbs } from "../../words/words";
import shuffleArray from "../../lib/shuffle-array";
import imperfectiveImperative from "./imperfective-imperative.svg";
import perfectiveImperative from "./perfective-imperative.svg";
@ -25,7 +25,7 @@ There are two forms of the imperative:
1. <i className="fas fa-video" /> Imperfective Imperative
2. <i className="fas fa-camera" /> Perfective Imperative
export const basicVerbs = words.verbs.filter((v) => !v.entry.c?.includes("gramm. trans."));
export const basicVerbs = verbs.filter((v) => !v.entry.c?.includes("gramm. trans."));
## Imperfective Imperative

View File

@ -13,13 +13,11 @@ import psmd from "../../lib/psmd";
import Carousel from "../../components/Carousel";
import Link from "../../components/Link";
import Formula from "../../components/formula/Formula";
import { words } from "../../words/words";
import { verbs } from "../../words/words";
import shuffleArray from "../../lib/shuffle-array";
import realityGraph from "./reality-graph.svg";
import presentTime from "./present-time.svg";
export const verbs = words.verbs;
export const basicVerbs = verbs.filter((v) => !v.entry.c?.includes("gramm. trans."));
The first verb form we'll learn is the **present**. This will be the first tool in our toolbox of verb forms. 🧰 With each verb form we'll learn two things:

View File

@ -25,14 +25,12 @@ import {
} from "@lingdocs/pashto-inflector";
import shuffle from "../../lib/shuffle-array";
import Carousel from "../../components/Carousel";
import { words } from "../../words/words";
import { verbs } from "../../words/words";
import Link from "../../components/Link";
import verbTreeBase from "./verb-tree-base.svg";
import verbTreePastPresent from "./verb-tree-past-present.svg";
import verbTreeImperfectivePerfective from "./verb-tree-imperfective-perfective.svg";
export const verbs = words.verbs;
export const opts = defaultTextOptions;
export function InfoCarousel({ items, highlighted, hidePastParticiple }) {

View File

@ -14,12 +14,12 @@ import psmd from "../../lib/psmd";
import Carousel from "../../components/Carousel";
import Link from "../../components/Link";
import Formula from "../../components/formula/Formula";
import { words } from "../../words/words";
import { verbs } from "../../words/words";
import shuffleArray from "../../lib/shuffle-array";
import presentInReality from "./present-in-reality.svg";
import subjunctiveAboveReality from "./subjunctive-above-reality.svg";
export const basicVerbs = words.verbs.filter((v) => !v.entry.c?.includes("gramm. trans."));
export const basicVerbs = verbs.filter((v) => !v.entry.c?.includes("gramm. trans."));
The **subjunctive** is a very important verb form in Pashto, but it's often ignored by English-speaking learners because we don't really have anything like it in English. So, we need to understand what it is, and then train our brains to reach for it and use it in the right situations!

View File

@ -13,7 +13,7 @@ import {
inflectWord,
isUnisexSet,
} from "@lingdocs/pashto-inflector";
import { words } from "../../words/words";
import { nouns } from "../../words/words";
import {
firstVariation,
} from "../../lib/text-tools";
@ -26,9 +26,9 @@ import { categorize } from "../../lib/categorize";
const genders: T.Gender[] = ["masc", "fem"];
const mascNouns = words.nouns.filter(isMascNoun);
const mascNouns = nouns.filter(isMascNoun);
const femNouns = [
...words.nouns.filter(isFemNoun),
...nouns.filter(isFemNoun),
...getFemVersions(mascNouns.filter(isUnisexNoun)),
];

View File

@ -12,9 +12,9 @@ import {
defaultTextOptions as opts,
inflectWord,
standardizePashto,
// pashtoConsonants,
} from "@lingdocs/pashto-inflector";
import { words } from "../../words/words";
import { nouns } from "../../words/words";
import { intoPatterns } from "../../lib/categorize";
import {
firstVariation,
} from "../../lib/text-tools";
@ -22,15 +22,10 @@ import {
isUnisexNoun,
} from "../../lib/type-predicates";
const nouns = words.nouns.filter(isUnisexNoun);
// type NType = "consonant" | "eyUnstressed" | "eyStressed" | "pashtun" | "withu"
// const types: Record<NType, T.DictionaryEntry[]> = {
// consonant: nouns.filter((w) => pashtoConsonants.includes(w.p.slice(-1))),
// eyUnstressed: nouns.filter((w) => w.f.slice(-2) === "ey"),
// eyStressed: nouns.filter((w) => w.f.slice(-2) === "éy"),
// pashtun: nouns.filter((w) => w.infaf?.includes("aa")),
// withu: nouns.filter((w) => w.infaf?.slice(-1) === "u" && !!w.infaf?.includes("aa")),
// }
const unisexNouns = nouns.filter(isUnisexNoun);
type NType = "pattern1" | "pattern2" | "pattern3" | "pattern4" | "pattern5" | "other";
// TODO: make pattern types as overlay types
const types = intoPatterns(unisexNouns);
const genders: T.Gender[] = ["masc", "fem"];
const amount = 20;
@ -39,16 +34,20 @@ type Question = { entry: T.DictionaryEntry, gender: T.Gender };
export default function UnisexNounGame({ id, link }: { id: string, link: string }) {
function* questions (): Generator<Current<Question>> {
let pool = [...nouns];
let pool = { ...types };
for (let i = 0; i < amount; i++) {
// const keys = Object.keys(types) as NType[];
// let type: NType
// do {
// type = getRandomFromList(keys);
// } while (!pool[type].length);
const entry = getRandomFromList(pool);
const keys = Object.keys(types) as NType[];
let type: NType
do {
type = getRandomFromList(keys);
} while (!pool[type].length);
const entry = getRandomFromList<UnisexNoun>(
// @ts-ignore
pool[type]
);
const gender = getRandomFromList(genders) as T.Gender;
pool = pool.filter((x) => x.ts !== entry.ts);
// @ts-ignore
pool[type] = pool[type].filter((x) => x.ts !== entry.ts);
yield {
progress: makeProgress(i, amount),
question: {

View File

@ -1,11 +1,9 @@
import {
isNoun,
isPattern1Word,
isPattern2Word,
isPattern3Word,
isPattern4Word,
isPattern5Word,
isPattern6FemNoun,
} from "./type-predicates";
/**
@ -75,23 +73,25 @@ export function categorize<I, X extends Record<string, I[]>>(
return o;
}
export function intoPatterns(words: (Noun | Adjective)[]): {
"pattern1": Pattern1Word[],
"pattern2": Pattern2Word[],
"pattern3": Pattern3Word[],
"pattern4": Pattern4Word[],
"pattern5": Pattern5Word[],
"non-inflecting": NonInflecting[],
"pattern6fem": Pattern6FemNoun[],
// TODO: uncategorizable words like ایرې - n. f. pl. -- could be pattern 1 or 2 🤷‍♂️
export function intoPatterns<T extends (Noun | Adjective)>(words: T[]): {
"pattern1": Pattern1Word<T>[],
"pattern2": Pattern2Word<T>[],
"pattern3": Pattern3Word<T>[],
"pattern4": Pattern4Word<T>[],
"pattern5": Pattern5Word<T>[],
"other": NonInflecting<T>[],
// "pattern6fem": Pattern6FemNoun<T>[],
} {
return categorize<(Noun | Adjective), {
"pattern1": Pattern1Word[],
"pattern2": Pattern2Word[],
"pattern3": Pattern3Word[],
"pattern4": Pattern4Word[],
"pattern5": Pattern5Word[],
"non-inflecting": NonInflecting[],
"pattern6fem": Pattern6FemNoun[],
"pattern1": Pattern1Word<T>[],
"pattern2": Pattern2Word<T>[],
"pattern3": Pattern3Word<T>[],
"pattern4": Pattern4Word<T>[],
"pattern5": Pattern5Word<T>[],
"other": NonInflecting<T>[],
// "pattern6fem": Pattern6FemNoun<T>[],
}>(
words,
{
@ -100,8 +100,8 @@ export function intoPatterns(words: (Noun | Adjective)[]): {
"pattern3": isPattern3Word,
"pattern4": isPattern4Word,
"pattern5": isPattern5Word,
"pattern6fem": (n) => (isNoun(n) && isPattern6FemNoun(n)),
"non-inflecting": "leftovers",
// "pattern6fem": (n) => (isNoun(n) && isPattern6FemNoun(n)),
"other": "leftovers",
},
);
}

View File

@ -2,7 +2,6 @@ import {
pashtoConsonants,
endsWith,
countSyllables,
removeAccents,
} from "@lingdocs/pashto-inflector";
export function isNoun(e: Word): e is Noun {
@ -47,11 +46,14 @@ export function isAdjOrUnisexNoun(e: Word): e is (Adjective | UnisexNoun) {
* @param e
* @returns
*/
export function isPattern1Word(e: Noun | Adjective): e is Pattern1Word {
export function isPattern1Word<T extends (Noun | Adjective)>(e: T): e is Pattern1Word<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNoun(e)) {
return endsWith({ p: "ه", f: "a" }, e) && (endsWith({ p: pashtoConsonants }, e) && e.c.includes("anim."));
return (
endsWith([{ p: "ه", f: "a" }, { p: "ح", f: "a" }], e) ||
(endsWith({ p: pashtoConsonants }, e) && !e.c.includes("anim."))
);
}
return (
endsWith([{ p: pashtoConsonants }], e) ||
@ -66,14 +68,14 @@ export function isPattern1Word(e: Noun | Adjective): e is Pattern1Word {
* @param e
* @returns
*/
export function isPattern2Word(e: Noun | Adjective): e is Pattern2Word {
export function isPattern2Word<T extends (Noun | Adjective)>(e: T): e is Pattern2Word<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNoun(e)) {
return !e.c.includes("pl.") && endsWith({ p: "ې", f: "e" }, e, true);
}
// TODO: check if it's a single syllable word, in which case it would be pattern 1
return endsWith({ p: "ی", f: "ey" }, e, true)// && (countSyllables(e.f) > 1);
return endsWith({ p: "ی", f: "ey" }, e, true) && (countSyllables(e.f) > 1);
}
/**
@ -82,13 +84,13 @@ export function isPattern2Word(e: Noun | Adjective): e is Pattern2Word {
* @param e
* @returns
*/
export function isPattern3Word(e: Noun | Adjective): e is Pattern3Word {
export function isPattern3Word<T extends (Noun | Adjective)>(e: T): e is Pattern3Word<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNoun(e)) {
return endsWith({ p: "ۍ" }, e);
}
return (countSyllables(removeAccents(e.f)) > 1)
return (countSyllables(e.f) > 1)
? endsWith({ p: "ی", f: "éy" }, e, true)
: endsWith({ p: "ی", f: "ey" }, e)
}
@ -99,7 +101,7 @@ export function isPattern3Word(e: Noun | Adjective): e is Pattern3Word {
* @param e
* @returns
*/
export function isPattern4Word(e: Noun | Adjective): e is Pattern4Word {
export function isPattern4Word<T extends (Noun | Adjective)>(e: T): e is Pattern4Word<T> {
if (e.noInf) return false;
return (
!!(e.infap && e.infaf && e.infbp && e.infbf)
@ -114,7 +116,7 @@ export function isPattern4Word(e: Noun | Adjective): e is Pattern4Word {
* @param e
* @returns
*/
export function isPattern5Word(e: Noun | Adjective): e is Pattern5Word {
export function isPattern5Word<T extends (Noun | Adjective)>(e: T): e is Pattern5Word<T> {
if (e.noInf) return false;
return (
!!(e.infap && e.infaf && e.infbp && e.infbf)
@ -125,7 +127,7 @@ export function isPattern5Word(e: Noun | Adjective): e is Pattern5Word {
);
}
export function isPattern6FemNoun(e: Noun): e is Pattern6FemNoun {
export function isPattern6FemNoun(e: FemNoun): e is Pattern6FemNoun<FemNoun> {
if (!isFemNoun(e)) return false;
if (e.c.includes("anim.")) return false;
return e.p.slice(-1) === "ي";

14
src/types.d.ts vendored
View File

@ -38,13 +38,13 @@ type RawWord = T.DictionaryEntry | {
};
// TODO: Write type predicates for these
type Pattern1Word = (Noun | Adjective) & { __brand3: "basic inflection pattern" };
type Pattern2Word = (Noun | Adjective) & { __brand3: "ending in unstressed ی pattern" };
type Pattern3Word = (Noun | Adjective) & { __brand3: "ending in stressed ی pattern" };
type Pattern4Word = (Noun | Adjective) & { __brand3: "Pashtoon pattern" };
type Pattern5Word = (Noun | Adjective) & { __brand3: "short squish pattern" };
type Pattern6FemNoun = FemNoun & { __brand3: "non anim. ending in ي" };
type NonInflecting = (Noun | Adjective) & { __brand3: "non-inflecting" };
type Pattern1Word<T> = T & { __brand3: "basic inflection pattern" };
type Pattern2Word<T> = T & { __brand3: "ending in unstressed ی pattern" };
type Pattern3Word<T> = T & { __brand3: "ending in stressed ی pattern" };
type Pattern4Word<T> = T & { __brand3: "Pashtoon pattern" };
type Pattern5Word<T> = T & { __brand3: "short squish pattern" };
type Pattern6FemNoun<T extends FemNoun> = FemNoun & { __brand3: "non anim. ending in ي" };
type NonInflecting<T> = T & { __brand3: "non-inflecting" };
// PLUS FEM INFLECTING
type Word = Noun | Adjective | Verb;

View File

@ -1,6 +1,5 @@
module.exports = [
{ ts: 1527818948, e: `sneezing, sneeze` }, // اټسکی - aTúskey
{ ts: 1527816481, e: `brother in law; sister's husband` }, // اخښی - akhxey
{ ts: 1573681135691, e: `tribal constable, tribal offical with police powers` }, // اربکی - arbakéy
{ ts: 1573659054031, e: `width, spaciousness` }, // ارتوالی - artwaaley, aratwaaley
{ ts: 1527811890, e: `thorn, prickle` }, // ازغی - azghey
@ -13,8 +12,6 @@ module.exports = [
{ ts: 1527821545, e: `volcano` }, // اورشیندی - orsheendéy
{ ts: 1527819192, e: `train` }, // اورګاډی - orgáaDey
{ ts: 1527815585, e: `summer` }, // اوړی - oRey
{ ts: 1527815132, e: `giraffe` }, // اوښ غویی - oox ghwayey
{ ts: 1527816488, e: `brother in law, wife's brother` }, // اوښی - awxey
{ ts: 1623044357441, e: `tuft, clump, shock of hair` }, // ببوتنکی - bubootúnkey
{ ts: 1527821668, e: `spark, speck, flicker` }, // بڅری - batsúrey
{ ts: 1527821239, e: `kidney` }, // بډوری - baDóorey
@ -69,14 +66,10 @@ module.exports = [
{ ts: 1527819046, e: `drop` }, // څاڅکی - tsáatskey
{ ts: 1527817874, e: `quality, nature` }, // څرنګوالی - tsurangwaaley
{ ts: 1527814041, e: `spring (season)` }, // څړمنی - tsaRmuney
{ ts: 1527813361, e: `column, pilliar, pyramid` }, // څلی - tsaley
{ ts: 1527819027, e: `ladle, dipper` }, // څمڅی - tsamtsey
{ ts: 1573055311846, e: `warning, notice, alarm` }, // خبرداری - khabardaarey
{ ts: 1527820324, e: `melon` }, // خټکی - khaTakéy
{ ts: 1527819828, e: `weight; respect, honour` }, // درناوی - dranaawey
{ ts: 1588161660483, e: `crutch, walking-stick, cane` }, // ډانګوری - Daangooréy
{ ts: 1527813493, e: `majority; heap, pile` }, // ډېری - Derey
{ ts: 1527823700, e: `avalanche, flood, shower` }, // راشی - raashey
{ ts: 1527819732, e: `young, youth, young lad` }, // زلمی - zalméy
{ ts: 1527813708, e: `good news, gospel` }, // زېری - zerey
{ ts: 1588758498458, e: `jaundice` }, // زېړی - zeRéy
@ -105,8 +98,6 @@ module.exports = [
{ ts: 1527814569, e: `member` }, // غړی - ghuRey
{ ts: 1527817627, e: `arrow` }, // غشی - ghúshey
{ ts: 1527822913, e: `precious stone, precious stone in a signet ring` }, // غمی - ghaméy
{ ts: 1527823466, e: `ear lobe` }, // غنګوری - ghangóorey
{ ts: 1527818483, e: `plate` }, // غوری - ghorey
{ ts: 1527816181, e: `vomit, nausea (Arabic)` }, // قی - qey
{ ts: 1527814715, e: `user` }, // کاروونکی - kaarawoonkey
{ ts: 1527823295, e: `stone, rock` }, // کاڼی - káaNey
@ -115,7 +106,6 @@ module.exports = [
{ ts: 1582388629980, e: `pupil (of an eye)` }, // کسی - kúsey
{ ts: 1594906790729, e: `boy` }, // ککی - kakéy
{ ts: 1527812836, e: `village` }, // کلی - kuley, kiley
{ ts: 1527816880, e: `shortage, lack, deficiency` }, // کمی - kamey
{ ts: 1610616852625, e: `echo` }, // کنګرېزی - kangrezéy
{ ts: 1527819196, e: `car, train` }, // ګاډی - gaaDey
{ ts: 1579016593220, e: `beehive; wasps' nest` }, // ګنی - ganéy
@ -125,17 +115,13 @@ module.exports = [
{ ts: 1573149568665, e: `access, availability` }, // لاسرسی - laasraséy
{ ts: 1527817464, e: `wood, timber` }, // لرګی - largey
{ ts: 1527822801, e: `sleeve` }, // لستوڼی - lastóNey
{ ts: 1527812416, e: `brook, rivulet, small irrigation` }, // لښتی - laxtey
{ ts: 1527814401, e: `toy` }, // لوبونی - lobawuney
{ ts: 1527814519, e: `side, direction` }, // لوری - lorey
{ ts: 1527823103, e: `perspective, viewpoint` }, // لیدلوری - leedlorey
{ ts: 1527819920, e: `mosquito, midge` }, // ماشی - maashey
{ ts: 1527820224, e: `fly swatter` }, // مچوژی - muchwajzéy
{ ts: 1591871316865, e: `prefix (grammar)` }, // مختاړی - mukhtaaRey
{ ts: 1527817105, e: `smile, smiling` }, // مړخندی - muRkhandey
{ ts: 1527817770, e: `dead body, corpse` }, // مړی - múRey
{ ts: 1527813189, e: `fall, autumn` }, // منی - máney
{ ts: 1527812925, e: `peanut` }, // مومپلی - mompaley
{ ts: 1527812421, e: `ant` }, // مېږی - meGey
{ ts: 1527819227, e: `lack` }, // نشتوالی - nashtwaaley
{ ts: 1527823577, e: `sapling, seedling, sprout, young tree` }, // نیالګی - niyaalgey
@ -143,7 +129,5 @@ module.exports = [
{ ts: 1527812668, e: `welcome` }, // هرکلی - hărkáley
{ ts: 1588153218244, e: `height, elevation, tallness` }, // هسکوالی - haskwáaley
{ ts: 1585309922022, e: `flu, respiratory illness, influenza, cold` }, // والګی - waalgéy
{ ts: 1527813014, e: `vein, nerve` }, // وژی - wajzey
{ ts: 1527821465, e: `shoulder` }, // ولی - wuléy
{ ts: 1527814004, e: `summer` }, // ووړی - woRey
]

File diff suppressed because one or more lines are too long

View File

@ -1,40 +1,32 @@
import rawWords from "./raw-words";
import {
isAdjective,
// isFemNoun,
// isMascNoun,
isNoun,
isVerb,
} from "../lib/type-predicates";
import { categorize, intoPatterns } from "../lib/categorize";
import { categorize } from "../lib/categorize";
export const words = categorize<Word, Words>(rawWords, {
const words = categorize<Word, Words>(rawWords, {
"nouns": isNoun,
"adjectives": isAdjective,
"verbs": isVerb,
});
console.log(
Object.entries(
intoPatterns([
...words.nouns,
...words.adjectives
])
).reduce((ob, [key, arr]) => {
return {
...ob,
[key]: arr.map(a => `${a.f} - ${a.p} - ${a.c}`),
};
}, {})
);
export default words;
// const genderedNouns = categorize<Noun, { masc: MascNoun[], fem: FemNoun[] }>(
// words.nouns,
// {
// "masc": isMascNoun,
// "fem": isFemNoun,
// },
export const { nouns, adjectives, verbs } = words;
// console.log(
// Object.entries(
// intoPatterns([
// ...words.nouns,
// ...words.adjectives
// ])
// ).reduce((ob, [key, arr]) => {
// return {
// ...ob,
// // @ts-ignore
// [key]: arr.map(a => a.f),
// };
// }, {})
// );
// console.log(genderedNouns);

View File

@ -1619,10 +1619,10 @@
pbf "^3.2.1"
rambda "^6.7.0"
"@lingdocs/pashto-inflector@^1.2.6":
version "1.2.6"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.2.6.tgz#41c3d8e663d4b4c1ef37bd49d7de536e05776a4d"
integrity sha512-7FiMasn312whe9izP+E/b2Img4pUf2wzPv8Y+ZHMqtG9AhAatlKYC/IiS8PoG+EPXJ1BoSQ8UmUMao5qmu0G+w==
"@lingdocs/pashto-inflector@^1.2.8":
version "1.2.8"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.2.8.tgz#db1a94e3d9bcc067525d9496efa7ca591f56d373"
integrity sha512-uW7JtCXYinAVJhGrD3dwwpZ198uaZ5LZJWbfg9PUac3e7PSeZPX+/UJgGRggaWOcOUdqs8ZnKuWpCM+KrgZplg==
dependencies:
classnames "^2.2.6"
pbf "^3.2.1"