fixup
This commit is contained in:
parent
07707195b1
commit
02a78b6fcf
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "3.8.4",
|
||||
"version": "3.8.5",
|
||||
"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",
|
||||
|
|
|
@ -189,7 +189,7 @@ export const pastEndings: {
|
|||
],
|
||||
[
|
||||
[{
|
||||
p: "ۀ",
|
||||
p: "ه",
|
||||
f: "u"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
|
||||
import * as T from "../types";
|
||||
|
||||
export const blank: T.PsString = {
|
||||
p: "_____",
|
||||
f: "_____",
|
||||
};
|
||||
export const kidsBlank: T.PsString = { p: "___", f: "___" };
|
||||
|
||||
// just for type safety
|
||||
export function noPersInfs(s: T.OptionalPersonInflections<T.LengthOptions<T.PsString>>): T.LengthOptions<T.PsString>;
|
||||
export function noPersInfs(s: T.FullForm<T.PsString>): T.SingleOrLengthOpts<T.PsString>;
|
||||
|
|
|
@ -25,16 +25,14 @@ import {
|
|||
specifyBlockLength,
|
||||
specifyEquativeLength,
|
||||
} from "./blocks-utils";
|
||||
import {
|
||||
blank,
|
||||
kidsBlank,
|
||||
} from "../../lib/misc-helpers";
|
||||
|
||||
|
||||
export const blank: T.PsString = {
|
||||
p: "_____",
|
||||
f: "_____",
|
||||
};
|
||||
type BlankoutOptions = { equative?: boolean, ba?: boolean, kidsSection?: boolean, verb?: boolean };
|
||||
|
||||
export const kidsBlank: T.PsString = { p: "___", f: "___" };
|
||||
|
||||
|
||||
// function compilePs({ blocks, kids, verb: { head, rest }, VP }: CompilePsInput): T.SingleOrLengthOpts<T.PsString[]> {
|
||||
// if ("long" in rest) {
|
||||
// return {
|
||||
|
@ -436,3 +434,4 @@ export function flattenLengths(r: T.SingleOrLengthOpts<T.PsString[] | T.PsString
|
|||
return [r];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -251,10 +251,10 @@ export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
|||
(s: T.Person, v: T.EnglishVerbConjugationEc, n: boolean) => string[]
|
||||
> = {
|
||||
imperfectiveImperative: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`$SUBJ ${n ? "don't " : ""}${ec[0]}! (command)`,
|
||||
`$SUBJ ${n ? "don't " : ""}${ec[0]}!`,
|
||||
]),
|
||||
perfectiveImperative: (s: T.Person, ec: T.EnglishVerbConjugationEc, n: boolean) => ([
|
||||
`$SUBJ ${n ? "don't " : ""}${ec[0]}! (command)`,
|
||||
`$SUBJ ${n ? "don't " : ""}${ec[0]}!`,
|
||||
]),
|
||||
};
|
||||
const base = (
|
||||
|
@ -265,5 +265,6 @@ export function renderEnglishVPBase({ subjectPerson, object, vs }: {
|
|||
: isImperativeTense(vs.tense)
|
||||
? imperativeBuilders[vs.tense]
|
||||
: (vs.voice === "active" ? modalBuilders : passiveModalBuilders)[vs.tense])(subjectPerson, ec, vs.negative);
|
||||
return base.map(b => `${b}${typeof object === "object" ? " $OBJ" : ""}${ep ? ` ${ep}` : ""}`.replace(" ", " ").trim());
|
||||
return base
|
||||
.map(b => `${b}${typeof object === "object" ? " $OBJ" : ""}${ep ? ` ${ep}` : ""}${isImperativeTense(vs.tense) ? " (command)" : ""}`.replace(" ", " ").trim());
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ import { getEnglishWord } from "../get-english-word";
|
|||
import { renderAdjectiveSelection } from "./render-adj";
|
||||
import { isPattern5Entry, isAnimNounEntry, isPattern1Entry } from "../type-predicates";
|
||||
|
||||
export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflectEnglish: boolean, role: "subject", soRole: "servant" | "king" | "none", isLocationSandwich: boolean): T.Rendered<T.NPSelection>;
|
||||
export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflectEnglish: boolean, role: "object", soRole: "servant" | "king" | "none", isLocationSandwich: boolean): T.Rendered<T.NPSelection>;
|
||||
export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflectEnglish: boolean, role: "subject" | "object", soRole: "servant" | "king" | "none", isLocationSandwich: boolean): T.Rendered<T.NPSelection> {
|
||||
export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflectEnglish: boolean, role: "subject", soRole: "servant" | "king" | "none", isPuSandwich: boolean): T.Rendered<T.NPSelection>;
|
||||
export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflectEnglish: boolean, role: "object", soRole: "servant" | "king" | "none", isPuSandwich: boolean): T.Rendered<T.NPSelection>;
|
||||
export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflectEnglish: boolean, role: "subject" | "object", soRole: "servant" | "king" | "none", isPuSandwich: boolean): T.Rendered<T.NPSelection> {
|
||||
if (typeof NP !== "object") {
|
||||
if (role !== "object") {
|
||||
throw new Error("ObjectNP only allowed for objects");
|
||||
|
@ -28,7 +28,7 @@ export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflect
|
|||
if (NP.selection.type === "noun") {
|
||||
return {
|
||||
type: "NP",
|
||||
selection: renderNounSelection(NP.selection, inflected, soRole, undefined, isLocationSandwich),
|
||||
selection: renderNounSelection(NP.selection, inflected, soRole, undefined, isPuSandwich),
|
||||
};
|
||||
}
|
||||
if (NP.selection.type === "pronoun") {
|
||||
|
@ -46,9 +46,9 @@ export function renderNPSelection(NP: T.NPSelection, inflected: boolean, inflect
|
|||
throw new Error("unknown NP type");
|
||||
};
|
||||
|
||||
export function renderNounSelection(n: T.NounSelection, inflected: boolean, role: "servant" | "king" | "none", noArticles?: true | "noArticles", isLocationSandwich?: boolean): T.Rendered<T.NounSelection> {
|
||||
export function renderNounSelection(n: T.NounSelection, inflected: boolean, role: "servant" | "king" | "none", noArticles?: true | "noArticles", isPuSandwich?: boolean): T.Rendered<T.NounSelection> {
|
||||
const english = getEnglishFromNoun(n.entry, n.number, noArticles);
|
||||
const nounInflects = !(isLocationSandwich && isPattern1Entry(n.entry) && n.number === "singular")
|
||||
const nounInflects = !(isPuSandwich && isPattern1Entry(n.entry) && n.number === "singular")
|
||||
const pashto = ((): T.PsString[] => {
|
||||
const infs = inflectWord(n.entry);
|
||||
const ps = n.number === "singular"
|
||||
|
@ -69,7 +69,7 @@ export function renderNounSelection(n: T.NounSelection, inflected: boolean, role
|
|||
const person = getPersonNumber(n.gender, n.number);
|
||||
return {
|
||||
...n,
|
||||
adjectives: n.adjectives.map(a => renderAdjectiveSelection(a, person, inflected, isLocationSandwich && n.number === "singular")),
|
||||
adjectives: n.adjectives.map(a => renderAdjectiveSelection(a, person, inflected, isPuSandwich && n.number === "singular")),
|
||||
person,
|
||||
inflected,
|
||||
role,
|
||||
|
|
|
@ -14,12 +14,11 @@ export function renderSandwich(s: T.SandwichSelection<T.Sandwich>): T.Rendered<T
|
|||
inflectInside,
|
||||
"subject",
|
||||
"none",
|
||||
isLocationSandwich(s),
|
||||
isPuSandwich(s),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
function isLocationSandwich(s: T.SandwichSelection<T.Sandwich>): boolean {
|
||||
// TODO: more nuanced version of this? or just په ?
|
||||
return (s.before?.p === "په") && (s.after?.p === "کې");
|
||||
function isPuSandwich(s: T.SandwichSelection<T.Sandwich>): boolean {
|
||||
return s.before?.p === "په";
|
||||
}
|
|
@ -39,9 +39,6 @@ import Block, { NPBlock, APBlock } from "./components/blocks/Block";
|
|||
import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal";
|
||||
import CompiledPTextDisplay from "./components/CompiledPTextDisplay";
|
||||
import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay";
|
||||
import {
|
||||
isPashtoScript,
|
||||
} from "./lib/is-pashto";
|
||||
import {
|
||||
makePsString,
|
||||
removeFVarients,
|
||||
|
@ -122,6 +119,8 @@ import {
|
|||
isFirstPerson,
|
||||
isSecondPerson,
|
||||
isThirdPerson,
|
||||
blank,
|
||||
kidsBlank,
|
||||
} from "./lib/misc-helpers";
|
||||
import {
|
||||
simplifyPhonetics,
|
||||
|
@ -154,9 +153,10 @@ import {
|
|||
compileEP,
|
||||
compileVP,
|
||||
flattenLengths,
|
||||
blank,
|
||||
kidsBlank,
|
||||
} from "./lib/phrase-building/compile";
|
||||
import {
|
||||
isPashtoScript,
|
||||
} from "./lib/is-pashto";
|
||||
import {
|
||||
renderAPSelection,
|
||||
} from "./lib/phrase-building/render-ap";
|
||||
|
|
Loading…
Reference in New Issue