added negative to imperative verbs quiz

This commit is contained in:
lingdocs 2022-09-12 18:07:22 +04:00
parent a606bbb7d7
commit ce7c477218
3 changed files with 23 additions and 10 deletions

View File

@ -7,7 +7,7 @@
"@formkit/auto-animate": "^1.0.0-beta.1", "@formkit/auto-animate": "^1.0.0-beta.1",
"@fortawesome/fontawesome-free": "^5.15.4", "@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.3.3", "@lingdocs/lingdocs-main": "^0.3.3",
"@lingdocs/pashto-inflector": "^3.8.9", "@lingdocs/pashto-inflector": "^3.9.0",
"@testing-library/jest-dom": "^5.11.4", "@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10", "@testing-library/user-event": "^12.1.10",

View File

@ -35,6 +35,7 @@ import { baParticle } from "@lingdocs/pashto-inflector/dist/lib/grammar-units";
import { intransitivePastVerbs } from "../../content/verbs/basic-present-verbs"; import { intransitivePastVerbs } from "../../content/verbs/basic-present-verbs";
import { makePool } from "../../lib/pool"; import { makePool } from "../../lib/pool";
import { wordQuery } from "../../words/words"; import { wordQuery } from "../../words/words";
import { isImperativeTense } from "@lingdocs/pashto-inflector/dist/lib/type-predicates";
const kidsColor = "#017BFE"; const kidsColor = "#017BFE";
@ -198,7 +199,7 @@ const VerbGame: GameSubCore<VerbGameLevel> = ({ id, link, level, inChapter }: {
VP, VP,
{ removeKing: false, shrinkServant: false }, { removeKing: false, shrinkServant: false },
true, true,
{ ba: true, verb: true }, { ba: true, verb: true, negative: true },
); );
const phrase = { const phrase = {
ps: compiled.ps, ps: compiled.ps,
@ -329,7 +330,9 @@ function QuestionDisplay({ question, userAnswer }: {
{x} {x}
</div>)} </div>)}
</div>} </div>}
<div>{humanReadableVerbForm(v.block.tense)}</div> <div>{(isImperativeTense(v.block.tense) && v.block.negative)
? "Negative Imperative"
: humanReadableVerbForm(v.block.tense)}</div>
</div>; </div>;
} }
@ -451,6 +454,9 @@ function makeVPS({ verb, king, servant, tense, defaultTransitivity }: {
...vps, ...vps,
verb: { verb: {
...vps.verb, ...vps.verb,
negative: isImperativeTense(tense)
? randFromArray([false, false, true])
: false,
transitivity, transitivity,
tense, tense,
}, },
@ -479,10 +485,17 @@ function makeVPS({ verb, king, servant, tense, defaultTransitivity }: {
function getVerbPs({ blocks }: T.VPRendered): T.PsString[] { function getVerbPs({ blocks }: T.VPRendered): T.PsString[] {
const { perfectiveHead, verb } = blockUtils.getVerbAndHeadFromBlocks(blocks); const { perfectiveHead, verb } = blockUtils.getVerbAndHeadFromBlocks(blocks);
if (!perfectiveHead) { const mU = blocks[0].find(b => b.block.type === "negative" && b.block.imperative);
return flattenLengths(verb.block.ps); function vBase() {
if (!perfectiveHead) {
return flattenLengths(verb.block.ps);
}
return flattenLengths(verb.block.ps).map(r => concatPsString(perfectiveHead.ps, r));
} }
return flattenLengths(verb.block.ps).map(r => concatPsString(perfectiveHead.ps, r)); if (mU) {
return vBase().map(b => concatPsString({ p: "مه", f: "mÚ" }, " ", b));
}
return vBase();
} }
function verbHasBa({ blocks }: T.VPRendered): boolean { function verbHasBa({ blocks }: T.VPRendered): boolean {

View File

@ -1804,10 +1804,10 @@
rambda "^6.7.0" rambda "^6.7.0"
react-select "^5.2.2" react-select "^5.2.2"
"@lingdocs/pashto-inflector@^3.8.9": "@lingdocs/pashto-inflector@^3.9.0":
version "3.8.9" version "3.9.0"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.8.9.tgz#c023449dc13dbc32ef95cef172a68b5b0b4659bf" resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.9.0.tgz#abcea34db1d7031e7915c1bc6281b88df6c8ca2b"
integrity sha512-60hAao+ADerI5hOMeJzYmrSCliwTqCndbUlx1Ke58s2FikxDqUb9/wb700JVbhsVLyRdr6tGg+YslDf4irr5tA== integrity sha512-6KARwTVmt/qJaOrvIbQlQhIfseB0sM9HrfWGpkRUQZK4eGmo6Qpnne8PBJQe1CQZCuAKgDjpwDHz3CssFIOegA==
dependencies: dependencies:
"@formkit/auto-animate" "^1.0.0-beta.1" "@formkit/auto-animate" "^1.0.0-beta.1"
classnames "^2.2.6" classnames "^2.2.6"