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",
"@fortawesome/fontawesome-free": "^5.15.4",
"@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/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",

View File

@ -9,17 +9,20 @@ import {
getEnglishVerb,
InlinePs,
removeFVarients,
isPastTense,
} from "@lingdocs/pashto-inflector";
import { isImperativeTense } from "@lingdocs/pashto-inflector/dist/lib/type-predicates";
import { useState } from "react";
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 }: {
opts: T.TextOptions,
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 {
title: <InlinePs opts={opts}>{{
...removeFVarients(item.entry),
@ -42,13 +45,14 @@ function BasicVerbChart({ verb, opts, tense }: {
tense: T.VerbTense | T.ImperativeTense,
}) {
const [negative, setNegative] = useState<boolean>(false);
const [length, setLength] = useState<"short" | "long">("short");
const c = conjugateVerb(verb.entry, verb.complement);
const conjugations = "stative" in c
? c.stative
: "grammaticallyTransitive" in c
? c.grammaticallyTransitive
: c;
const phrasesForTable = makeExamplePhrases(verb, tense, negative)
const phrasesForTable = makeExamplePhrases(verb, tense, negative, length)
return <div>
<div>
{getEnglishVerb(verb.entry)}
@ -59,16 +63,29 @@ function BasicVerbChart({ verb, opts, tense }: {
hidePastParticiple={true}
highlighted={[tenseToStem(tense)]}
/>
<div className="my-3">
<ButtonSelect
handleChange={(value) => setNegative(value === "true")}
value={String(negative)}
<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: "true", label: "Neg." },
{ value: "false", label: "Pos." },
{ value: "long", label: "long" },
{ value: "short", label: "short" },
]}
/>
/>
</div>}
<div className="mx-2">
<ButtonSelect
handleChange={(value) => setNegative(value === "true")}
value={String(negative)}
small
options={[
{ value: "true", label: "Neg." },
{ value: "false", label: "Pos." },
]}
/>
</div>
</div>
<div className="text-left">
<VerbTable
@ -80,7 +97,7 @@ function BasicVerbChart({ verb, opts, tense }: {
</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{
return {
"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 } {
const selection = makeSelection(person);
const rendered = renderVP(selection);
const compiled = compileVP(rendered, rendered.form, true);
const compiled = compileVP(rendered, rendered.form);
return {
ps: [modifyP(compiled.ps[0])],
ps: [modifyP(getLength(compiled.ps, length)[0])],
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 {
@ -160,7 +177,7 @@ function tenseToStem(t: T.VerbTense | T.ImperativeTense): "imperfective stem" |
: "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") {
const b = [
[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],
],
};
}
const b = [
[f(0), f(6)],

View File

@ -12,4 +12,12 @@ export const basicVerbs: T.VerbEntry[] = [
{"ts":1577049208257,"i":1068,"p":"اورېدل","f":"awredul","g":"awredul","e":"to hear, listen","c":"v. trans./gramm. trans.","psp":"اور","psf":"awr","tppp":"اورېد","tppf":"awred","ec":"hear,hears,hearing,heard"},
{"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"},
].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!
## 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

View File

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