+ {question.phrase.e &&
{question.phrase.e.map(x =>
{x}
)}
@@ -248,33 +251,40 @@ function makeCorrectAnswer(question: Question): JSX.Element {
{verbHasBa(question.rendered) ? "with" : "without"} a {grammarUnits.baParticle} in the kids' section.
;
}
-function modExs(exs: T.PsString[], withBa: boolean): { p: JSX.Element, f: JSX.Element }[] {
- return exs.map(ps => {
- if (!ps.p.includes(" ___ ")) {
- return {
- p: <>{ps.p}>,
- f: <>{ps.f}>,
- };
- }
- const splitP = ps.p.split(" ___ ");
- const splitF = ps.f.split(" ___ ");
- return {
- p: <>{splitP[0]}
{withBa ? "به" : "__"} {splitP[1]}>,
- f: <>{splitF[0]}
{withBa ? "ba" : "__"} {splitF[1]}>,
- };
- });
-}
+// function modExs(exs: T.PsString[], withBa: boolean): { p: JSX.Element, f: JSX.Element }[] {
+// return exs.map(ps => {
+// if (!ps.p.includes(" ___ ")) {
+// return {
+// p: <>{ps.p}>,
+// f: <>{ps.f}>,
+// };
+// }
+// const splitP = ps.p.split(" ___ ");
+// const splitF = ps.f.split(" ___ ");
+// return {
+// p: <>{splitP[0]}
{withBa ? "به" : "__"} {splitP[1]}>,
+// f: <>{splitF[0]}
{withBa ? "ba" : "__"} {splitF[1]}>,
+// };
+// });
+// }
-function humanReadableTense(tense: T.EquativeTense | "allProduce"): string {
- return tense === "allProduce"
- ? ""
- : tense === "pastSubjunctive"
- ? "past subjunctive"
- : tense === "wouldBe"
- ? `"would be"`
- : tense === "wouldHaveBeen"
- ? `"would have been"`
- : tense;
+
+function humanReadableVerbTense(tense: T.VerbTense): string {
+ return tense === "presentVerb"
+ ? "present"
+ : tense === "subjunctiveVerb"
+ ? "subjunctive"
+ : tense === "imperfectiveFuture"
+ ? "imperfective future"
+ : tense === "perfectiveFuture"
+ ? "perfective future"
+ : tense === "perfectivePast"
+ ? "simple past"
+ : tense === "imperfectivePast"
+ ? "continuous past"
+ : tense === "habitualImperfectivePast"
+ ? "habitual simple past"
+ : "habitual continuous past";
}
function makeVPS({ verb, subject, object, tense }: {
@@ -284,13 +294,17 @@ function makeVPS({ verb, subject, object, tense }: {
tense: T.VerbTense,
}): T.VPSelectionComplete {
const vps = makeVPSelectionState(verb);
+ const transitivity = (vps.verb.transitivity === "transitive" && vps.verb.canChangeTransitivity)
+ ? "grammatically transitive"
+ : vps.verb.transitivity;
return {
...vps,
verb: {
...vps.verb,
+ transitivity,
tense,
},
- blocks: [
+ blocks: maybeShuffleArray([
{
key: Math.random(),
block: {
@@ -302,10 +316,14 @@ function makeVPS({ verb, subject, object, tense }: {
key: Math.random(),
block: {
type: "objectSelection",
- selection: object,
+ selection: transitivity === "intransitive"
+ ? "none"
+ : transitivity === "grammatically transitive"
+ ? T.Person.ThirdPlurMale
+ : object,
},
},
- ],
+ ]),
};
}
diff --git a/src/lib/shuffle-array.ts b/src/lib/shuffle-array.ts
index 9d19bcf..b78e6bd 100644
--- a/src/lib/shuffle-array.ts
+++ b/src/lib/shuffle-array.ts
@@ -1,5 +1,7 @@
// https://stackoverflow.com/a/2450976
+import { randFromArray } from "@lingdocs/pashto-inflector";
+
function shuffleArray
(arr: Readonly>): Array {
let currentIndex = arr.length, temporaryValue, randomIndex;
@@ -21,4 +23,12 @@ function shuffleArray(arr: Readonly>): Array {
return array;
}
+export function maybeShuffleArray(arr: Array): Array {
+ const shuffle = randFromArray([true, false, true, false, false]);
+ if (shuffle) {
+ return shuffleArray(arr);
+ }
+ return arr;
+}
+
export default shuffleArray;
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 1148a6e..0f8b6d9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1803,10 +1803,10 @@
rambda "^6.7.0"
react-select "^5.2.2"
-"@lingdocs/pashto-inflector@^3.7.5":
- version "3.7.5"
- resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.7.5.tgz#6421b88ccf544cdbc7f4cefc66ff75b3b7f1bb44"
- integrity sha512-36ULd7ETZBz9/gs2K1s2XJFzEA3kDZfR9rPPN6B5oJvW9yAZXfgaJg9W2jzhodfu2WS3lpQvizis8zQjPioV8w==
+"@lingdocs/pashto-inflector@^3.7.9":
+ version "3.7.9"
+ resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.7.9.tgz#a1dc7b6635d9415d8dddfee9a09bb5b95190d7f0"
+ integrity sha512-2LKY5TRUs9h7nE9gQaUUiNV0eLOh5Tr4eJtYp2RGaxeMZhOZhVbbiXc+FV2BPe9bOEpYK3hy678RLBIx0C18nQ==
dependencies:
"@formkit/auto-animate" "^1.0.0-beta.1"
classnames "^2.2.6"