humanReadableTense
This commit is contained in:
parent
3effddfb64
commit
ad0538c737
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "3.8.0",
|
"version": "3.8.1",
|
||||||
"author": "lingdocs.com",
|
"author": "lingdocs.com",
|
||||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||||
"homepage": "https://verbs.lingdocs.com",
|
"homepage": "https://verbs.lingdocs.com",
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
import * as T from "../types";
|
||||||
|
import {
|
||||||
|
isModalTense,
|
||||||
|
isPerfectTense,
|
||||||
|
isImperativeTense,
|
||||||
|
} from "./type-predicates";
|
||||||
|
|
||||||
|
function humanReadableVerbTense(tense: T.VerbTense): string {
|
||||||
|
return tense === "presentVerb"
|
||||||
|
? "present"
|
||||||
|
: tense === "subjunctiveVerb"
|
||||||
|
? "subjunctive"
|
||||||
|
: tense === "imperfectiveFuture"
|
||||||
|
? "imperfective future"
|
||||||
|
: tense === "perfectiveFuture"
|
||||||
|
? "perfective future"
|
||||||
|
: tense === "perfectivePast"
|
||||||
|
? "simple past"
|
||||||
|
: tense === "imperfectivePast"
|
||||||
|
? "continuous past"
|
||||||
|
: tense === "habitualImperfectivePast"
|
||||||
|
? "habitual simple past"
|
||||||
|
// : tense === "habitualPerfectivePast"
|
||||||
|
: "habitual continuous past";
|
||||||
|
}
|
||||||
|
|
||||||
|
function humanReadableModalTense(tense: T.ModalTense): string {
|
||||||
|
const base = tense.replace("Modal", "") as T.VerbTense;
|
||||||
|
return `${humanReadableVerbTense(base)} ability`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function humanReadablePerfectTense(tense: T.PerfectTense): string {
|
||||||
|
return tense === "pastPerfect"
|
||||||
|
? "past perfect"
|
||||||
|
: tense === "futurePerfect"
|
||||||
|
? "future perfect"
|
||||||
|
: tense === "presentPerfect"
|
||||||
|
? "present perfect"
|
||||||
|
: tense === "habitualPerfect"
|
||||||
|
? "habitual perfect"
|
||||||
|
: tense === "subjunctivePerfect"
|
||||||
|
? "subjunctive perfect"
|
||||||
|
: tense === "pastSubjunctivePerfect"
|
||||||
|
? "past subjunctive perfect"
|
||||||
|
: tense === "wouldBePerfect"
|
||||||
|
? `"would be" perfect`
|
||||||
|
// : tense === "wouldHaveBeenPerfect"
|
||||||
|
: `"would have been" perfect`
|
||||||
|
}
|
||||||
|
|
||||||
|
function humanReadableImperativeTense(tense: T.ImperativeTense): string {
|
||||||
|
return tense === "imperfectiveImperative"
|
||||||
|
? "imperfective imperative"
|
||||||
|
: "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);
|
||||||
|
}
|
|
@ -157,6 +157,7 @@ import {
|
||||||
import {
|
import {
|
||||||
renderAPSelection,
|
renderAPSelection,
|
||||||
} from "./lib/phrase-building/render-ap";
|
} from "./lib/phrase-building/render-ap";
|
||||||
|
import { humanReadableTense } from "./lib/human-readable";
|
||||||
import NPPicker from "./components/np-picker/NPPicker";
|
import NPPicker from "./components/np-picker/NPPicker";
|
||||||
import EPPicker from "./components/ep-explorer/EPPicker";
|
import EPPicker from "./components/ep-explorer/EPPicker";
|
||||||
import EPExplorer from "./components/ep-explorer/EPExplorer";
|
import EPExplorer from "./components/ep-explorer/EPExplorer";
|
||||||
|
@ -243,6 +244,7 @@ export {
|
||||||
getPashtoFromRendered,
|
getPashtoFromRendered,
|
||||||
renderAPSelection,
|
renderAPSelection,
|
||||||
getEnglishVerb,
|
getEnglishVerb,
|
||||||
|
humanReadableTense,
|
||||||
roleIcon,
|
roleIcon,
|
||||||
vpsReducer,
|
vpsReducer,
|
||||||
makeVPSelectionState,
|
makeVPSelectionState,
|
||||||
|
|
Loading…
Reference in New Issue