more humanReadable

This commit is contained in:
lingdocs 2022-08-29 17:55:58 +04:00
parent ad0538c737
commit 4c199b8f8b
4 changed files with 28 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
"version": "3.8.1",
"version": "3.8.2",
"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",

View File

@ -54,12 +54,22 @@ function humanReadableImperativeTense(tense: T.ImperativeTense): string {
: "perfective imperative";
}
export function humanReadableTense(tense: T.VerbTense | T.PerfectTense | T.ModalTense | T.ImperativeTense): string {
return isModalTense(tense)
? humanReadableModalTense(tense)
: isPerfectTense(tense)
? humanReadablePerfectTense(tense)
: isImperativeTense(tense)
? humanReadableImperativeTense(tense as T.ImperativeTense)
: humanReadableVerbTense(tense);
export function humanReadableVerbForm(f: T.VerbFormName): string {
return isModalTense(f)
? humanReadableModalTense(f)
: isPerfectTense(f)
? humanReadablePerfectTense(f)
: isImperativeTense(f)
? humanReadableImperativeTense(f as T.ImperativeTense)
: humanReadableVerbTense(f);
}
export function humanReadableEquativeTense(f: T.EquativeTense): string {
return (f === "pastSubjunctive"
? "past subjunctive"
: f === "wouldBe"
? `"would be"`
: f === "wouldHaveBeen"
? `"would have been"`
: f) + " equative";
}

View File

@ -157,7 +157,10 @@ import {
import {
renderAPSelection,
} from "./lib/phrase-building/render-ap";
import { humanReadableTense } from "./lib/human-readable";
import {
humanReadableVerbForm,
humanReadableEquativeTense,
} from "./lib/human-readable";
import NPPicker from "./components/np-picker/NPPicker";
import EPPicker from "./components/ep-explorer/EPPicker";
import EPExplorer from "./components/ep-explorer/EPExplorer";
@ -244,7 +247,8 @@ export {
getPashtoFromRendered,
renderAPSelection,
getEnglishVerb,
humanReadableTense,
humanReadableVerbForm,
humanReadableEquativeTense,
roleIcon,
vpsReducer,
makeVPSelectionState,

View File

@ -582,8 +582,10 @@ export type VPSelectionComplete = {
form: FormVersion,
};
export type VerbFormName = VerbTense | PerfectTense | ModalTense | ImperativeTense;
export type VerbSelectionComplete = Omit<VerbSelection, "object" | "verbTense" | "perfectTense" | "imperativeTense" | "tenseCategory"> & {
tense: VerbTense | PerfectTense | ModalTense | ImperativeTense,
tense: VerbFormName,
}
export type VerbSelection = {