support for English phrasal verbs
This commit is contained in:
parent
3c0ef80de7
commit
d3647ee0d5
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "0.5.2",
|
||||
"version": "0.5.3",
|
||||
"author": "lingdocs.com",
|
||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||
"homepage": "https://verbs.lingdocs.com",
|
||||
|
|
|
@ -312,6 +312,7 @@ function App() {
|
|||
conjugation={conjugation}
|
||||
textOptions={textOptions}
|
||||
ec={v ? v.verb.entry.ec : undefined}
|
||||
ep={v ? v.verb.entry.ep : undefined}
|
||||
/>}
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -171,10 +171,11 @@ const initialState: State = {
|
|||
formsOpened: [],
|
||||
};
|
||||
|
||||
function ConjugationViewer({ conjugation, textOptions, ec }: {
|
||||
function ConjugationViewer({ conjugation, textOptions, ec, ep }: {
|
||||
conjugation: T.VerbOutput,
|
||||
textOptions: T.TextOptions,
|
||||
ec?: string | undefined,
|
||||
ep?: string | undefined,
|
||||
}) {
|
||||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
useEffect(() => {
|
||||
|
@ -196,7 +197,10 @@ function ConjugationViewer({ conjugation, textOptions, ec }: {
|
|||
const verbConj = (verbConj1.singularForm && state.compoundComplementVersionSelected === "sing")
|
||||
? verbConj1.singularForm
|
||||
: verbConj1;
|
||||
const englishConjugation = parseEc(ec);
|
||||
const englishConjugation: T.EnglishVerbConjugation | undefined = ec ? {
|
||||
ec: parseEc(ec),
|
||||
ep: ep,
|
||||
} : undefined;
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem(stateLocalStorageName, JSON.stringify(state));
|
||||
|
|
|
@ -12,6 +12,18 @@ import * as T from "../types";
|
|||
|
||||
type PsStringWSub = T.PsString & { sub?: any };
|
||||
|
||||
function EnglishContent({ children }: { children: (string | JSX.Element)[] | (string | JSX.Element) }) {
|
||||
if (Array.isArray(children)) {
|
||||
console.log(children);
|
||||
return <>
|
||||
{children.map((x) => <EnglishContent>{x}</EnglishContent>)}
|
||||
</>
|
||||
}
|
||||
return <div className="text-muted">
|
||||
{children}
|
||||
</div>;
|
||||
}
|
||||
|
||||
function Examples({
|
||||
children,
|
||||
ex,
|
||||
|
@ -30,9 +42,9 @@ function Examples({
|
|||
<div>
|
||||
<Phonetics opts={opts}>{text}</Phonetics>
|
||||
</div>
|
||||
{text.e && <div className="text-muted">
|
||||
{text.e && <EnglishContent>
|
||||
{text.e}
|
||||
</div>}
|
||||
</EnglishContent>}
|
||||
{text.sub && <div className="small text-muted">
|
||||
{text.sub}
|
||||
</div>}
|
||||
|
|
|
@ -19,7 +19,7 @@ function SingleItemDisplay({ item, textOptions, english }: {
|
|||
return <div className="text-center mt-3 mb-2">
|
||||
<div><Pashto opts={textOptions}>{item}</Pashto></div>
|
||||
<div><Phonetics opts={textOptions}>{item}</Phonetics></div>
|
||||
{eng && <div>{eng}</div>}
|
||||
{eng && <div className="text-muted">{eng}</div>}
|
||||
</div>;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@ function TableCell({ item, textOptions, center, noBorder }: {
|
|||
<div>
|
||||
<Phonetics opts={textOptions}>{w}</Phonetics>
|
||||
</div>
|
||||
{w.e && <div className="text-muted">{w.e}</div>}
|
||||
{w.e && (Array.isArray(w.e)
|
||||
? w.e.map(e => <div key={e} className="text-muted small">{e}</div>)
|
||||
: <div className="text-muted">{w.e}</div>)}
|
||||
</div>
|
||||
{item.length > 1 &&
|
||||
<button className="btn btn-sm btn-light mx-2 my-2" onClick={advanceVersion}>
|
||||
|
|
|
@ -126,9 +126,11 @@ export default function addPronouns({ s, subject, object, info, displayForm, int
|
|||
mini: miniPronoun,
|
||||
};
|
||||
const english = (displayForm.englishBuilder && englishConjugation)
|
||||
? displayForm.englishBuilder(subject, englishConjugation, negative).map(baseS => (
|
||||
(intransitive || info.transitivity === "grammatically transitive") ? baseS : `${baseS} ${engObj(object)}`
|
||||
)).join(" / ")
|
||||
? displayForm.englishBuilder(subject, englishConjugation.ec, negative).map(baseS => (
|
||||
(intransitive || info.transitivity === "grammatically transitive")
|
||||
? baseS
|
||||
: `${baseS} ${engObj(object)}${englishConjugation.ep ? ` ${englishConjugation.ep}` : ""}`
|
||||
))
|
||||
: undefined;
|
||||
|
||||
function attachPronounsToVariation(ps: T.PsString, prns: Pronouns): T.ArrayOneOrMore<T.PsString> {
|
||||
|
|
|
@ -141,7 +141,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.imperfective.nonImperative,
|
||||
formula: "Imperfective Stem + Present Ending",
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${n ? `${engPresC(s, ["don't", "doesn't"])} ` : ""}${n ? v[0] : engPresC(s, v)}`,
|
||||
`${engSubj(s)} ${engEquative("present", s)}${n ? " not" : ""} ${v[2]}`,
|
||||
]),
|
||||
|
@ -153,7 +153,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfective.nonImperative,
|
||||
formula: "Perfective Stem + Present Ending",
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`that ${engSubj(s, true)}${n ? " won't" : "'ll"} ${v[0]}`,
|
||||
`should ${engSubj(s, true)}${n ? " not" : ""} ${v[0]}`,
|
||||
]),
|
||||
|
@ -166,7 +166,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
advanced: true,
|
||||
formula: "به - ba + Present",
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} ${v[0]}`,
|
||||
]),
|
||||
explanation: "Saying something will happen, repeatedly or as an ongoing action",
|
||||
|
@ -178,7 +178,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
advanced: true,
|
||||
formula: "به - ba + Subjunctive",
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} ${v[0]}`,
|
||||
]),
|
||||
explanation: "Saying something will happen as a one-time event - May also used when there is some doubt",
|
||||
|
@ -189,7 +189,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.imperfective.past,
|
||||
formula: "Imperfective Root + Past Ending",
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
// - subj "was" (N && "not") v.2 obj
|
||||
`${engSubj(s)} ${engEquative("past", s)}${n ? " not" : ""} ${v[2]}`,
|
||||
// - subj "would" (N && "not") v.0 obj
|
||||
|
@ -204,7 +204,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfective.past,
|
||||
formula: "Perfective Root + Past Ending",
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)}${n ? " did not" : ""} ${v[3]}`,
|
||||
]),
|
||||
explanation: "Saying something happened ('I ____ed')",
|
||||
|
@ -220,7 +220,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
aspect: "imperfective",
|
||||
form: conj.imperfective.modal.nonImperative,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} can${n ? "'t" : ""} ${v[0]}`,
|
||||
]),
|
||||
formula: "Imperfective Root + Non-Inflectinig Ey-Tail + Subjunctive کېدل - to become",
|
||||
|
@ -233,7 +233,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfective.modal.nonImperative,
|
||||
advanced: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`that ${engSubj(s, true)} can${n ? "'t" : ""} ${v[0]}`,
|
||||
]),
|
||||
formula: "Perfective Root + Non-Inflectinig Ey-Tail + Subjunctive کېدل - to become",
|
||||
|
@ -246,7 +246,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.imperfective.modal.future,
|
||||
advanced: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} be able to ${v[0]}`,
|
||||
]),
|
||||
formula: "به - ba + Present Modal",
|
||||
|
@ -259,7 +259,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfective.modal.future,
|
||||
advanced: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} be able to ${v[0]}`,
|
||||
]),
|
||||
formula: "به - ba + Subjunctive Modal",
|
||||
|
@ -273,7 +273,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
advanced: true,
|
||||
past: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engEquative("past", s)} ${n ? " not" : ""} able to ${v[0]}`,
|
||||
`${engSubj(s)} could${n ? " not" : ""} ${v[0]}`,
|
||||
]),
|
||||
|
@ -288,7 +288,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
formula: "Perfective Root + Non-Inflectinig Ey-Tail + Simple Past کېدل - to become",
|
||||
explanation: "saying that something was possible at a certain point in time ('I was able to ____, at one particular point in time')",
|
||||
past: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engEquative("past", s)} ${n ? " not" : ""} able to ${v[0]}`,
|
||||
`${engSubj(s)} could${n ? " not" : ""} ${v[0]}`,
|
||||
]),
|
||||
|
@ -325,7 +325,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
label: "Imperfective Imperative",
|
||||
aspect: "imperfective",
|
||||
form: conj.imperfective.imperative,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${v[0]}`,
|
||||
]),
|
||||
formula: "Imperfective Stem + Imperative Ending",
|
||||
|
@ -336,7 +336,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
label: "Perfective Imperative",
|
||||
aspect: "perfective",
|
||||
form: conj.perfective.imperative,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${v[0]}`,
|
||||
]),
|
||||
formula: "Perfective Stem + Imperative Ending",
|
||||
|
@ -352,7 +352,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfect.halfPerfect,
|
||||
past: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
|
||||
]),
|
||||
formula: "Past participle inflected",
|
||||
|
@ -364,7 +364,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfect.past,
|
||||
past: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} had${n ? " not" : ""} ${v[4]}`,
|
||||
]),
|
||||
formula: "Past participle inflected + Past Equative",
|
||||
|
@ -376,7 +376,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfect.present,
|
||||
past: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} ${v[4]}`,
|
||||
]),
|
||||
formula: "Past participle inflected + Present Equative",
|
||||
|
@ -388,7 +388,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.perfect.subjunctive,
|
||||
past: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`that ${engSubj(s, true)} will have${n ? " not" : ""} ${v[4]}`,
|
||||
]),
|
||||
formula: "Past participle inflected + Subjunctive/Habitual Equative",
|
||||
|
@ -401,7 +401,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
advanced: true,
|
||||
past: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} have ${v[4]}`,
|
||||
]),
|
||||
formula: "به - ba + Past participle Inflected + Future Equative",
|
||||
|
@ -414,7 +414,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
advanced: true,
|
||||
past: true,
|
||||
sentence: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} have ${v[4]}`,
|
||||
]),
|
||||
explanation: "Affirming that an event will have taken place ('I will have ____ed')",
|
||||
|
@ -475,7 +475,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.passive.imperfective.nonImperative,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engEquative("present", s)}${n ? " not" : ""} being ${v[4]}`,
|
||||
]),
|
||||
formula: "Long Imperfective Root + Present کېدل - to become",
|
||||
|
@ -487,7 +487,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.passive.perfective.nonImperative,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`that ${engSubj(s, true)} will${n ? " not" : ""} be ${v[4]}`,
|
||||
]),
|
||||
formula: "Long Perfective Root + Subjunctive کېدل - to become",
|
||||
|
@ -499,7 +499,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.passive.imperfective.future,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} be ${v[4]}`,
|
||||
]),
|
||||
formula: "به - ba + Passive Present",
|
||||
|
@ -511,7 +511,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
form: conj.passive.perfective.future,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will${n ? " not" : ""} be ${v[4]}`,
|
||||
]),
|
||||
formula: "به - ba + Passive Subjunctive",
|
||||
|
@ -524,7 +524,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engEquative("past", s)}${n ? " not" : ""} being ${v[4]}`,
|
||||
]),
|
||||
formula: "Long Imperfective Root + Continuous Past کېدل - to become",
|
||||
|
@ -537,7 +537,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engEquative("past", s)}${n ? " not" : ""} ${v[4]}`,
|
||||
]),
|
||||
formula: "Long Perfective Root + Simple Past کېدل - to become",
|
||||
|
@ -555,7 +555,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} been ${v[4]}`,
|
||||
]),
|
||||
formula: "Infinitive + کېدل (to be) past participle inflected",
|
||||
|
@ -567,7 +567,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} had${n ? " not" : ""} been ${v[4]}`,
|
||||
]),
|
||||
formula: "Infinitive + کېدل (to be) past participle inflected + Past Equative",
|
||||
|
@ -579,7 +579,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} ${engHave(s)}${n ? " not" : ""} been ${v[4]}`,
|
||||
]),
|
||||
formula: "Infinitive + کېدل (to be) past participle inflected + Present Equative",
|
||||
|
@ -591,7 +591,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`that ${engSubj(s, true)} will have been ${v[4]}`,
|
||||
]),
|
||||
formula: "Infinitive + کېدل (to be) past participle inflected + Subjunctive/Habitual Equative",
|
||||
|
@ -603,7 +603,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will have been ${v[4]}`,
|
||||
]),
|
||||
formula: "به - ba + Infinitive + کېدل (to be) past participle inflected + Future Equative",
|
||||
|
@ -616,7 +616,7 @@ const formsOfConjugation = (conj: T.VerbConjugation): T.DisplayFormItem[] => [
|
|||
past: true,
|
||||
sentence: true,
|
||||
passive: true,
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugation, n: boolean) => ([
|
||||
englishBuilder: (s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`${engSubj(s)} will have been ${v[4]}`,
|
||||
]),
|
||||
explanation: "Affirming that an event will have taken place (Passive voice) ('I will have been ____ed')",
|
||||
|
@ -675,7 +675,7 @@ function isThirdPerson(p: T.Person): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
function engPresC(s: T.Person, ec: T.EnglishVerbConjugation | [string, string]): string {
|
||||
function engPresC(s: T.Person, ec: T.EnglishVerbConjugationEc | [string, string]): string {
|
||||
return isThirdPerson(s) ? ec[1] : ec[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -214,16 +214,13 @@ export function isNounAdjOrVerb(entry: T.DictionaryEntry): "nounAdj" | "verb" |
|
|||
* @param ec
|
||||
* @returns
|
||||
*/
|
||||
export function parseEc(ec: string | undefined): T.EnglishVerbConjugation | undefined {
|
||||
function makeRegularConjugations(s: string): T.EnglishVerbConjugation {
|
||||
export function parseEc(ec: string): T.EnglishVerbConjugationEc {
|
||||
function makeRegularConjugations(s: string): T.EnglishVerbConjugationEc {
|
||||
const b = (s.slice(-1) === "e")
|
||||
? s.slice(0, -1)
|
||||
: s;
|
||||
return [`${s}`, `${s}s`, `${b}ing`, `${b}ed`, `${b}ed`];
|
||||
}
|
||||
if (!ec) {
|
||||
return undefined;
|
||||
}
|
||||
const items = ec.split(",").map(x => x.trim());
|
||||
return (items.length !== 5)
|
||||
? makeRegularConjugations(items[0])
|
||||
|
|
12
src/types.ts
12
src/types.ts
|
@ -389,8 +389,12 @@ export type ArrayOneOrMore<T> = {
|
|||
0: T
|
||||
} & Array<T>
|
||||
|
||||
/* i.e. ["eat", "eats", "eating", "ate", "eaten"] */
|
||||
export type EnglishVerbConjugation = [string, string, string, string, string];
|
||||
/* i.e. ec: ["take", "takes", "taking", "took", "taken"], ep: out */
|
||||
export type EnglishVerbConjugationEc = [string, string, string, string, string];
|
||||
export type EnglishVerbConjugation = {
|
||||
ec: EnglishVerbConjugationEc,
|
||||
ep: string | undefined,
|
||||
};
|
||||
|
||||
export type DisplayFormItem = DisplayForm | DisplayFormSubgroup | DisplayFormForSentence;
|
||||
|
||||
|
@ -399,7 +403,7 @@ export type DisplayForm = {
|
|||
aspect?: Aspect,
|
||||
form: VerbForm | ImperativeForm | ParticipleForm | SentenceForm,
|
||||
advanced?: boolean,
|
||||
englishBuilder?: (subject: Person, ec: EnglishVerbConjugation, neg: boolean) => string[],
|
||||
englishBuilder?: (subject: Person, ec: EnglishVerbConjugationEc, neg: boolean) => string[],
|
||||
formula: React.ReactNode,
|
||||
explanation: React.ReactNode,
|
||||
sentence?: boolean,
|
||||
|
@ -412,7 +416,7 @@ export type DisplayFormForSentence = {
|
|||
aspect?: Aspect,
|
||||
form: VerbForm,
|
||||
advanced?: boolean,
|
||||
englishBuilder?: (subject: Person, ec: EnglishVerbConjugation, neg: boolean) => string[],
|
||||
englishBuilder?: (subject: Person, ec: EnglishVerbConjugationEc, neg: boolean) => string[],
|
||||
formula: React.ReactNode,
|
||||
secondPronounNeeded?: boolean,
|
||||
explanation: React.ReactNode,
|
||||
|
|
Loading…
Reference in New Issue