validate stat comp verbs

This commit is contained in:
adueck 2022-10-12 12:06:40 +05:00
parent 61332241d4
commit d54b308a88
6 changed files with 38 additions and 5 deletions

4
package-lock.json generated
View File

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

View File

@ -1,6 +1,6 @@
{
"name": "pashto-inflector",
"version": "5.1.2",
"version": "5.1.3",
"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.2",
"version": "5.1.3",
"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.2",
"version": "5.1.3",
"description": "Pashto inflector library",
"main": "dist/index.js",
"types": "dist/lib/library.d.ts",

View File

@ -149,6 +149,28 @@ const toTest: {
erroneousFields: ["p", "f"],
},
},
{
input: {"ts":1591033069786,"i":7717,"p":"ستړی کول","f":"stuRey kawul","g":"stuReykedul","e":"to get tired, fatigued","c":"v. stat. comp. intrans.","l":1527815306,"ec":"get","ep":"tired"},
output: {
errors: ["wrong ending for intrans. stat. comp"],
p: "ستړی کول",
f: "stuRey kawul",
e: "to get tired, fatigued",
ts: 1591033069786,
erroneousFields: ["p", "f"],
},
},
{
input: {"ts":1591033078746,"i":7716,"p":"ستړی کېدل","f":"stuRey kedul","g":"stuReykawul","e":"to make tired, wear out","c":"v. stat. comp. trans.","l":1527815306,"ec":"make","ep":"tired"},
output: {
errors: ["wrong ending for trans. stat. comp"],
p: "ستړی کېدل",
f: "stuRey kedul",
e: "to make tired, wear out",
ts: 1591033078746,
erroneousFields: ["p", "f"],
},
},
{
input: {"i":12,"ts":1575058859661,"p":"آبدار","f":"aawdáar","e":"watery, damp, humid, juicy","c":"adj.","diacExcept":true},
output: { ok: true },

View File

@ -98,6 +98,16 @@ export function validateEntry(entry: T.DictionaryEntry): T.DictionaryEntryError
errors.push("missing complement for compound verb");
erroneousFields.add("l");
}
if (entry.c && entry.c.includes("stat. comp. intrans.") && !entry.p.endsWith("ېدل")) {
errors.push("wrong ending for intrans. stat. comp");
erroneousFields.add("p");
erroneousFields.add("f");
}
if (entry.c && entry.c.includes("stat. comp. trans.") && !entry.p.endsWith("ول")) {
errors.push("wrong ending for trans. stat. comp");
erroneousFields.add("p");
erroneousFields.add("f");
}
if (errors.length) {
return {
errors,
@ -108,6 +118,7 @@ export function validateEntry(entry: T.DictionaryEntry): T.DictionaryEntryError
erroneousFields: Array.from(erroneousFields),
};
}
if (entry.c && entry.c.slice(0, 2) === "v." && entry.c.includes("comp.") && entry.l) {
return { checkComplement: true };
}