added r - rank field

This commit is contained in:
adueck 2022-11-25 19:19:22 +05:00
parent 5805ee423b
commit 940764b1c2
8 changed files with 112 additions and 94 deletions

4
package-lock.json generated
View File

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

View File

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

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

View File

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

View File

@ -39,35 +39,36 @@ Entry._readField = function (tag, obj, pbf) {
else if (tag === 4) obj.f = pbf.readString();
else if (tag === 5) obj.g = pbf.readString();
else if (tag === 6) obj.e = pbf.readString();
else if (tag === 7) obj.c = pbf.readString();
else if (tag === 8) obj.l = pbf.readVarint(true);
else if (tag === 9) obj.infap = pbf.readString();
else if (tag === 10) obj.infaf = pbf.readString();
else if (tag === 11) obj.infbp = pbf.readString();
else if (tag === 12) obj.infbf = pbf.readString();
else if (tag === 13) obj.noInf = pbf.readBoolean();
else if (tag === 14) obj.app = pbf.readString();
else if (tag === 15) obj.apf = pbf.readString();
else if (tag === 16) obj.ppp = pbf.readString();
else if (tag === 17) obj.ppf = pbf.readString();
else if (tag === 18) obj.psp = pbf.readString();
else if (tag === 19) obj.psf = pbf.readString();
else if (tag === 20) obj.ssp = pbf.readString();
else if (tag === 21) obj.ssf = pbf.readString();
else if (tag === 22) obj.prp = pbf.readString();
else if (tag === 23) obj.prf = pbf.readString();
else if (tag === 24) obj.pprtp = pbf.readString();
else if (tag === 25) obj.pprtf = pbf.readString();
else if (tag === 26) obj.tppp = pbf.readString();
else if (tag === 27) obj.tppf = pbf.readString();
else if (tag === 28) obj.shortIntrans = pbf.readBoolean();
else if (tag === 29) obj.noOo = pbf.readBoolean();
else if (tag === 30) obj.sepOo = pbf.readBoolean();
else if (tag === 31) obj.separationAtP = pbf.readVarint(true);
else if (tag === 32) obj.separationAtF = pbf.readVarint(true);
else if (tag === 33) obj.diacExcept = pbf.readBoolean();
else if (tag === 34) obj.ec = pbf.readString();
else if (tag === 35) obj.ep = pbf.readString();
else if (tag === 7) obj.r = pbf.readVarint(true);
else if (tag === 8) obj.c = pbf.readString();
else if (tag === 9) obj.l = pbf.readVarint(true);
else if (tag === 10) obj.infap = pbf.readString();
else if (tag === 11) obj.infaf = pbf.readString();
else if (tag === 12) obj.infbp = pbf.readString();
else if (tag === 13) obj.infbf = pbf.readString();
else if (tag === 14) obj.noInf = pbf.readBoolean();
else if (tag === 15) obj.app = pbf.readString();
else if (tag === 16) obj.apf = pbf.readString();
else if (tag === 17) obj.ppp = pbf.readString();
else if (tag === 18) obj.ppf = pbf.readString();
else if (tag === 19) obj.psp = pbf.readString();
else if (tag === 20) obj.psf = pbf.readString();
else if (tag === 21) obj.ssp = pbf.readString();
else if (tag === 22) obj.ssf = pbf.readString();
else if (tag === 23) obj.prp = pbf.readString();
else if (tag === 24) obj.prf = pbf.readString();
else if (tag === 25) obj.pprtp = pbf.readString();
else if (tag === 26) obj.pprtf = pbf.readString();
else if (tag === 27) obj.tppp = pbf.readString();
else if (tag === 28) obj.tppf = pbf.readString();
else if (tag === 29) obj.shortIntrans = pbf.readBoolean();
else if (tag === 30) obj.noOo = pbf.readBoolean();
else if (tag === 31) obj.sepOo = pbf.readBoolean();
else if (tag === 32) obj.separationAtP = pbf.readVarint(true);
else if (tag === 33) obj.separationAtF = pbf.readVarint(true);
else if (tag === 34) obj.diacExcept = pbf.readBoolean();
else if (tag === 35) obj.ec = pbf.readString();
else if (tag === 36) obj.ep = pbf.readString();
};
Entry.write = function (obj, pbf) {
if (obj.ts) pbf.writeVarintField(1, obj.ts);
@ -76,35 +77,36 @@ Entry.write = function (obj, pbf) {
if (obj.f) pbf.writeStringField(4, obj.f);
if (obj.g) pbf.writeStringField(5, obj.g);
if (obj.e) pbf.writeStringField(6, obj.e);
if (obj.c) pbf.writeStringField(7, obj.c);
if (obj.l) pbf.writeVarintField(8, obj.l);
if (obj.infap) pbf.writeStringField(9, obj.infap);
if (obj.infaf) pbf.writeStringField(10, obj.infaf);
if (obj.infbp) pbf.writeStringField(11, obj.infbp);
if (obj.infbf) pbf.writeStringField(12, obj.infbf);
if (obj.noInf) pbf.writeBooleanField(13, obj.noInf);
if (obj.app) pbf.writeStringField(14, obj.app);
if (obj.apf) pbf.writeStringField(15, obj.apf);
if (obj.ppp) pbf.writeStringField(16, obj.ppp);
if (obj.ppf) pbf.writeStringField(17, obj.ppf);
if (obj.psp) pbf.writeStringField(18, obj.psp);
if (obj.psf) pbf.writeStringField(19, obj.psf);
if (obj.ssp) pbf.writeStringField(20, obj.ssp);
if (obj.ssf) pbf.writeStringField(21, obj.ssf);
if (obj.prp) pbf.writeStringField(22, obj.prp);
if (obj.prf) pbf.writeStringField(23, obj.prf);
if (obj.pprtp) pbf.writeStringField(24, obj.pprtp);
if (obj.pprtf) pbf.writeStringField(25, obj.pprtf);
if (obj.tppp) pbf.writeStringField(26, obj.tppp);
if (obj.tppf) pbf.writeStringField(27, obj.tppf);
if (obj.shortIntrans) pbf.writeBooleanField(28, obj.shortIntrans);
if (obj.noOo) pbf.writeBooleanField(29, obj.noOo);
if (obj.sepOo) pbf.writeBooleanField(30, obj.sepOo);
if (obj.separationAtP) pbf.writeVarintField(31, obj.separationAtP);
if (obj.separationAtF) pbf.writeVarintField(32, obj.separationAtF);
if (obj.diacExcept) pbf.writeBooleanField(33, obj.diacExcept);
if (obj.ec) pbf.writeStringField(34, obj.ec);
if (obj.ep) pbf.writeStringField(35, obj.ep);
if (obj.r) pbf.writeVarintField(7, obj.r);
if (obj.c) pbf.writeStringField(8, obj.c);
if (obj.l) pbf.writeVarintField(9, obj.l);
if (obj.infap) pbf.writeStringField(10, obj.infap);
if (obj.infaf) pbf.writeStringField(11, obj.infaf);
if (obj.infbp) pbf.writeStringField(12, obj.infbp);
if (obj.infbf) pbf.writeStringField(13, obj.infbf);
if (obj.noInf) pbf.writeBooleanField(14, obj.noInf);
if (obj.app) pbf.writeStringField(15, obj.app);
if (obj.apf) pbf.writeStringField(16, obj.apf);
if (obj.ppp) pbf.writeStringField(17, obj.ppp);
if (obj.ppf) pbf.writeStringField(18, obj.ppf);
if (obj.psp) pbf.writeStringField(19, obj.psp);
if (obj.psf) pbf.writeStringField(20, obj.psf);
if (obj.ssp) pbf.writeStringField(21, obj.ssp);
if (obj.ssf) pbf.writeStringField(22, obj.ssf);
if (obj.prp) pbf.writeStringField(23, obj.prp);
if (obj.prf) pbf.writeStringField(24, obj.prf);
if (obj.pprtp) pbf.writeStringField(25, obj.pprtp);
if (obj.pprtf) pbf.writeStringField(26, obj.pprtf);
if (obj.tppp) pbf.writeStringField(27, obj.tppp);
if (obj.tppf) pbf.writeStringField(28, obj.tppf);
if (obj.shortIntrans) pbf.writeBooleanField(29, obj.shortIntrans);
if (obj.noOo) pbf.writeBooleanField(30, obj.noOo);
if (obj.sepOo) pbf.writeBooleanField(31, obj.sepOo);
if (obj.separationAtP) pbf.writeVarintField(32, obj.separationAtP);
if (obj.separationAtF) pbf.writeVarintField(33, obj.separationAtF);
if (obj.diacExcept) pbf.writeBooleanField(34, obj.diacExcept);
if (obj.ec) pbf.writeStringField(35, obj.ec);
if (obj.ep) pbf.writeStringField(36, obj.ep);
};
// Dictionary ========================================

View File

@ -16,35 +16,36 @@ message Entry {
string f = 4;
string g = 5;
string e = 6;
string c = 7;
int32 l = 8;
string infap = 9;
string infaf = 10;
string infbp = 11;
string infbf = 12;
bool noInf = 13;
string app = 14;
string apf = 15;
string ppp = 16;
string ppf = 17;
string psp = 18;
string psf = 19;
string ssp = 20;
string ssf = 21;
string prp = 22;
string prf = 23;
string pprtp = 24;
string pprtf = 25;
string tppp = 26;
string tppf = 27;
bool shortIntrans = 28;
bool noOo = 29;
bool sepOo = 30;
int32 separationAtP = 31;
int32 separationAtF = 32;
bool diacExcept = 33;
string ec = 34;
string ep = 35;
int 32 r = 7;
string c = 8;
int32 l = 9;
string infap = 10;
string infaf = 11;
string infbp = 12;
string infbf = 13;
bool noInf = 14;
string app = 15;
string apf = 16;
string ppp = 17;
string ppf = 18;
string psp = 19;
string psf = 20;
string ssp = 21;
string ssf = 22;
string prp = 23;
string prf = 24;
string pprtp = 25;
string pprtf = 26;
string tppp = 27;
string tppf = 28;
bool shortIntrans = 29;
bool noOo = 30;
bool sepOo = 31;
int32 separationAtP = 32;
int32 separationAtF = 33;
bool diacExcept = 34;
string ec = 35;
string ep = 36;
}
message Dictionary {

View File

@ -14,6 +14,12 @@ export const blank: T.PsString = {
};
export const kidsBlank: T.PsString = { p: "___", f: "___" };
/**
* returns the main entry of a VerbEntry or just the entry of a DictionaryEntry
*
* @param e FullEntry
* @returns DictionaryEntry
*/
export function entryOfFull(e: T.FullEntry): T.DictionaryEntry {
return "entry" in e ? e.entry : e;
}

View File

@ -37,6 +37,15 @@ export type DictionaryEntry = {
ts: number;
/** Pashto alphabetical index */
i: number;
/**
* commonality rank
* 0 - wrong
* 1 - historical/not in use
* 2 - rarely used
* 3 - used but there are more common alternatives
* 4 - common
*/
r?: number;
/** entry in Pashto */
p: string;
/** entry in Phonetics */
@ -122,7 +131,7 @@ export type FStringNoFVars = string & { __brand: "name for a phonetics string wi
export type DictionaryEntryTextField = "p" | "f" | "e" | "c" | "infap" | "infaf" | "infbp" | "infbf" | "app" | "apf" | "ppp" | "ppf" | "psp" | "psf" | "ssp" | "ssf" | "prp" | "prf" | "pprtp" | "pprtf" | "tppp" | "tppf" | "ec" | "ep";
export type DictionaryEntryBooleanField = "noInf" | "shortIntrans" | "noOo" | "sepOo" | "diacExcept";
export type DictionaryEntryNumberField = "ts" | "i" | "l" | "separationAtP" | "separationAtF";
export type DictionaryEntryNumberField = "ts" | "r" | "i" | "l" | "separationAtP" | "separationAtF";
export type DictionaryEntryField = DictionaryEntryTextField | DictionaryEntryBooleanField | DictionaryEntryNumberField;
// TODO: make