Compare commits
5 Commits
c9f369de09
...
eca395bd5d
Author | SHA1 | Date |
---|---|---|
adueck | eca395bd5d | |
adueck | 53fe184b06 | |
adueck | 2aaec630fe | |
adueck | 014de4007f | |
adueck | c6b4d19abf |
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.8",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pashto-inflector",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.8",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.8",
|
||||
"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",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lingdocs/ps-react",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.8",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lingdocs/ps-react",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.8",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formkit/auto-animate": "^1.0.0-beta.3",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/ps-react",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.8",
|
||||
"description": "Pashto inflector library module with React components",
|
||||
"main": "dist/components/library.js",
|
||||
"module": "dist/components/library.js",
|
||||
|
|
|
@ -12,48 +12,66 @@ import * as T from "../../types";
|
|||
|
||||
type PsStringWSub = T.PsString & { sub?: any };
|
||||
|
||||
function EnglishContent({ children }: { children: (string | JSX.Element)[] | (string | JSX.Element) }) {
|
||||
if (Array.isArray(children)) {
|
||||
return <>
|
||||
{children.map((x) => <EnglishContent>{x}</EnglishContent>)}
|
||||
</>
|
||||
}
|
||||
return <div className="text-muted">
|
||||
{children}
|
||||
</div>;
|
||||
}
|
||||
|
||||
function Examples(props: ({
|
||||
ex: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[],
|
||||
} | {
|
||||
children: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[],
|
||||
}) & {
|
||||
opts: T.TextOptions,
|
||||
lineHeight?: 0 | 1 | 2 | 3 | 4,
|
||||
function EnglishContent({
|
||||
children,
|
||||
}: {
|
||||
children: (string | JSX.Element)[] | (string | JSX.Element);
|
||||
}) {
|
||||
const examples = "children" in props ? props.children : props.ex;
|
||||
const Example = ({ children: text }: { children: PsStringWSub }) => (
|
||||
<div className={props.lineHeight !== undefined ? `mb-${props.lineHeight}` : `mt-1 mb-3`}>
|
||||
<div>
|
||||
<Pashto opts={props.opts}>{text}</Pashto>
|
||||
</div>
|
||||
<div>
|
||||
<Phonetics opts={props.opts}>{text}</Phonetics>
|
||||
</div>
|
||||
{text.e && <EnglishContent>
|
||||
{text.e}
|
||||
</EnglishContent>}
|
||||
{text.sub && <div className="small text-muted">
|
||||
{text.sub}
|
||||
</div>}
|
||||
</div>
|
||||
if (Array.isArray(children)) {
|
||||
return (
|
||||
<>
|
||||
{children.map((x) => (
|
||||
<EnglishContent>{x}</EnglishContent>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
return Array.isArray(examples) ?
|
||||
<div>
|
||||
{examples.map((example, i) => <Example key={i}>{example as PsStringWSub}</Example>)}
|
||||
</div>
|
||||
:
|
||||
<Example>{examples as PsStringWSub}</Example>;
|
||||
}
|
||||
return (
|
||||
<div className="text-muted" lang="en">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Examples;
|
||||
function Examples(
|
||||
props: (
|
||||
| {
|
||||
ex: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[];
|
||||
}
|
||||
| {
|
||||
children: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[];
|
||||
}
|
||||
) & {
|
||||
opts: T.TextOptions;
|
||||
lineHeight?: 0 | 1 | 2 | 3 | 4;
|
||||
}
|
||||
) {
|
||||
const examples = "children" in props ? props.children : props.ex;
|
||||
const Example = ({ children: text }: { children: PsStringWSub }) => (
|
||||
<div
|
||||
className={
|
||||
props.lineHeight !== undefined ? `mb-${props.lineHeight}` : `mt-1 mb-3`
|
||||
}
|
||||
>
|
||||
<div>
|
||||
<Pashto opts={props.opts}>{text}</Pashto>
|
||||
</div>
|
||||
<div>
|
||||
<Phonetics opts={props.opts}>{text}</Phonetics>
|
||||
</div>
|
||||
{text.e && <EnglishContent>{text.e}</EnglishContent>}
|
||||
{text.sub && <div className="small text-muted">{text.sub}</div>}
|
||||
</div>
|
||||
);
|
||||
return Array.isArray(examples) ? (
|
||||
<div>
|
||||
{examples.map((example, i) => (
|
||||
<Example key={i}>{example as PsStringWSub}</Example>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Example>{examples as PsStringWSub}</Example>
|
||||
);
|
||||
}
|
||||
|
||||
export default Examples;
|
||||
|
|
|
@ -6,42 +6,37 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import {
|
||||
convertSpelling,
|
||||
} from "../../lib/src/convert-spelling";
|
||||
import {
|
||||
phoneticsToDiacritics
|
||||
} from "../../lib/src/phonetics-to-diacritics";
|
||||
import { convertSpelling } from "../../lib/src/convert-spelling";
|
||||
import { phoneticsToDiacritics } from "../../lib/src/phonetics-to-diacritics";
|
||||
import { psJSXMap } from "./jsx-map";
|
||||
import * as T from "../../types";
|
||||
|
||||
const Pashto = ({ opts, children: text }: {
|
||||
opts: T.TextOptions,
|
||||
children: T.PsString | T.PsJSX,
|
||||
const Pashto = ({
|
||||
opts,
|
||||
children: text,
|
||||
}: {
|
||||
opts: T.TextOptions;
|
||||
children: T.PsString | T.PsJSX;
|
||||
}) => {
|
||||
function convertText(ps: T.PsString, opts: T.TextOptions): string {
|
||||
const p = opts.diacritics
|
||||
? (phoneticsToDiacritics(ps.p, ps.f) || ps.p)
|
||||
: ps.p;
|
||||
return convertSpelling(p, opts.spelling);
|
||||
}
|
||||
const style = opts.pTextSize === "normal"
|
||||
? undefined
|
||||
: { fontSize: opts.pTextSize === "larger" ? "large" : "larger" };
|
||||
return (
|
||||
<span className="p-text" dir="rtl" style={style}>
|
||||
{(typeof text.p !== "string" && typeof text.f !== "string")
|
||||
?
|
||||
psJSXMap(
|
||||
text as T.PsJSX,
|
||||
"p",
|
||||
(ps: T.PsString) => convertText(ps, opts),
|
||||
)
|
||||
:
|
||||
convertText(text as T.PsString, opts)
|
||||
}
|
||||
</span>
|
||||
);
|
||||
function convertText(ps: T.PsString, opts: T.TextOptions): string {
|
||||
const p = opts.diacritics
|
||||
? phoneticsToDiacritics(ps.p, ps.f) || ps.p
|
||||
: ps.p;
|
||||
return convertSpelling(p, opts.spelling);
|
||||
}
|
||||
const style =
|
||||
opts.pTextSize === "normal"
|
||||
? undefined
|
||||
: { fontSize: opts.pTextSize === "larger" ? "large" : "larger" };
|
||||
return (
|
||||
<span className="p-text" dir="rtl" style={style} lang="ps">
|
||||
{typeof text.p !== "string" && typeof text.f !== "string"
|
||||
? psJSXMap(text as T.PsJSX, "p", (ps: T.PsString) =>
|
||||
convertText(ps, opts)
|
||||
)
|
||||
: convertText(text as T.PsString, opts)}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default Pashto;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/inflect",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.8",
|
||||
"description": "Pashto inflector library",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/lib/library.d.ts",
|
||||
|
|
|
@ -57,12 +57,17 @@ export const dynamicAuxVerbs: Array<{
|
|||
{
|
||||
entry: {
|
||||
ts: 1527813914,
|
||||
i: 15179,
|
||||
p: "ورکول",
|
||||
f: "wărkawul",
|
||||
g: "",
|
||||
e: "to give (to him, her, them, others)",
|
||||
g: "warkawul",
|
||||
e: "to give (to him/her/it - towards third person)",
|
||||
r: 4,
|
||||
c: "v. trans.",
|
||||
i: 12350,
|
||||
pprtp: "ورکړی",
|
||||
pprtf: "wărkúRay",
|
||||
ec: "give,gives,giving,gave,given",
|
||||
a: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -542,4 +547,17 @@ export const dynamicAuxVerbs: Array<{
|
|||
noOo: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
ts: 1527812458,
|
||||
i: 567,
|
||||
p: "استول",
|
||||
f: "astawul",
|
||||
g: "astawul",
|
||||
e: "to send",
|
||||
r: 4,
|
||||
c: "v. trans.",
|
||||
ec: "send,sends,sending,sent,sent",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
@ -310,6 +310,9 @@ export function parseEc(ec: string): T.EnglishVerbConjugationEc {
|
|||
if (s === "be") {
|
||||
return ["am", "is", "being", "was", "been"];
|
||||
}
|
||||
if (s === "give") {
|
||||
return ["give", "gives", "giving", "gave", "gave"];
|
||||
}
|
||||
if (s.slice(-1) === "y" && !isVowel(s.slice(-2)[0])) {
|
||||
const b = s.slice(0, -1);
|
||||
return [`${s}`, `${b}ies`, `${s}ing`, `${b}ied`, `${b}ied`];
|
||||
|
|
|
@ -768,7 +768,10 @@ describe("perfective stems", () => {
|
|||
type: "NComp",
|
||||
comp: {
|
||||
type: "AdjComp",
|
||||
ps: { p: "خفه", f: "khufa" },
|
||||
ps: {
|
||||
p: "خفه",
|
||||
f: "khufá",
|
||||
},
|
||||
gender: "fem",
|
||||
number: "plural",
|
||||
},
|
||||
|
|
|
@ -1142,7 +1142,9 @@ function getDynamicAuxVerb(entry: T.DictionaryEntryNoFVars): {
|
|||
const auxWordResult = dynamicAuxVerbs.find((a) => a.entry.p === auxWord);
|
||||
/* istanbul ignore next */
|
||||
if (!auxWordResult) {
|
||||
throw new Error("unknown auxilary verb for dynamic compound");
|
||||
throw new Error(
|
||||
`${entry.p} - ${entry.ts} unknown auxilary verb ${auxWord} for dynamic compound`
|
||||
);
|
||||
}
|
||||
return {
|
||||
entry: removeFVarients(auxWordResult.entry),
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
module.exports = [
|
||||
{ ts: 1568926976497, e: `x-ray` }, // اکسرې - iksre
|
||||
{ ts: 1602179757779, e: `alphabet` }, // الف بې - alif be
|
||||
{ ts: 1527813840, e: `ashes` }, // ایرې - eere
|
||||
{ ts: 1527816692, e: `glasses, spectacles` }, // اینکې - aynake
|
||||
{ ts: 1527819286, e: `stairs, steps, staircase` }, // پاشتقې - paashtáqe
|
||||
{ ts: 1527816299, e: `money (plural of پېسې)` }, // پیسې - peyse
|
||||
{ ts: 1527814529, e: `buttermilk` }, // تروې - turwe
|
||||
{ ts: 1527816369, e: `widow, woman` }, // تورسرې - torsăre
|
||||
{ ts: 1577408787088, e: `sprey (as in a medicinal spray)` }, // سپرې - spre
|
||||
{ ts: 1527822255, e: `break of dawn, first light of day, sunrise` }, // سپېدې - spedé
|
||||
{ ts: 1626765107329, e: `chickenpox, chicken pox` }, // شرې - sharé
|
||||
{ ts: 1527815008, e: `milk` }, // شودې - shoode
|
||||
{ ts: 1527822131, e: `raw rice, unprocessed rice` }, // شولې - shole
|
||||
{ ts: 1527815009, e: `milk (plural of شيده)` }, // شیدې - sheede
|
||||
{ ts: 1527823571, e: `spit, saliva` }, // ښیالمې - xyaalmé
|
||||
{ ts: 1527816530, e: `sister in law` }, // ښینې - xeene
|
||||
{ ts: 1527823567, e: `spit, saliva, slobber, slime` }, // لاړې - laaRe
|
||||
{ ts: 1527822275, e: `dishes, pots, pans` }, // لوښې - looxe
|
||||
{ ts: 1617443138210, e: `urine, pee, piss` }, // مچیازې - michyaaze, muchyaaze
|
||||
{ ts: 1527814420, e: `yogurt` }, // مستې - maste
|
||||
{ ts: 1577999538077, e: `a sound/cry used to drive sheep on` }, // هرې - hire
|
||||
{ ts: 1586551382412, e: `rice` }, // وریژې - wreejze
|
||||
{ ts: 1527820261, e: `plow, plowing, plough, ploughing` }, // یوې - yuwe
|
||||
];
|
||||
{ ts: 1568926976497, e: `x-ray` }, // اکسرې - iksre
|
||||
{ ts: 1602179757779, e: `alphabet` }, // الف بې - alif be
|
||||
{ ts: 1527813840, e: `ashes` }, // ایرې - eere
|
||||
{ ts: 1527816692, e: `glasses, spectacles` }, // اینکې - aynake
|
||||
{ ts: 1527819286, e: `stairs, steps, staircase` }, // پاشتقې - paashtáqe
|
||||
{ ts: 1527816299, e: `money (plural of پېسې)` }, // پیسې - peyse
|
||||
{ ts: 1527816369, e: `widow, woman` }, // تورسرې - torsăre
|
||||
{ ts: 1577408787088, e: `sprey (as in a medicinal spray)` }, // سپرې - spre
|
||||
{ ts: 1527822255, e: `break of dawn, first light of day, sunrise` }, // سپېدې - spedé
|
||||
{ ts: 1626765107329, e: `chickenpox, chicken pox` }, // شرې - sharé
|
||||
{ ts: 1527815008, e: `milk` }, // شودې - shoode
|
||||
{ ts: 1527822131, e: `raw rice, unprocessed rice` }, // شولې - shole
|
||||
{ ts: 1527815009, e: `milk (plural of شيده)` }, // شیدې - sheede
|
||||
{ ts: 1527823571, e: `spit, saliva` }, // ښیالمې - xyaalmé
|
||||
{ ts: 1527816530, e: `sister in law` }, // ښینې - xeene
|
||||
{ ts: 1527823567, e: `spit, saliva, slobber, slime` }, // لاړې - laaRe
|
||||
{ ts: 1527822275, e: `dishes, pots, pans` }, // لوښې - looxe
|
||||
{ ts: 1617443138210, e: `urine, pee, piss` }, // مچیازې - michyaaze, muchyaaze
|
||||
{ ts: 1527814420, e: `yogurt` }, // مستې - maste
|
||||
{ ts: 1577999538077, e: `a sound/cry used to drive sheep on` }, // هرې - hire
|
||||
{ ts: 1586551382412, e: `rice` }, // وریژې - wreejze
|
||||
{ ts: 1527820261, e: `plow, plowing, plough, ploughing` }, // یوې - yuwe
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue