From d54b308a88c81e9e52fda96eb9dd3f75187d9c42 Mon Sep 17 00:00:00 2001 From: adueck Date: Wed, 12 Oct 2022 12:06:40 +0500 Subject: [PATCH] validate stat comp verbs --- package-lock.json | 4 ++-- package.json | 2 +- src/components/package.json | 2 +- src/lib/package.json | 2 +- src/lib/src/validate-entry.test.ts | 22 ++++++++++++++++++++++ src/lib/src/validate-entry.ts | 11 +++++++++++ 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9480780..9879aa0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/package.json b/package.json index cc61b54..f0381b1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/package.json b/src/components/package.json index f29326b..b7b8760 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -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", diff --git a/src/lib/package.json b/src/lib/package.json index 19a8f3b..67a283f 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -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", diff --git a/src/lib/src/validate-entry.test.ts b/src/lib/src/validate-entry.test.ts index d31c1c3..9dee79d 100644 --- a/src/lib/src/validate-entry.test.ts +++ b/src/lib/src/validate-entry.test.ts @@ -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 }, diff --git a/src/lib/src/validate-entry.ts b/src/lib/src/validate-entry.ts index 08084ea..c640263 100644 --- a/src/lib/src/validate-entry.ts +++ b/src/lib/src/validate-entry.ts @@ -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 }; }