Compare commits

..

No commits in common. "b9cdc632581fa4b0979e67e7923a59fad3bdf8a9" and "23f3dcd2c50654532b587a7ed837d7c425dfbec7" have entirely different histories.

11 changed files with 86 additions and 171 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "pashto-inflector", "name": "pashto-inflector",
"version": "7.1.3", "version": "7.0.11",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pashto-inflector", "name": "pashto-inflector",
"version": "7.1.3", "version": "7.0.11",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "pashto-inflector", "name": "pashto-inflector",
"version": "7.1.3", "version": "7.0.11",
"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",

View File

@ -16,11 +16,10 @@ import useStickyState from "./components/src/useStickyState";
import EPExplorer from "./components/src/ep-explorer/EPExplorer"; import EPExplorer from "./components/src/ep-explorer/EPExplorer";
import VPBuilderDemo from "./demo-components/VPBuilderDemo"; import VPBuilderDemo from "./demo-components/VPBuilderDemo";
import { entryFeeder } from "./demo-components/entryFeeder"; import { entryFeeder } from "./demo-components/entryFeeder";
import Hider from "./components/src/Hider"; import { Hider } from "./components/library";
import InflectionDemo from "./demo-components/InflectionDemo"; import InflectionDemo from "./demo-components/InflectionDemo";
import SpellingDemo from "./demo-components/SpellingDemo"; import SpellingDemo from "./demo-components/SpellingDemo";
import ParserDemo from "./demo-components/ParserDemo"; import ParserDemo from "./demo-components/ParserDemo";
import InflectionTable from "./components/src/InflectionsTable";
function App() { function App() {
const [showingTextOptions, setShowingTextOptions] = useStickyState<boolean>( const [showingTextOptions, setShowingTextOptions] = useStickyState<boolean>(
@ -40,17 +39,6 @@ function App() {
document.documentElement.setAttribute("data-theme", theme); document.documentElement.setAttribute("data-theme", theme);
}, [theme]); }, [theme]);
// const infout = inflectWord({
// ts: 1527814202,
// i: 12761,
// p: "کرسي",
// f: "kUrsee",
// g: "kUrsee",
// e: "chair, seat, stool",
// r: 3,
// c: "n. f.",
// });
return ( return (
<> <>
<main className="flex-shrink-0 mb-4"> <main className="flex-shrink-0 mb-4">
@ -109,13 +97,6 @@ function App() {
on GitHub on GitHub
</p> </p>
</div> </div>
{/* for testing inflection table */}
{/* {typeof infout === "object" && infout.inflections && (
<InflectionTable
inf={infout.inflections}
textOptions={textOptions}
/>
)} */}
<h2 className="mb-3">Demos:</h2> <h2 className="mb-3">Demos:</h2>
<Hider <Hider
label="Verb Conjugation / Verb Phrase Engine" label="Verb Conjugation / Verb Phrase Engine"

View File

@ -1,12 +1,12 @@
{ {
"name": "@lingdocs/ps-react", "name": "@lingdocs/ps-react",
"version": "7.1.3", "version": "7.0.11",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lingdocs/ps-react", "name": "@lingdocs/ps-react",
"version": "7.1.3", "version": "7.0.11",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@formkit/auto-animate": "^1.0.0-beta.3", "@formkit/auto-animate": "^1.0.0-beta.3",

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/ps-react", "name": "@lingdocs/ps-react",
"version": "7.1.3", "version": "7.0.11",
"description": "Pashto inflector library module with React components", "description": "Pashto inflector library module with React components",
"main": "dist/components/library.js", "main": "dist/components/library.js",
"module": "dist/components/library.js", "module": "dist/components/library.js",

View File

@ -39,88 +39,38 @@ import { isPluralInflections } from "../../lib/src/p-text-helpers";
// </>; // </>;
// } // }
const InflectionTable = ({ const InflectionTable = ({ inf, textOptions, hideTitle }: {
inf, inf: T.Inflections | T.PluralInflections,
textOptions, textOptions: T.TextOptions,
hideTitle, hideTitle?: boolean,
}: {
inf: T.Inflections | T.PluralInflections;
textOptions: T.TextOptions;
hideTitle?: boolean;
}) => { }) => {
// const [showingExplanation, setShowingExplanation] = useState(false); // const [showingExplanation, setShowingExplanation] = useState(false);
/* istanbul ignore next */ // Insanely can't see the modal to close it /* istanbul ignore next */ // Insanely can't see the modal to close it
// const handleCloseExplanation = () => setShowingExplanation(false); // const handleCloseExplanation = () => setShowingExplanation(false);
// const handleShowExplanation = () => setShowingExplanation(true); // const handleShowExplanation = () => setShowingExplanation(true);
const isPluralInfs = isPluralInflections(inf); const isPluralInfs = isPluralInflections(inf);
console.log({ inf });
return ( return (
<div className={!hideTitle ? "" : "mt-4"}> <div className={!hideTitle ? "" : "mt-4"}>
{!hideTitle && ( {!hideTitle && <div style={{ display: "flex", justifyContent: !isPluralInfs ? "space-between" : "left" }}>
<div
style={{
display: "flex",
justifyContent: !isPluralInfs ? "space-between" : "left",
}}
>
{!isPluralInfs && <h5>Inflections</h5>} {!isPluralInfs && <h5>Inflections</h5>}
{/* {!isPluralInfs && <div className="clickable mr-2" onClick={handleShowExplanation} data-testid="help-button"> {/* {!isPluralInfs && <div className="clickable mr-2" onClick={handleShowExplanation} data-testid="help-button">
<i className={`fa fa-question-circle`}></i> <i className={`fa fa-question-circle`}></i>
</div>} */} </div>} */}
</div> </div>}
)} <table className="table" style={{ tableLayout: "fixed" }}>
<table
className="table"
style={{ tableLayout: "fixed", textAlign: "center" }}
>
<thead> <thead>
<tr> <tr>
<th scope="col" style={{ width: "3.5rem" }}></th> <th scope="col" style={{ width: "3.5rem" }}></th>
{"masc" in inf && ( {"masc" in inf && <th scope="col" style={{ maxWidth: "10rem", textAlign: "left" }}>Masculine</th>}
<th {"fem" in inf && <th scope="col" style={{ maxWidth: "10rem", textAlign: "left" }}>Feminine</th>}
scope="col"
style={{
maxWidth: "10rem",
textAlign: "center",
borderLeft: "1px solid #dee2e6",
...("fem" in inf
? {
borderRight: "1px solid #dee2e6",
}
: {}),
}}
>
Masculine
</th>
)}
{"fem" in inf && (
<th
scope="col"
style={{ maxWidth: "10rem", textAlign: "center" }}
>
Feminine
</th>
)}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{(!isPluralInfs {(!isPluralInfs ? ["Plain", "1st", "2nd"] : ["Plural", "2nd Inf."]).map((title, i) => (
? ["Plain", "1st", "2nd"]
: ["Plural", "2nd Inf."]
).map((title, i) => (
<tr key={title}> <tr key={title}>
<th scope="row">{title}</th> <th scope="row">{title}</th>
{"masc" in inf && ( {"masc" in inf && <TableCell item={inf.masc[i]} textOptions={textOptions} />}
<TableCell {"fem" in inf && <TableCell item={inf.fem[i]} textOptions={textOptions} />}
item={inf.masc[i]}
textOptions={textOptions}
colSpan={"fem" in inf && i === 2 ? 2 : 1}
center
/>
)}
{"fem" in inf && (!("masc" in inf) || i < 2) && (
<TableCell item={inf.fem[i]} textOptions={textOptions} center />
)}
</tr> </tr>
))} ))}
</tbody> </tbody>

View File

@ -24,13 +24,11 @@ function TableCell({
textOptions, textOptions,
center, center,
noBorder, noBorder,
colSpan,
}: { }: {
item: T.PsString[]; item: T.PsString[];
textOptions: T.TextOptions; textOptions: T.TextOptions;
center?: boolean; center?: boolean;
noBorder?: boolean; noBorder?: boolean;
colSpan?: 1 | 2;
}) { }) {
const [version, setVersion] = useState(0); const [version, setVersion] = useState(0);
useEffect(() => setVersion(0), [item]); useEffect(() => setVersion(0), [item]);
@ -39,12 +37,7 @@ function TableCell({
} }
const w = item[version] || item[0]; const w = item[version] || item[0];
return ( return (
<td <td style={{ ...(noBorder ? { border: "none" } : {}) }}>
colSpan={colSpan || 1}
style={{
...(noBorder ? { border: "none" } : { border: "2px solid #dee2e6" }),
}}
>
<div <div
style={{ style={{
display: "flex", display: "flex",

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/inflect", "name": "@lingdocs/inflect",
"version": "7.1.3", "version": "7.0.11",
"description": "Pashto inflector library", "description": "Pashto inflector library",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/lib/library.d.ts", "types": "dist/lib/library.d.ts",

View File

@ -44,8 +44,6 @@ const lafz = wordQuery("لفظ", "noun");
// TODO: زړو should not be hearts // TODO: زړو should not be hearts
// bundled plural // bundled plural
// TODO: FIX ماماګان
const tests: { const tests: {
category: string; category: string;
cases: { cases: {
@ -1143,31 +1141,30 @@ const tests: {
}, },
], ],
}, },
// TODO: FIX THIS!! {
// { input: "ماماګان",
// input: "ماماګان", output: [
// output: [ {
// { inflected: false,
// inflected: false, selection: {
// selection: { ...makeNounSelection(maamaa, undefined),
// ...makeNounSelection(maamaa, undefined), number: "plural",
// number: "plural", },
// }, },
// }, ],
// ], },
// }, {
// { input: "ماماګانو",
// input: "ماماګانو", output: [
// output: [ {
// { inflected: true,
// inflected: true, selection: {
// selection: { ...makeNounSelection(maamaa, undefined),
// ...makeNounSelection(maamaa, undefined), number: "plural",
// number: "plural", },
// }, },
// }, ],
// ], },
// },
{ {
input: "ډاکټران", input: "ډاکټران",
output: [ output: [

View File

@ -94,7 +94,7 @@ const adjectives: {
[{ p: "وروستی", f: "wroostáy" }], [{ p: "وروستی", f: "wroostáy" }],
[{ p: "وروستي", f: "wroostée" }], [{ p: "وروستي", f: "wroostée" }],
[ [
{ p: "وروستیو", f: "wroostúyo" }, { p: "وروستیو", f: "wroostíyo" },
{ p: "وروستو", f: "wroostó" }, { p: "وروستو", f: "wroostó" },
], ],
], ],
@ -102,7 +102,7 @@ const adjectives: {
[{ p: "وروستۍ", f: "wroostúy" }], [{ p: "وروستۍ", f: "wroostúy" }],
[{ p: "وروستۍ", f: "wroostúy" }], [{ p: "وروستۍ", f: "wroostúy" }],
[ [
{ p: "وروستیو", f: "wroostúyo" }, { p: "وروستیو", f: "wroostíyo" },
{ p: "وروستو", f: "wroostó" }, { p: "وروستو", f: "wroostó" },
], ],
], ],
@ -453,7 +453,7 @@ const nouns: {
[{ p: "ترورزی", f: "trorzáy" }], [{ p: "ترورزی", f: "trorzáy" }],
[{ p: "ترورزي", f: "trorzée" }], [{ p: "ترورزي", f: "trorzée" }],
[ [
{ p: "ترورزیو", f: "trorzúyo" }, { p: "ترورزیو", f: "trorzíyo" },
{ p: "ترورزو", f: "trorzó" }, { p: "ترورزو", f: "trorzó" },
], ],
], ],
@ -461,7 +461,7 @@ const nouns: {
[{ p: "ترورزۍ", f: "trorzúy" }], [{ p: "ترورزۍ", f: "trorzúy" }],
[{ p: "ترورزۍ", f: "trorzúy" }], [{ p: "ترورزۍ", f: "trorzúy" }],
[ [
{ p: "ترورزیو", f: "trorzúyo" }, { p: "ترورزیو", f: "trorzíyo" },
{ p: "ترورزو", f: "trorzó" }, { p: "ترورزو", f: "trorzó" },
], ],
], ],
@ -530,7 +530,7 @@ const nouns: {
[{ p: "پلوی", f: "palawáy" }], [{ p: "پلوی", f: "palawáy" }],
[{ p: "پلوي", f: "palawée" }], [{ p: "پلوي", f: "palawée" }],
[ [
{ p: "پلویو", f: "palawúyo" }, { p: "پلویو", f: "palawíyo" },
{ p: "پلوو", f: "palawó" }, { p: "پلوو", f: "palawó" },
], ],
], ],
@ -538,7 +538,7 @@ const nouns: {
[{ p: "پلوۍ", f: "palawúy" }], [{ p: "پلوۍ", f: "palawúy" }],
[{ p: "پلوۍ", f: "palawúy" }], [{ p: "پلوۍ", f: "palawúy" }],
[ [
{ p: "پلویو", f: "palawúyo" }, { p: "پلویو", f: "palawíyo" },
{ p: "پلوو", f: "palawó" }, { p: "پلوو", f: "palawó" },
], ],
], ],
@ -573,7 +573,7 @@ const nouns: {
[{ p: "سړی", f: "saRáy" }], [{ p: "سړی", f: "saRáy" }],
[{ p: "سړي", f: "saRée" }], [{ p: "سړي", f: "saRée" }],
[ [
{ p: "سړیو", f: "saRúyo" }, { p: "سړیو", f: "saRíyo" },
{ p: "سړو", f: "saRó" }, { p: "سړو", f: "saRó" },
], ],
], ],
@ -598,7 +598,7 @@ const nouns: {
[{ p: "سیلانی", f: "saylaanáy" }], [{ p: "سیلانی", f: "saylaanáy" }],
[{ p: "سیلاني", f: "saylaanée" }], [{ p: "سیلاني", f: "saylaanée" }],
[ [
{ p: "سیلانیو", f: "saylaanúyo" }, { p: "سیلانیو", f: "saylaaníyo" },
{ p: "سیلانو", f: "saylaanó" }, { p: "سیلانو", f: "saylaanó" },
], ],
], ],
@ -628,7 +628,7 @@ const nouns: {
[{ p: "ترېلی", f: "treláy" }], [{ p: "ترېلی", f: "treláy" }],
[{ p: "ترېلي", f: "trelée" }], [{ p: "ترېلي", f: "trelée" }],
[ [
{ p: "ترېلیو", f: "trelúyo" }, { p: "ترېلیو", f: "trelíyo" },
{ p: "ترېلو", f: "treló" }, { p: "ترېلو", f: "treló" },
], ],
], ],
@ -1385,10 +1385,7 @@ const nouns: {
fem: [ fem: [
[{ p: "دوستي", f: "dostee" }], [{ p: "دوستي", f: "dostee" }],
[{ p: "دوستۍ", f: "dostúy" }], [{ p: "دوستۍ", f: "dostúy" }],
[ [{ p: "دوستیو", f: "dostúyo" }],
{ p: "دوستیو", f: "dostúyo" },
{ p: "دوستو", f: "dostó" },
],
], ],
}, },
}, },
@ -1410,7 +1407,7 @@ const nouns: {
[{ p: "کرسۍ", f: "kUrsúy" }], [{ p: "کرسۍ", f: "kUrsúy" }],
[{ p: "کرسۍ", f: "kUrsúy" }], [{ p: "کرسۍ", f: "kUrsúy" }],
[ [
{ p: "کرسیو", f: "kUrsúyo" }, { p: "کرسیو", f: "kUrsíyo" },
{ p: "کرسو", f: "kUrsó" }, { p: "کرسو", f: "kUrsó" },
], ],
], ],

View File

@ -294,7 +294,7 @@ function inflectEmphasizedYayUnisex(p: string, f: string): T.UnisexInflections {
[{ p, f }], [{ p, f }],
[{ p: `${baseP}ي`, f: `${baseF}ée` }], [{ p: `${baseP}ي`, f: `${baseF}ée` }],
[ [
{ p: `${baseP}یو`, f: `${baseF}úyo` }, { p: `${baseP}یو`, f: `${baseF}íyo` },
{ p: `${baseP}و`, f: `${baseF}ó` }, { p: `${baseP}و`, f: `${baseF}ó` },
], ],
], ],
@ -302,7 +302,7 @@ function inflectEmphasizedYayUnisex(p: string, f: string): T.UnisexInflections {
[{ p: `${baseP}ۍ`, f: `${baseF}úy` }], [{ p: `${baseP}ۍ`, f: `${baseF}úy` }],
[{ p: `${baseP}ۍ`, f: `${baseF}úy` }], [{ p: `${baseP}ۍ`, f: `${baseF}úy` }],
[ [
{ p: `${baseP}یو`, f: `${baseF}úyo` }, { p: `${baseP}یو`, f: `${baseF}íyo` },
{ p: `${baseP}و`, f: `${baseF}ó` }, { p: `${baseP}و`, f: `${baseF}ó` },
], ],
], ],
@ -363,7 +363,7 @@ function inflectRegularEmphasizedYayMasc(p: string, f: string): T.Inflections {
[{ p, f }], [{ p, f }],
[{ p: `${baseP}ي`, f: `${baseF}ée` }], [{ p: `${baseP}ي`, f: `${baseF}ée` }],
[ [
{ p: `${baseP}یو`, f: `${baseF}úyo` }, { p: `${baseP}یو`, f: `${baseF}íyo` },
{ p: `${baseP}و`, f: `${baseF}ó` }, { p: `${baseP}و`, f: `${baseF}ó` },
], ],
], ],
@ -443,10 +443,7 @@ function inflectRegularInanEeFem(p: string, f: string): T.Inflections {
fem: [ fem: [
[{ p, f }], [{ p, f }],
[{ p: `${baseP}ۍ`, f: `${baseF}úy` }], [{ p: `${baseP}ۍ`, f: `${baseF}úy` }],
[ [{ p: `${baseP}یو`, f: `${baseF}úyo` }],
{ p: `${baseP}یو`, f: `${baseF}úyo` },
{ p: `${baseP}و`, f: `${baseF}ó` },
],
], ],
}; };
} }
@ -459,7 +456,7 @@ function inflectRegularUyFem(p: string, f: string): T.Inflections {
[{ p, f: `${baseF}úy` }], [{ p, f: `${baseF}úy` }],
[{ p, f: `${baseF}úy` }], [{ p, f: `${baseF}úy` }],
[ [
{ p: `${baseP}یو`, f: `${baseF}úyo` }, { p: `${baseP}یو`, f: `${baseF}íyo` },
{ p: `${baseP}و`, f: `${baseF}ó` }, { p: `${baseP}و`, f: `${baseF}ó` },
], ],
], ],