starting on ability

This commit is contained in:
lingdocs 2022-07-28 16:59:59 -05:00
parent f4d836e9df
commit 2dc41eb028
8 changed files with 3731 additions and 13 deletions

View File

@ -7,7 +7,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.6.0",
"@lingdocs/pashto-inflector": "^3.6.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",

View File

@ -11,6 +11,7 @@ import {
removeFVarients,
isPastTense,
getPassiveRootsAndStems,
getAbilityRootsAndStems,
} from "@lingdocs/pashto-inflector";
import { isImperativeTense, isPerfectTense } from "@lingdocs/pashto-inflector/dist/lib/type-predicates";
import { useState } from "react";
@ -19,10 +20,11 @@ import { basicVerbs, intransitivePast } from "../content/verbs/basic-present-ver
import { getLength } from "@lingdocs/pashto-inflector/dist/lib/p-text-helpers";
import { isThirdPerson } from "@lingdocs/pashto-inflector/dist/lib/phrase-building/vp-tools";
function BasicVerbShowCase({ opts, tense, passive }: {
function BasicVerbShowCase({ opts, tense, passive, ability }: {
opts: T.TextOptions,
tense: T.VerbTense | T.ImperativeTense,
passive?: boolean,
ability?: boolean,
}) {
const items = isPastTense(tense)
? intransitivePast
@ -35,6 +37,7 @@ function BasicVerbShowCase({ opts, tense, passive }: {
}}</InlinePs>,
body: <BasicVerbChart
passive={passive}
ability={ability}
verb={item}
opts={opts}
tense={tense}
@ -45,13 +48,15 @@ function BasicVerbShowCase({ opts, tense, passive }: {
export default BasicVerbShowCase;
function BasicVerbChart({ verb, opts, tense, passive }: {
function BasicVerbChart({ verb, opts, tense, passive, ability }: {
verb: T.VerbEntry,
opts: T.TextOptions,
tense: T.VerbTense | T.ImperativeTense | T.PerfectTense,
passive?: boolean,
ability?: boolean,
}) {
const [voice, setVoice] = useState<"active" | "passive">("active");
const [category, setCategory] = useState<"basic" | "ability">("basic");
const [negative, setNegative] = useState<boolean>(false);
const [length, setLength] = useState<"short" | "long">("short");
const c = conjugateVerb(verb.entry, verb.complement);
@ -60,7 +65,7 @@ function BasicVerbChart({ verb, opts, tense, passive }: {
: "grammaticallyTransitive" in c
? c.grammaticallyTransitive
: c;
const phrasesForTable = makeExamplePhrases(verb, tense, negative, length, voice);
const phrasesForTable = makeExamplePhrases(verb, tense, negative, length, voice, category);
return <div>
<div>
{getEnglishVerb(verb.entry)}
@ -78,9 +83,24 @@ function BasicVerbChart({ verb, opts, tense, passive }: {
handleChange={setVoice}
/>
</div>}
{ability && <div className="my-2">
<ButtonSelect
options={[{
label: "Basic",
value: "basic",
}, {
label: "Ability",
value: "ability",
}]}
value={category}
handleChange={setCategory}
/>
</div>}
<RootsAndStems
textOptions={opts}
info={voice === "passive"
info={category === "ability"
? (getAbilityRootsAndStems(conjugations.info))
: voice === "passive"
? (getPassiveRootsAndStems(conjugations.info) || /* type safety */ conjugations.info)
: conjugations.info
}
@ -88,7 +108,7 @@ function BasicVerbChart({ verb, opts, tense, passive }: {
highlighted={[tenseToStem(tense)]}
/>
<div className="my-3 d-flex flex-row justify-content-center">
{isPastTense(tense) && !isPerfectTense(tense) && <div className="mx-2">
{((isPastTense(tense) && !isPerfectTense(tense)) || category === "ability") && <div className="mx-2">
<ButtonSelect
handleChange={setLength}
value={length}
@ -127,7 +147,17 @@ function makeExamplePhrases(
negative: boolean,
length: "short" | "long",
voice: "active" | "passive",
category: "basic" | "ability",
): { ps: T.VerbBlock | T.ImperativeBlock, e: T.EnglishBlock } {
function tenseToModal(t: T.VerbTense | T.ImperativeTense | T.PerfectTense): T.ModalTense {
if (isImperativeTense(t)) {
throw new Error("can't have imperative tense with modal");
}
if (isPerfectTense(t)) {
throw new Error("cant' have perfect tense with modal");
}
return `${t}Modal`;
}
function makeSelection(person: T.Person): T.VPSelectionComplete{
return {
"blocks": [
@ -143,7 +173,7 @@ function makeExamplePhrases(
"verb":{
"type":"verb",
verb,
tense,
tense: category === "basic" ? tense : tenseToModal(tense),
"transitivity":"intransitive",
"isCompound":false,
voice,

View File

@ -2,4 +2,68 @@
title: Ability
---
COMING SOON
import {
defaultTextOptions as opts,
Examples,
InlinePs,
RootsAndStems,
conjugateVerb,
getVerbInfo,
getPassiveRootsAndStems,
} from "@lingdocs/pashto-inflector";
import { KidsSection, VP, KingIcon, ServantIcon, Camera, Video } from "../../components/terms-links";
import psmd from "../../lib/psmd";
import Link from "../../components/Link";
import Image from "../../components/Image";
import Formula from "../../components/formula/Formula";
import VideoPlayer from "../../components/VideoPlayer";
import EditableVPEx, { EditIcon } from "../../components/phrase-diagram/EditableVPEx";
import BasicVerbShowCase from "../../components/BasicVerbShowCase";
import abilityCopy from "./verb-tree-ability-roots-copy.svg";
import halfKedul from "./verb-tree-half-kedul.svg";
We use "ability" verb forms to talk about the ability of a verb to happen. For example:
<EditableVPEx opts={opts} length="long">{
{"blocks":[{"key":0.7144630314236184,"block":{"type":"subjectSelection","selection":{"type":"NP","selection":{"type":"pronoun","person":0,"distance":"far"}}}},{"key":0.3237406469603912,"block":{"type":"objectSelection","selection":{"type":"NP","selection":{"type":"pronoun","person":2,"distance":"far"}}}}],"verb":{"type":"verb","verb":{"entry":{"ts":1527812275,"i":11624,"p":"لیدل","f":"leedul","g":"leedul","e":"to see","c":"v. trans./gramm. trans.","psp":"وین","psf":"ween","tppp":"لید","tppf":"leed","ec":"see,sees,seeing,saw,seen"}},"verbTense":"presentVerb","perfectTense":"presentPerfect","imperativeTense":"imperfectiveImperative","tenseCategory":"modal","transitivity":"transitive","isCompound":false,"voice":"active","negative":false,"canChangeTransitivity":true,"canChangeVoice":true,"canChangeStatDyn":false},"form":{"removeKing":false,"shrinkServant":false}}
}</EditableVPEx>
<EditableVPEx opts={opts}>{
{"blocks":[{"key":0.22382799925273678,"block":{"type":"subjectSelection","selection":{"type":"NP","selection":{"type":"pronoun","person":0,"distance":"far"}}}},{"key":0.8844517944804815,"block":{"type":"objectSelection","selection":"none"}}],"verb":{"type":"verb","verb":{"entry":{"ts":1527815216,"i":6642,"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"}},"verbTense":"presentVerb","perfectTense":"presentPerfect","imperativeTense":"imperfectiveImperative","tenseCategory":"modal","transitivity":"intransitive","isCompound":false,"voice":"active","negative":true,"canChangeTransitivity":false,"canChangeVoice":false,"canChangeStatDyn":false},"form":{"removeKing":false,"shrinkServant":false}}
}</EditableVPEx>
## Making the ability roots and stems
To make these "ability" forms we will need to modify the 🌳 <Link to="/verbs/roots-and-stems/">roots and stems</Link> of the verb.
1. Use the roots for the stems as well
2. Add a tail <InlinePs opts={opts} ps={{ p: "ی", f: "ey", e: "" }} /> or <InlinePs opts={opts} ps={{ p: "ای", f: "aay", e: "" }} />
3. Add the *perfective* <Camera /> roots and stems of <InlinePs opts={opts} ps={{ p: "کېدل", f: "kedúl", e: "to become" }} />
<div className="mb-3">
<div
className="d-flex flex-row align-items-center justify-content-center"
style={{ overflowX: "auto", maxWidth: "700px" }}
>
<div>
<img src={abilityCopy} style={{ maxWidth: "275px" }} />
</div>
<div style={{ fontSize: "2.5rem" }} className="mx-3">+</div>
<div className="text-center" style={{ minWidth: "3rem" }}>
<div>ی - ey /</div>
<div>ای - aay</div>
</div>
<div style={{ fontSize: "2.5rem" }} className="mx-3">+</div>
<div>
<img src={halfKedul} style={{ maxWidth: "115px" }} />
</div>
</div>
</div>
Have a look through these verbs and notice how the same formula is always used to make the "ability" roots and stems.
<BasicVerbShowCase opts={opts} tense="presentVerb" ability />
## Using the ability roots and stems
🚧 IN PROGRESS ...

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 92 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 100 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 91 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -1803,10 +1803,10 @@
rambda "^6.7.0"
react-select "^5.2.2"
"@lingdocs/pashto-inflector@^3.5.9":
version "3.5.9"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.5.9.tgz#3402f382c6818c0ab9d823537a3291764f4de0bd"
integrity sha512-A1+Fz7/n1HdC7yWliEKuGiFtEW/eDSn0OeQpFd617ZgsykNmyt3n/hlkojsOHKs+1gLNoi0zS7Xc+XUn63dXKw==
"@lingdocs/pashto-inflector@^3.6.2":
version "3.6.2"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.6.2.tgz#122eaeaac59253ea0ee708d772e860502aa1d6b7"
integrity sha512-hHvgJPrNAp/ZBvZRsm++X2vFnZyuVrpE54YWPubwk+1Xn+28otoJ34r/OsN4N7eXrXBcxawYsWhf/ot9D987GQ==
dependencies:
"@formkit/auto-animate" "^1.0.0-beta.1"
classnames "^2.2.6"