add getInflectionCategory
This commit is contained in:
parent
54b42b7e70
commit
cc2e5fe0bc
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "3.9.0",
|
||||
"version": "3.9.1",
|
||||
"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",
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
import { AdjectiveEntry, InflectionCategory, NounEntry } from "../types";
|
||||
import {
|
||||
isFemNounEntry,
|
||||
isNounEntry,
|
||||
isPattern1Entry,
|
||||
isPattern2Entry,
|
||||
isPattern3Entry,
|
||||
isPattern4Entry,
|
||||
isPattern5Entry,
|
||||
isPattern6FemEntry,
|
||||
} from "./type-predicates";
|
||||
|
||||
export function getInflectionCategory(e: NounEntry | AdjectiveEntry): InflectionCategory {
|
||||
return isPattern1Entry(e)
|
||||
? InflectionCategory.Basic
|
||||
: isPattern2Entry(e)
|
||||
? InflectionCategory.UnstressedEy
|
||||
: isPattern3Entry(e)
|
||||
? InflectionCategory.StressedEy
|
||||
: isPattern4Entry(e)
|
||||
? InflectionCategory.Pashtun
|
||||
: isPattern5Entry(e)
|
||||
? InflectionCategory.Squish
|
||||
: isNounEntry(e) && isFemNounEntry(e) && isPattern6FemEntry(e)
|
||||
? InflectionCategory.FemInanEe
|
||||
: InflectionCategory.None;
|
||||
}
|
|
@ -39,6 +39,7 @@ 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 { getInflectionCategory } from "./lib/inflection-category";
|
||||
import {
|
||||
makePsString,
|
||||
removeFVarients,
|
||||
|
@ -261,6 +262,7 @@ export {
|
|||
blank,
|
||||
kidsBlank,
|
||||
isPashtoScript,
|
||||
getInflectionCategory,
|
||||
// protobuf helpers
|
||||
readDictionary,
|
||||
writeDictionary,
|
||||
|
|
10
src/types.ts
10
src/types.ts
|
@ -500,6 +500,16 @@ export type VerbEntry = {
|
|||
complement?: DictionaryEntry,
|
||||
};
|
||||
|
||||
export enum InflectionCategory {
|
||||
None = 0,
|
||||
Basic = 1,
|
||||
UnstressedEy = 2,
|
||||
StressedEy = 3,
|
||||
Pashtun = 4,
|
||||
Squish = 5,
|
||||
FemInanEe = 6,
|
||||
};
|
||||
|
||||
export type SingularEntry<T extends NounEntry> = T & { __brand7: "a singular noun - as opposed to an always plural noun" };
|
||||
export type PluralNounEntry<T extends NounEntry> = T & { __brand7: "a noun that is always plural" };
|
||||
|
||||
|
|
Loading…
Reference in New Issue