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",
"version": "7.1.3",
"version": "7.0.11",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pashto-inflector",
"version": "7.1.3",
"version": "7.0.11",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

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

@ -16,11 +16,10 @@ import useStickyState from "./components/src/useStickyState";
import EPExplorer from "./components/src/ep-explorer/EPExplorer";
import VPBuilderDemo from "./demo-components/VPBuilderDemo";
import { entryFeeder } from "./demo-components/entryFeeder";
import Hider from "./components/src/Hider";
import { Hider } from "./components/library";
import InflectionDemo from "./demo-components/InflectionDemo";
import SpellingDemo from "./demo-components/SpellingDemo";
import ParserDemo from "./demo-components/ParserDemo";
import InflectionTable from "./components/src/InflectionsTable";
function App() {
const [showingTextOptions, setShowingTextOptions] = useStickyState<boolean>(
@ -40,17 +39,6 @@ function App() {
document.documentElement.setAttribute("data-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 (
<>
<main className="flex-shrink-0 mb-4">
@ -109,13 +97,6 @@ function App() {
on GitHub
</p>
</div>
{/* for testing inflection table */}
{/* {typeof infout === "object" && infout.inflections && (
<InflectionTable
inf={infout.inflections}
textOptions={textOptions}
/>
)} */}
<h2 className="mb-3">Demos:</h2>
<Hider
label="Verb Conjugation / Verb Phrase Engine"

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/ps-react",
"version": "7.1.3",
"version": "7.0.11",
"description": "Pashto inflector library module with React components",
"main": "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 = ({
inf,
textOptions,
hideTitle,
}: {
inf: T.Inflections | T.PluralInflections;
textOptions: T.TextOptions;
hideTitle?: boolean;
const InflectionTable = ({ inf, textOptions, hideTitle }: {
inf: T.Inflections | T.PluralInflections,
textOptions: T.TextOptions,
hideTitle?: boolean,
}) => {
// const [showingExplanation, setShowingExplanation] = useState(false);
/* istanbul ignore next */ // Insanely can't see the modal to close it
// const handleCloseExplanation = () => setShowingExplanation(false);
// const handleShowExplanation = () => setShowingExplanation(true);
const isPluralInfs = isPluralInflections(inf);
console.log({ inf });
return (
<div className={!hideTitle ? "" : "mt-4"}>
{!hideTitle && (
<div
style={{
display: "flex",
justifyContent: !isPluralInfs ? "space-between" : "left",
}}
>
{!hideTitle && <div style={{ display: "flex", justifyContent: !isPluralInfs ? "space-between" : "left" }}>
{!isPluralInfs && <h5>Inflections</h5>}
{/* {!isPluralInfs && <div className="clickable mr-2" onClick={handleShowExplanation} data-testid="help-button">
<i className={`fa fa-question-circle`}></i>
</div>} */}
</div>
)}
<table
className="table"
style={{ tableLayout: "fixed", textAlign: "center" }}
>
</div>}
<table className="table" style={{ tableLayout: "fixed" }}>
<thead>
<tr>
<th scope="col" style={{ width: "3.5rem" }}></th>
{"masc" in inf && (
<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>
)}
{"masc" in inf && <th scope="col" style={{ maxWidth: "10rem", textAlign: "left" }}>Masculine</th>}
{"fem" in inf && <th scope="col" style={{ maxWidth: "10rem", textAlign: "left" }}>Feminine</th>}
</tr>
</thead>
<tbody>
{(!isPluralInfs
? ["Plain", "1st", "2nd"]
: ["Plural", "2nd Inf."]
).map((title, i) => (
{(!isPluralInfs ? ["Plain", "1st", "2nd"] : ["Plural", "2nd Inf."]).map((title, i) => (
<tr key={title}>
<th scope="row">{title}</th>
{"masc" in inf && (
<TableCell
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 />
)}
{"masc" in inf && <TableCell item={inf.masc[i]} textOptions={textOptions} />}
{"fem" in inf && <TableCell item={inf.fem[i]} textOptions={textOptions} />}
</tr>
))}
</tbody>

View File

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

View File

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

View File

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

View File

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

View File

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