humanReadableInflectionPattern
This commit is contained in:
parent
7efc30bbb7
commit
383902b3b2
|
@ -1,3 +1,3 @@
|
||||||
[build]
|
[build]
|
||||||
command = "yarn build-website"
|
command = "yarn build-website"
|
||||||
publish = "build"
|
publish = "build/"
|
||||||
|
|
22
package.json
22
package.json
|
@ -1,9 +1,19 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "3.9.4",
|
"version": "3.9.5",
|
||||||
"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",
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject",
|
||||||
|
"build-website": "node get-words.js && npm run build",
|
||||||
|
"build-library": "node get-words.js && rimraf dist && rimraf dist-cjs && tsc --project library-tsconfig.json && node library-post-build.js && rollup -c",
|
||||||
|
"test-ci": "npm run test -- --watchAll=false",
|
||||||
|
"get-words": "node get-words.js"
|
||||||
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist-cjs/library.js",
|
"main": "dist-cjs/library.js",
|
||||||
"module": "dist/library.js",
|
"module": "dist/library.js",
|
||||||
|
@ -63,16 +73,6 @@
|
||||||
"react-bootstrap": "^1.5.1",
|
"react-bootstrap": "^1.5.1",
|
||||||
"react-dom": "^17.0.1"
|
"react-dom": "^17.0.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
|
||||||
"start": "react-scripts start",
|
|
||||||
"build": "react-scripts build",
|
|
||||||
"test": "react-scripts test",
|
|
||||||
"eject": "react-scripts eject",
|
|
||||||
"build-website": "node get-words.js && npm run build",
|
|
||||||
"build-library": "node get-words.js && rimraf dist && rimraf dist-cjs && tsc --project library-tsconfig.json && node library-post-build.js && rollup -c",
|
|
||||||
"test-ci": "npm run test -- --watchAll=false",
|
|
||||||
"get-words": "node get-words.js"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
"react-app",
|
"react-app",
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
import { AdjectiveEntry, InflectionPattern, NounEntry } from "../types";
|
|
||||||
import {
|
|
||||||
isFemNounEntry,
|
|
||||||
isNounEntry,
|
|
||||||
isPattern1Entry,
|
|
||||||
isPattern2Entry,
|
|
||||||
isPattern3Entry,
|
|
||||||
isPattern4Entry,
|
|
||||||
isPattern5Entry,
|
|
||||||
isPattern6FemEntry,
|
|
||||||
} from "./type-predicates";
|
|
||||||
|
|
||||||
export function getInflectionPattern(e: NounEntry | AdjectiveEntry): InflectionPattern {
|
|
||||||
return isPattern1Entry(e)
|
|
||||||
? InflectionPattern.Basic
|
|
||||||
: isPattern2Entry(e)
|
|
||||||
? InflectionPattern.UnstressedEy
|
|
||||||
: isPattern3Entry(e)
|
|
||||||
? InflectionPattern.StressedEy
|
|
||||||
: isPattern4Entry(e)
|
|
||||||
? InflectionPattern.Pashtun
|
|
||||||
: isPattern5Entry(e)
|
|
||||||
? InflectionPattern.Squish
|
|
||||||
: isNounEntry(e) && isFemNounEntry(e) && isPattern6FemEntry(e)
|
|
||||||
? InflectionPattern.FemInanEe
|
|
||||||
: InflectionPattern.None;
|
|
||||||
}
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import * as T from "../types";
|
||||||
|
import {
|
||||||
|
isFemNounEntry,
|
||||||
|
isNounEntry,
|
||||||
|
isPattern1Entry,
|
||||||
|
isPattern2Entry,
|
||||||
|
isPattern3Entry,
|
||||||
|
isPattern4Entry,
|
||||||
|
isPattern5Entry,
|
||||||
|
isPattern6FemEntry,
|
||||||
|
} from "./type-predicates";
|
||||||
|
import InlinePs from "../components/InlinePs";
|
||||||
|
|
||||||
|
export function getInflectionPattern(e: T.NounEntry | T.AdjectiveEntry): T.InflectionPattern {
|
||||||
|
return isPattern1Entry(e)
|
||||||
|
? T.InflectionPattern.Basic
|
||||||
|
: isPattern2Entry(e)
|
||||||
|
? T.InflectionPattern.UnstressedEy
|
||||||
|
: isPattern3Entry(e)
|
||||||
|
? T.InflectionPattern.StressedEy
|
||||||
|
: isPattern4Entry(e)
|
||||||
|
? T.InflectionPattern.Pashtun
|
||||||
|
: isPattern5Entry(e)
|
||||||
|
? T.InflectionPattern.Squish
|
||||||
|
: isNounEntry(e) && isFemNounEntry(e) && isPattern6FemEntry(e)
|
||||||
|
? T.InflectionPattern.FemInanEe
|
||||||
|
: T.InflectionPattern.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function humanReadableInflectionPattern(p: T.InflectionPattern, textOptions: T.TextOptions): JSX.Element | null {
|
||||||
|
return p === 1
|
||||||
|
? <span>#1 Basic</span>
|
||||||
|
: p === 2
|
||||||
|
? <span>#2 Unstressed <InlinePs opts={textOptions}>{{ p: "ی", f: "ey", e: "" }}</InlinePs></span>
|
||||||
|
: p === 3
|
||||||
|
? <span>#3 Stressed <InlinePs opts={textOptions}>{{ p: "ی", f: "éy", e: "" }}</InlinePs></span>
|
||||||
|
: p === 4
|
||||||
|
? <span>#4 "Pashtoon"</span>
|
||||||
|
: p === 5
|
||||||
|
? <span>#5 Short Squish</span>
|
||||||
|
: p === 6
|
||||||
|
? <span>#6 Fem. inan. <InlinePs opts={textOptions}>{{ p: "ي", f: "ee", e: "" }}</InlinePs></span>
|
||||||
|
: null;
|
||||||
|
}
|
|
@ -39,7 +39,10 @@ import Block, { NPBlock, APBlock } from "./components/blocks/Block";
|
||||||
import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal";
|
import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal";
|
||||||
import CompiledPTextDisplay from "./components/CompiledPTextDisplay";
|
import CompiledPTextDisplay from "./components/CompiledPTextDisplay";
|
||||||
import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay";
|
import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay";
|
||||||
import { getInflectionPattern } from "./lib/inflection-pattern";
|
import {
|
||||||
|
getInflectionPattern,
|
||||||
|
humanReadableInflectionPattern,
|
||||||
|
} from "./lib/inflection-pattern";
|
||||||
import {
|
import {
|
||||||
makePsString,
|
makePsString,
|
||||||
removeFVarients,
|
removeFVarients,
|
||||||
|
@ -254,6 +257,7 @@ export {
|
||||||
getEnglishVerb,
|
getEnglishVerb,
|
||||||
humanReadableVerbForm,
|
humanReadableVerbForm,
|
||||||
humanReadableEquativeTense,
|
humanReadableEquativeTense,
|
||||||
|
humanReadableInflectionPattern,
|
||||||
ensureNonComboVerbInfo,
|
ensureNonComboVerbInfo,
|
||||||
roleIcon,
|
roleIcon,
|
||||||
vpsReducer,
|
vpsReducer,
|
||||||
|
|
Loading…
Reference in New Issue