add a filed to entries for audio
This commit is contained in:
parent
ef120b13aa
commit
17fd8a4d05
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "pashto-inflector",
|
"name": "pashto-inflector",
|
||||||
"version": "6.0.12",
|
"version": "7.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pashto-inflector",
|
"name": "pashto-inflector",
|
||||||
"version": "6.0.12",
|
"version": "7.0.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "pashto-inflector",
|
"name": "pashto-inflector",
|
||||||
"version": "6.0.12",
|
"version": "7.0.0",
|
||||||
"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",
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/ps-react",
|
"name": "@lingdocs/ps-react",
|
||||||
"version": "6.0.12",
|
"version": "7.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lingdocs/ps-react",
|
"name": "@lingdocs/ps-react",
|
||||||
"version": "6.0.12",
|
"version": "7.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@formkit/auto-animate": "^1.0.0-beta.3",
|
"@formkit/auto-animate": "^1.0.0-beta.3",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/ps-react",
|
"name": "@lingdocs/ps-react",
|
||||||
"version": "6.0.12",
|
"version": "7.0.0",
|
||||||
"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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/inflect",
|
"name": "@lingdocs/inflect",
|
||||||
"version": "6.0.12",
|
"version": "7.0.0",
|
||||||
"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",
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
'use strict'; // code generated by pbf v3.2.1
|
"use strict"; // code generated by pbf v3.2.1
|
||||||
|
|
||||||
// DictionaryInfo ========================================
|
// DictionaryInfo ========================================
|
||||||
|
|
||||||
var DictionaryInfo = exports.DictionaryInfo = {};
|
var DictionaryInfo = (exports.DictionaryInfo = {});
|
||||||
|
|
||||||
DictionaryInfo.read = function (pbf, end) {
|
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) {
|
DictionaryInfo._readField = function (tag, obj, pbf) {
|
||||||
if (tag === 1) obj.title = pbf.readString();
|
if (tag === 1) obj.title = pbf.readString();
|
||||||
|
@ -27,10 +38,14 @@ DictionaryInfo.write = function (obj, pbf) {
|
||||||
|
|
||||||
// Entry ========================================
|
// Entry ========================================
|
||||||
|
|
||||||
var Entry = exports.Entry = {};
|
var Entry = (exports.Entry = {});
|
||||||
|
|
||||||
Entry.read = function (pbf, end) {
|
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) {
|
Entry._readField = function (tag, obj, pbf) {
|
||||||
if (tag === 1) obj.ts = pbf.readVarint(true);
|
if (tag === 1) obj.ts = pbf.readVarint(true);
|
||||||
|
@ -69,6 +84,7 @@ Entry._readField = function (tag, obj, pbf) {
|
||||||
else if (tag === 34) obj.diacExcept = pbf.readBoolean();
|
else if (tag === 34) obj.diacExcept = pbf.readBoolean();
|
||||||
else if (tag === 35) obj.ec = pbf.readString();
|
else if (tag === 35) obj.ec = pbf.readString();
|
||||||
else if (tag === 36) obj.ep = pbf.readString();
|
else if (tag === 36) obj.ep = pbf.readString();
|
||||||
|
else if (tag === 37) obj.a = pbf.readVarint();
|
||||||
};
|
};
|
||||||
Entry.write = function (obj, pbf) {
|
Entry.write = function (obj, pbf) {
|
||||||
if (obj.ts) pbf.writeVarintField(1, obj.ts);
|
if (obj.ts) pbf.writeVarintField(1, obj.ts);
|
||||||
|
@ -107,20 +123,29 @@ Entry.write = function (obj, pbf) {
|
||||||
if (obj.diacExcept) pbf.writeBooleanField(34, obj.diacExcept);
|
if (obj.diacExcept) pbf.writeBooleanField(34, obj.diacExcept);
|
||||||
if (obj.ec) pbf.writeStringField(35, obj.ec);
|
if (obj.ec) pbf.writeStringField(35, obj.ec);
|
||||||
if (obj.ep) pbf.writeStringField(36, obj.ep);
|
if (obj.ep) pbf.writeStringField(36, obj.ep);
|
||||||
|
if (obj.a) pbf.writeVarintField(37, obj.a);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Dictionary ========================================
|
// Dictionary ========================================
|
||||||
|
|
||||||
var Dictionary = exports.Dictionary = {};
|
var Dictionary = (exports.Dictionary = {});
|
||||||
|
|
||||||
Dictionary.read = function (pbf, end) {
|
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) {
|
Dictionary._readField = function (tag, obj, pbf) {
|
||||||
if (tag === 1) obj.info = DictionaryInfo.read(pbf, pbf.readVarint() + pbf.pos);
|
if (tag === 1)
|
||||||
else if (tag === 2) obj.entries.push(Entry.read(pbf, pbf.readVarint() + pbf.pos));
|
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) {
|
Dictionary.write = function (obj, pbf) {
|
||||||
if (obj.info) pbf.writeMessage(1, DictionaryInfo.write, obj.info);
|
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.entries)
|
||||||
|
for (var i = 0; i < obj.entries.length; i++)
|
||||||
|
pbf.writeMessage(2, Entry.write, obj.entries[i]);
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,6 +46,7 @@ message Entry {
|
||||||
bool diacExcept = 34;
|
bool diacExcept = 34;
|
||||||
string ec = 35;
|
string ec = 35;
|
||||||
string ep = 36;
|
string ep = 36;
|
||||||
|
int32 a = 37;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Dictionary {
|
message Dictionary {
|
||||||
|
|
|
@ -18,11 +18,25 @@ const sampleDictionaryInfo: T.DictionaryInfo = {
|
||||||
const sampleDictionary: T.Dictionary = {
|
const sampleDictionary: T.Dictionary = {
|
||||||
info: sampleDictionaryInfo,
|
info: sampleDictionaryInfo,
|
||||||
entries: [
|
entries: [
|
||||||
{"i":616,"ts":1527813108,"p":"اظهار","f":"izháar","g":"izhaar","e":"expression, statement, declaration","c":"n. m.","ec":"cool"},
|
{
|
||||||
|
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", () => {
|
test("should encode and decode", () => {
|
||||||
expect(readDictionaryInfo(writeDictionaryInfo(sampleDictionaryInfo) as Uint8Array)).toEqual(sampleDictionaryInfo);
|
expect(
|
||||||
expect(readDictionary(writeDictionary(sampleDictionary) as Uint8Array)).toEqual(sampleDictionary);
|
readDictionaryInfo(writeDictionaryInfo(sampleDictionaryInfo) as Uint8Array)
|
||||||
|
).toEqual(sampleDictionaryInfo);
|
||||||
|
expect(
|
||||||
|
readDictionary(writeDictionary(sampleDictionary) as Uint8Array)
|
||||||
|
).toEqual(sampleDictionary);
|
||||||
});
|
});
|
|
@ -149,6 +149,9 @@ export type DictionaryEntry = {
|
||||||
ec?: string;
|
ec?: string;
|
||||||
/** the English partical of a English phrasal verb - or the english irregular plural of a noun */
|
/** the English partical of a English phrasal verb - or the english irregular plural of a noun */
|
||||||
ep?: string;
|
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 & {
|
export type DictionaryEntryNoFVars = DictionaryEntry & {
|
||||||
|
|
Loading…
Reference in New Issue