add a filed to entries for audio

This commit is contained in:
adueck 2023-12-04 14:04:44 +04:00
parent ef120b13aa
commit 17fd8a4d05
9 changed files with 163 additions and 120 deletions

4
package-lock.json generated
View File

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

View File

@ -1,6 +1,6 @@
{
"name": "pashto-inflector",
"version": "6.0.12",
"version": "7.0.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,12 +1,12 @@
{
"name": "@lingdocs/ps-react",
"version": "6.0.12",
"version": "7.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@lingdocs/ps-react",
"version": "6.0.12",
"version": "7.0.0",
"license": "MIT",
"dependencies": {
"@formkit/auto-animate": "^1.0.0-beta.3",

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/ps-react",
"version": "6.0.12",
"version": "7.0.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": "6.0.12",
"version": "7.0.0",
"description": "Pashto inflector library",
"main": "dist/index.js",
"types": "dist/lib/library.d.ts",

View File

@ -1,126 +1,151 @@
// eslint-disable-next-line
'use strict'; // code generated by pbf v3.2.1
"use strict"; // code generated by pbf v3.2.1
// DictionaryInfo ========================================
var DictionaryInfo = exports.DictionaryInfo = {};
var DictionaryInfo = (exports.DictionaryInfo = {});
DictionaryInfo.read = function (pbf, end) {
return pbf.readFields(DictionaryInfo._readField, {title: "", license: "", release: 0, numberOfEntries: 0, url: "", infoUrl: ""}, end);
return pbf.readFields(
DictionaryInfo._readField,
{
title: "",
license: "",
release: 0,
numberOfEntries: 0,
url: "",
infoUrl: "",
},
end
);
};
DictionaryInfo._readField = function (tag, obj, pbf) {
if (tag === 1) obj.title = pbf.readString();
else if (tag === 2) obj.license = pbf.readString();
else if (tag === 3) obj.release = pbf.readVarint(true);
else if (tag === 4) obj.numberOfEntries = pbf.readVarint(true);
else if (tag === 5) obj.url = pbf.readString();
else if (tag === 6) obj.infoUrl = pbf.readString();
if (tag === 1) obj.title = pbf.readString();
else if (tag === 2) obj.license = pbf.readString();
else if (tag === 3) obj.release = pbf.readVarint(true);
else if (tag === 4) obj.numberOfEntries = pbf.readVarint(true);
else if (tag === 5) obj.url = pbf.readString();
else if (tag === 6) obj.infoUrl = pbf.readString();
};
DictionaryInfo.write = function (obj, pbf) {
if (obj.title) pbf.writeStringField(1, obj.title);
if (obj.license) pbf.writeStringField(2, obj.license);
if (obj.release) pbf.writeVarintField(3, obj.release);
if (obj.numberOfEntries) pbf.writeVarintField(4, obj.numberOfEntries);
if (obj.url) pbf.writeStringField(5, obj.url);
if (obj.infoUrl) pbf.writeStringField(6, obj.infoUrl);
if (obj.title) pbf.writeStringField(1, obj.title);
if (obj.license) pbf.writeStringField(2, obj.license);
if (obj.release) pbf.writeVarintField(3, obj.release);
if (obj.numberOfEntries) pbf.writeVarintField(4, obj.numberOfEntries);
if (obj.url) pbf.writeStringField(5, obj.url);
if (obj.infoUrl) pbf.writeStringField(6, obj.infoUrl);
};
// Entry ========================================
var Entry = exports.Entry = {};
var Entry = (exports.Entry = {});
Entry.read = function (pbf, end) {
return pbf.readFields(Entry._readField, {ts: 0, i: 0, p: "", f: "", g: "", e: ""}, end);
return pbf.readFields(
Entry._readField,
{ ts: 0, i: 0, p: "", f: "", g: "", e: "" },
end
);
};
Entry._readField = function (tag, obj, pbf) {
if (tag === 1) obj.ts = pbf.readVarint(true);
else if (tag === 2) obj.i = pbf.readVarint(true);
else if (tag === 3) obj.p = pbf.readString();
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.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();
if (tag === 1) obj.ts = pbf.readVarint(true);
else if (tag === 2) obj.i = pbf.readVarint(true);
else if (tag === 3) obj.p = pbf.readString();
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.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();
else if (tag === 37) obj.a = pbf.readVarint();
};
Entry.write = function (obj, pbf) {
if (obj.ts) pbf.writeVarintField(1, obj.ts);
if (obj.i) pbf.writeVarintField(2, obj.i);
if (obj.p) pbf.writeStringField(3, obj.p);
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.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);
if (obj.ts) pbf.writeVarintField(1, obj.ts);
if (obj.i) pbf.writeVarintField(2, obj.i);
if (obj.p) pbf.writeStringField(3, obj.p);
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.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);
if (obj.a) pbf.writeVarintField(37, obj.a);
};
// Dictionary ========================================
var Dictionary = exports.Dictionary = {};
var Dictionary = (exports.Dictionary = {});
Dictionary.read = function (pbf, end) {
return pbf.readFields(Dictionary._readField, {info: null, entries: []}, end);
return pbf.readFields(
Dictionary._readField,
{ info: null, entries: [] },
end
);
};
Dictionary._readField = function (tag, obj, pbf) {
if (tag === 1) obj.info = DictionaryInfo.read(pbf, pbf.readVarint() + pbf.pos);
else if (tag === 2) obj.entries.push(Entry.read(pbf, pbf.readVarint() + pbf.pos));
if (tag === 1)
obj.info = DictionaryInfo.read(pbf, pbf.readVarint() + pbf.pos);
else if (tag === 2)
obj.entries.push(Entry.read(pbf, pbf.readVarint() + pbf.pos));
};
Dictionary.write = function (obj, pbf) {
if (obj.info) pbf.writeMessage(1, DictionaryInfo.write, obj.info);
if (obj.entries) for (var i = 0; i < obj.entries.length; i++) pbf.writeMessage(2, Entry.write, obj.entries[i]);
if (obj.info) pbf.writeMessage(1, DictionaryInfo.write, obj.info);
if (obj.entries)
for (var i = 0; i < obj.entries.length; i++)
pbf.writeMessage(2, Entry.write, obj.entries[i]);
};

View File

@ -46,6 +46,7 @@ message Entry {
bool diacExcept = 34;
string ec = 35;
string ep = 36;
int32 a = 37;
}
message Dictionary {

View File

@ -1,28 +1,42 @@
import {
writeDictionaryInfo,
readDictionaryInfo,
writeDictionary,
readDictionary,
writeDictionaryInfo,
readDictionaryInfo,
writeDictionary,
readDictionary,
} from "./protobuf";
import * as T from "../../types";
const sampleDictionaryInfo: T.DictionaryInfo = {
title: "Sample Dictionary",
license: "none",
url: "https://www.example.com",
infoUrl: "https://www.example.com",
release: 1,
numberOfEntries: 5,
title: "Sample Dictionary",
license: "none",
url: "https://www.example.com",
infoUrl: "https://www.example.com",
release: 1,
numberOfEntries: 5,
};
const sampleDictionary: T.Dictionary = {
info: sampleDictionaryInfo,
entries: [
{"i":616,"ts":1527813108,"p":"اظهار","f":"izháar","g":"izhaar","e":"expression, statement, declaration","c":"n. m.","ec":"cool"},
],
}
info: sampleDictionaryInfo,
entries: [
{
i: 616,
ts: 1527813108,
p: "اظهار",
f: "izháar",
g: "izhaar",
e: "expression, statement, declaration",
c: "n. m.",
ec: "cool",
a: 1,
},
],
};
test("should encode and decode", () => {
expect(readDictionaryInfo(writeDictionaryInfo(sampleDictionaryInfo) as Uint8Array)).toEqual(sampleDictionaryInfo);
expect(readDictionary(writeDictionary(sampleDictionary) as Uint8Array)).toEqual(sampleDictionary);
});
expect(
readDictionaryInfo(writeDictionaryInfo(sampleDictionaryInfo) as Uint8Array)
).toEqual(sampleDictionaryInfo);
expect(
readDictionary(writeDictionary(sampleDictionary) as Uint8Array)
).toEqual(sampleDictionary);
});

View File

@ -149,6 +149,9 @@ export type DictionaryEntry = {
ec?: string;
/** the English partical of a English phrasal verb - or the english irregular plural of a noun */
ep?: string;
/** If there is a recording [TS NUMBER].mp3 available for this entry, marked true with a 1 */
a?: number;
};
export type DictionaryEntryNoFVars = DictionaryEntry & {