more on past

This commit is contained in:
lingdocs 2022-06-30 20:09:47 -05:00
parent 1a5dc210ce
commit d4968dc681
5 changed files with 61 additions and 25 deletions

View File

@ -6,7 +6,7 @@
"@formkit/auto-animate": "^1.0.0-beta.1", "@formkit/auto-animate": "^1.0.0-beta.1",
"@fortawesome/fontawesome-free": "^5.15.4", "@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.3.1", "@lingdocs/lingdocs-main": "^0.3.1",
"@lingdocs/pashto-inflector": "^3.1.6", "@lingdocs/pashto-inflector": "^3.1.8",
"@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",

View File

@ -9,17 +9,20 @@ import {
getEnglishVerb, getEnglishVerb,
InlinePs, InlinePs,
removeFVarients, removeFVarients,
isPastTense,
} from "@lingdocs/pashto-inflector"; } from "@lingdocs/pashto-inflector";
import { isImperativeTense } from "@lingdocs/pashto-inflector/dist/lib/type-predicates"; import { isImperativeTense } from "@lingdocs/pashto-inflector/dist/lib/type-predicates";
import { useState } from "react"; import { useState } from "react";
import Carousel from "./Carousel"; import Carousel from "./Carousel";
import { basicVerbs } from "../content/verbs/basic-present-verbs"; import { basicVerbs, intransitivePast } from "../content/verbs/basic-present-verbs";
import { getLength } from "@lingdocs/pashto-inflector/dist/lib/p-text-helpers";
function BasicVerbShowCase({ opts, tense }: { function BasicVerbShowCase({ opts, tense }: {
opts: T.TextOptions, opts: T.TextOptions,
tense: T.VerbTense | T.ImperativeTense, tense: T.VerbTense | T.ImperativeTense,
}) { }) {
return <Carousel stickyTitle items={basicVerbs} render={(item) => { const items = isPastTense(tense) ? intransitivePast : basicVerbs;
return <Carousel stickyTitle items={items} render={(item) => {
return { return {
title: <InlinePs opts={opts}>{{ title: <InlinePs opts={opts}>{{
...removeFVarients(item.entry), ...removeFVarients(item.entry),
@ -42,13 +45,14 @@ function BasicVerbChart({ verb, opts, tense }: {
tense: T.VerbTense | T.ImperativeTense, tense: T.VerbTense | T.ImperativeTense,
}) { }) {
const [negative, setNegative] = useState<boolean>(false); const [negative, setNegative] = useState<boolean>(false);
const [length, setLength] = useState<"short" | "long">("short");
const c = conjugateVerb(verb.entry, verb.complement); const c = conjugateVerb(verb.entry, verb.complement);
const conjugations = "stative" in c const conjugations = "stative" in c
? c.stative ? c.stative
: "grammaticallyTransitive" in c : "grammaticallyTransitive" in c
? c.grammaticallyTransitive ? c.grammaticallyTransitive
: c; : c;
const phrasesForTable = makeExamplePhrases(verb, tense, negative) const phrasesForTable = makeExamplePhrases(verb, tense, negative, length)
return <div> return <div>
<div> <div>
{getEnglishVerb(verb.entry)} {getEnglishVerb(verb.entry)}
@ -59,7 +63,19 @@ function BasicVerbChart({ verb, opts, tense }: {
hidePastParticiple={true} hidePastParticiple={true}
highlighted={[tenseToStem(tense)]} highlighted={[tenseToStem(tense)]}
/> />
<div className="my-3"> <div className="my-3 d-flex flex-row justify-content-center">
{isPastTense(tense) && <div className="mx-2">
<ButtonSelect
handleChange={setLength}
value={length}
small
options={[
{ value: "long", label: "long" },
{ value: "short", label: "short" },
]}
/>
</div>}
<div className="mx-2">
<ButtonSelect <ButtonSelect
handleChange={(value) => setNegative(value === "true")} handleChange={(value) => setNegative(value === "true")}
value={String(negative)} value={String(negative)}
@ -70,6 +86,7 @@ function BasicVerbChart({ verb, opts, tense }: {
]} ]}
/> />
</div> </div>
</div>
<div className="text-left"> <div className="text-left">
<VerbTable <VerbTable
textOptions={opts} textOptions={opts}
@ -80,7 +97,7 @@ function BasicVerbChart({ verb, opts, tense }: {
</div> </div>
} }
function makeExamplePhrases(verb: T.VerbEntry, tense: T.VerbTense | T.ImperativeTense, negative: boolean): { ps: T.VerbBlock | T.ImperativeBlock, e: T.EnglishBlock } { function makeExamplePhrases(verb: T.VerbEntry, tense: T.VerbTense | T.ImperativeTense, negative: boolean, length: "short" | "long"): { ps: T.VerbBlock | T.ImperativeBlock, e: T.EnglishBlock } {
function makeSelection(person: T.Person): T.VPSelectionComplete{ function makeSelection(person: T.Person): T.VPSelectionComplete{
return { return {
"blocks": [ "blocks": [
@ -111,13 +128,13 @@ function makeExamplePhrases(verb: T.VerbEntry, tense: T.VerbTense | T.Imperative
function makePhrase(person: T.Person): { ps: T.ArrayOneOrMore<T.PsString>, e: string } { function makePhrase(person: T.Person): { ps: T.ArrayOneOrMore<T.PsString>, e: string } {
const selection = makeSelection(person); const selection = makeSelection(person);
const rendered = renderVP(selection); const rendered = renderVP(selection);
const compiled = compileVP(rendered, rendered.form, true); const compiled = compileVP(rendered, rendered.form);
return { return {
ps: [modifyP(compiled.ps[0])], ps: [modifyP(getLength(compiled.ps, length)[0])],
e: compiled.e ? modifyEnglish(compiled.e.join(" • ")) : "", e: compiled.e ? modifyEnglish(compiled.e.join(" • ")) : "",
}; };
} }
return createVerbTable(makePhrase, isImperativeTense(tense) ? "imperative" : "nonImperative"); return createVerbTable(makePhrase, isImperativeTense(tense) ? "imperative" : isPastTense(tense) ? "past" : "nonImperative");
} }
function modifyP(ps: T.PsString): T.PsString { function modifyP(ps: T.PsString): T.PsString {
@ -160,7 +177,7 @@ function tenseToStem(t: T.VerbTense | T.ImperativeTense): "imperfective stem" |
: "perfective root"; : "perfective root";
} }
function createVerbTable(f: (person: T.Person) => { ps: T.ArrayOneOrMore<T.PsString>, e: string }, type: "imperative" | "nonImperative"): { ps: T.VerbBlock | T.ImperativeBlock, e: T.EnglishBlock } { function createVerbTable(f: (person: T.Person) => { ps: T.ArrayOneOrMore<T.PsString>, e: string }, type: "imperative" | "nonImperative" | "past"): { ps: T.VerbBlock | T.ImperativeBlock, e: T.EnglishBlock } {
if (type === "imperative") { if (type === "imperative") {
const b = [ const b = [
[f(2), f(8)], [f(2), f(8)],
@ -180,7 +197,6 @@ function createVerbTable(f: (person: T.Person) => { ps: T.ArrayOneOrMore<T.PsStr
[b[1][0].e, b[1][1].e], [b[1][0].e, b[1][1].e],
], ],
}; };
} }
const b = [ const b = [
[f(0), f(6)], [f(0), f(6)],

View File

@ -13,3 +13,11 @@ export const basicVerbs: T.VerbEntry[] = [
{"ts":1527812790,"i":5795,"p":"خوړل","f":"khoRul","g":"khoRul","e":"to eat, to bite","c":"v. trans.","psp":"خور","psf":"khor","tppp":"خوړ","tppf":"khoR","ec":"eat,eats,eating,ate,eaten"}, {"ts":1527812790,"i":5795,"p":"خوړل","f":"khoRul","g":"khoRul","e":"to eat, to bite","c":"v. trans.","psp":"خور","psf":"khor","tppp":"خوړ","tppf":"khoR","ec":"eat,eats,eating,ate,eaten"},
{"ts":1527815216,"i":6630,"p":"راتلل","f":"raatlúl","g":"raatlul","e":"to come","c":"v. intrans. irreg.","psp":"راځ","psf":"raadz","ssp":"راش","ssf":"ráash","prp":"راغلل","prf":"ráaghlul","pprtp":"راغلی","pprtf":"raaghúley","tppp":"راغی","tppf":"ráaghey","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"come,comes,coming,came,come"}, {"ts":1527815216,"i":6630,"p":"راتلل","f":"raatlúl","g":"raatlul","e":"to come","c":"v. intrans. irreg.","psp":"راځ","psf":"raadz","ssp":"راش","ssf":"ráash","prp":"راغلل","prf":"ráaghlul","pprtp":"راغلی","pprtf":"raaghúley","tppp":"راغی","tppf":"ráaghey","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"come,comes,coming,came,come"},
].map(entry => ({ entry })); ].map(entry => ({ entry }));
// @ts-ignore
export const intransitivePast: T.VerbEntry[] = [
{"ts":1527813573,"i":6809,"p":"رسېدل","f":"rasedul","g":"rasedul","e":"arrive, reached; (fig.) understand, attain to; mature, ripen","c":"v. intrans.","shortIntrans":true,"ec":"arrive"},
{"ts":1527812645,"i":10822,"p":"ګرځېدل","f":"gurdzedul","g":"gurdzedul","e":"to walk, wander, turn about; to become, to be","c":"v. intrans.","shortIntrans":true,"ec":"walk"},
{"ts":1527816495,"i":3470,"p":"تښتېدل","f":"tuxtedul","g":"tuxtedul","e":"to run off, escape, flee","c":"v. intrans.","shortIntrans":true,"ec":"escape"},
{"ts":1527813680,"i":9218,"p":"غږېدل","f":"ghuGedul, ghaGedul","g":"ghugedul,ghagedul","e":"to speak, talk, converse, sing","c":"v. intrans.","ec":"speak,speaks,speaking,spoke"},
].map(entry => ({ entry }));

View File

@ -55,13 +55,25 @@ Then, we will see **what really trips people up** when learning Pashto is that <
**First we'll introduce the two forms (simple and continuous past) using intransitive verbs**, and then later we'll see how things change when we use transitive verbs. Let's go! **First we'll introduce the two forms (simple and continuous past) using intransitive verbs**, and then later we'll see how things change when we use transitive verbs. Let's go!
## Simple Past ## Past tense with intransitive verbs
IN PROGRESS ### Simple Past
## Continuous Past <Formula>
Perfective root +{` `}
<Link to="/verbs/verb-endings/#past-verb-endings">Past verb ending</Link>
</Formula>
IN PROGRESS <BasicVerbShowCase opts={opts} tense="perfectivePast" />
### Continuous Past
<Formula>
Imperfective root +{` `}
<Link to="/verbs/verb-endings/#past-verb-endings">Past verb ending</Link>
</Formula>
<BasicVerbShowCase opts={opts} tense="imperfectivePast" />
## Past Tense with Transitive Verbs ## Past Tense with Transitive Verbs

View File

@ -1695,10 +1695,10 @@
rambda "^6.7.0" rambda "^6.7.0"
react-select "^5.2.2" react-select "^5.2.2"
"@lingdocs/pashto-inflector@^3.1.6": "@lingdocs/pashto-inflector@^3.1.8":
version "3.1.6" version "3.1.8"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.1.6.tgz#9e74cfca62fac868e037219236e1ba6d6c851054" resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.1.8.tgz#2601f186430862e6cd0fa936c0266fc99da7808e"
integrity sha512-FwLI8bHfELRn3UlZKdUQCx0jSbnivjcZUmcXxPXth4U0Xw2VpunNj7F/yrKZkxM2b384A1fIjOVxXbXFB8ZadQ== integrity sha512-+K8vkbZbH+4X8Qfj7eDyHz7IP8G6wqZspoQkEwWkuskF3O9g+WEmbAVvG3X0mkHTj62bnq96tYAFtHIW/5fRBg==
dependencies: dependencies:
"@formkit/auto-animate" "^1.0.0-beta.1" "@formkit/auto-animate" "^1.0.0-beta.1"
classnames "^2.2.6" classnames "^2.2.6"