touchup
This commit is contained in:
parent
89261434ee
commit
db77dd81bb
|
@ -10,6 +10,11 @@
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* html, body {
|
||||||
|
font-family: monospace;
|
||||||
|
unicode-range: U+0600-06FF;
|
||||||
|
} */
|
||||||
|
|
||||||
.ais-SearchBox { margin: 1em 0; }
|
.ais-SearchBox { margin: 1em 0; }
|
||||||
|
|
||||||
.table-of-contents {
|
.table-of-contents {
|
||||||
|
|
|
@ -3,20 +3,20 @@ import {
|
||||||
Types as T,
|
Types as T,
|
||||||
renderNPSelection,
|
renderNPSelection,
|
||||||
getEnglishFromRendered,
|
getEnglishFromRendered,
|
||||||
randFromArray,
|
|
||||||
getPashtoFromRendered,
|
getPashtoFromRendered,
|
||||||
renderAPSelection,
|
renderAPSelection,
|
||||||
InlinePs,
|
InlinePs,
|
||||||
defaultTextOptions as opts,
|
defaultTextOptions as opts,
|
||||||
concatPsString,
|
concatPsString,
|
||||||
} from "@lingdocs/ps-react";
|
} from "@lingdocs/ps-react";
|
||||||
import { makeNPAdjGenerator } from "../../lib/np-adj-generator";
|
import { makeNPAdjGenerator } from "../../lib/block-generators/np-adj-generator";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { comparePs } from "../../lib/game-utils";
|
import { comparePs } from "../../lib/game-utils";
|
||||||
import WordCard from "../../components/WordCard";
|
import WordCard from "../../components/WordCard";
|
||||||
|
import { makeSandwich } from "../../lib/block-generators/sandwich-generator";
|
||||||
|
|
||||||
const amount = 15;
|
const amount = 14;
|
||||||
const timeLimit = 230;
|
const timeLimit = 275;
|
||||||
|
|
||||||
type Question = {
|
type Question = {
|
||||||
selection: T.NPSelection | T.APSelection,
|
selection: T.NPSelection | T.APSelection,
|
||||||
|
@ -26,98 +26,18 @@ type Question = {
|
||||||
|
|
||||||
type Level = "hints" | "no-hints" | "sandwiches";
|
type Level = "hints" | "no-hints" | "sandwiches";
|
||||||
|
|
||||||
export const sandwiches: T.Sandwich[] = [
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "له", f: "la" },
|
|
||||||
after: { p: "نه", f: "na" },
|
|
||||||
e: "from",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "له", f: "la" },
|
|
||||||
after: { p: "څخه", f: "tsuxa" },
|
|
||||||
e: "from",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "له", f: "la" },
|
|
||||||
after: { p: "سره", f: "sara" },
|
|
||||||
e: "with",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: undefined,
|
|
||||||
after: { p: "ته", f: "ta" },
|
|
||||||
e: "to",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "د", f: "du" },
|
|
||||||
after: { p: "لپاره", f: "lapaara" },
|
|
||||||
e: "for",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "د", f: "du" },
|
|
||||||
after: { p: "په څانګ", f: "pu tsaang" },
|
|
||||||
e: "beside",
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// type: "sandwich",
|
|
||||||
// before: { p: "په", f: "pu" },
|
|
||||||
// after: { p: "کې", f: "ke" },
|
|
||||||
// e: "in",
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "د", f: "du" },
|
|
||||||
after: { p: "لاندې", f: "laande" },
|
|
||||||
e: "under",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "د", f: "du" },
|
|
||||||
after: { p: "په شان", f: "pu shaan" },
|
|
||||||
e: "like",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "sandwich",
|
|
||||||
before: { p: "د", f: "du" },
|
|
||||||
after: { p: "غوندې", f: "ghwunde" },
|
|
||||||
e: "like",
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// type: "sandwich",
|
|
||||||
// before: { p: "د", f: "du" },
|
|
||||||
// after: { p: "په اړه", f: "pu aRa" },
|
|
||||||
// e: "about",
|
|
||||||
// },
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
// LEVELS
|
|
||||||
// - without plurals
|
|
||||||
// - with inflection category hinting
|
|
||||||
|
|
||||||
const NPAdjWriting: GameSubCore<Level> = ({ inChapter, id, link, level }: {
|
const NPAdjWriting: GameSubCore<Level> = ({ inChapter, id, link, level }: {
|
||||||
inChapter: boolean,
|
inChapter: boolean,
|
||||||
id: string,
|
id: string,
|
||||||
link: string,
|
link: string,
|
||||||
level: Level,
|
level: Level,
|
||||||
}) => {
|
}) => {
|
||||||
const npPool = makeNPAdjGenerator();
|
const npPool = makeNPAdjGenerator(level === "sandwiches" ? "low" : "high");
|
||||||
|
|
||||||
function getQuestion(): Question {
|
function getQuestion(): Question {
|
||||||
const np = npPool();
|
const np = npPool();
|
||||||
const selection: T.NPSelection | T.APSelection = level === "sandwiches"
|
const selection: T.NPSelection | T.APSelection = level === "sandwiches"
|
||||||
? {
|
? makeSandwich(np) : np;
|
||||||
type: "AP",
|
|
||||||
selection: {
|
|
||||||
...randFromArray(sandwiches),
|
|
||||||
inside: np,
|
|
||||||
},
|
|
||||||
} : np;
|
|
||||||
const rendered: T.Rendered<T.NPSelection> | T.Rendered<T.APSelection> = selection.type === "AP"
|
const rendered: T.Rendered<T.NPSelection> | T.Rendered<T.APSelection> = selection.type === "AP"
|
||||||
? renderAPSelection(selection, 0) // WOULD BE CLEANER IF THIS WAS JUST A PURE SANDWICH, NOT AT AP
|
? renderAPSelection(selection, 0) // WOULD BE CLEANER IF THIS WAS JUST A PURE SANDWICH, NOT AT AP
|
||||||
: renderNPSelection(np, false, false, "subject", "none", false);
|
: renderNPSelection(np, false, false, "subject", "none", false);
|
||||||
|
|
|
@ -4,8 +4,8 @@ import {
|
||||||
makeAdjectiveSelection,
|
makeAdjectiveSelection,
|
||||||
randFromArray,
|
randFromArray,
|
||||||
} from "@lingdocs/ps-react";
|
} from "@lingdocs/ps-react";
|
||||||
import { makePool } from "./pool";
|
import { makePool } from "../pool";
|
||||||
import { wordQuery } from "../words/words";
|
import { wordQuery } from "../../words/words";
|
||||||
|
|
||||||
const nouns = wordQuery("nouns", [
|
const nouns = wordQuery("nouns", [
|
||||||
"saRey",
|
"saRey",
|
||||||
|
@ -35,6 +35,7 @@ const nouns = wordQuery("nouns", [
|
||||||
|
|
||||||
const adjectives = wordQuery("adjectives", [
|
const adjectives = wordQuery("adjectives", [
|
||||||
"muR",
|
"muR",
|
||||||
|
"jzwundey",
|
||||||
"sheen",
|
"sheen",
|
||||||
"soor",
|
"soor",
|
||||||
"rixtooney",
|
"rixtooney",
|
||||||
|
@ -50,6 +51,7 @@ const adjectives = wordQuery("adjectives", [
|
||||||
"koochney",
|
"koochney",
|
||||||
"wroostey",
|
"wroostey",
|
||||||
"pradey",
|
"pradey",
|
||||||
|
"treew",
|
||||||
"zoR",
|
"zoR",
|
||||||
"moR",
|
"moR",
|
||||||
"treekh",
|
"treekh",
|
||||||
|
@ -69,9 +71,10 @@ const adjectives = wordQuery("adjectives", [
|
||||||
"kooN",
|
"kooN",
|
||||||
"koG",
|
"koG",
|
||||||
"zeeG",
|
"zeeG",
|
||||||
|
"naast",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function makeNPAdjGenerator(avoidPlurals?: boolean): () => T.NPSelection {
|
export function makeNPAdjGenerator(pluralsLevel: "none" | "low" | "high"): () => T.NPSelection {
|
||||||
const nounPool = makePool(nouns);
|
const nounPool = makePool(nouns);
|
||||||
const adjPool = makePool(adjectives);
|
const adjPool = makePool(adjectives);
|
||||||
|
|
||||||
|
@ -80,8 +83,8 @@ export function makeNPAdjGenerator(avoidPlurals?: boolean): () => T.NPSelection
|
||||||
const selection: T.NounSelection = {
|
const selection: T.NounSelection = {
|
||||||
...ns,
|
...ns,
|
||||||
adjectives: [makeAdjectiveSelection(adjPool())],
|
adjectives: [makeAdjectiveSelection(adjPool())],
|
||||||
...(ns.numberCanChange && !avoidPlurals) ? {
|
...(ns.numberCanChange && pluralsLevel !== "none") ? {
|
||||||
number: randFromArray(["singular", "plural", "plural", "plural", "singular"]),
|
number: randFromArray(pluralsLevel === "high" ? ["singular", "plural", "plural", "plural", "singular"] : ["singular", "plural", "singular"]),
|
||||||
} : {},
|
} : {},
|
||||||
...ns.genderCanChange ? {
|
...ns.genderCanChange ? {
|
||||||
gender: randFromArray(["masc", "fem", "fem", "fem", "masc"]),
|
gender: randFromArray(["masc", "fem", "fem", "fem", "masc"]),
|
|
@ -0,0 +1,83 @@
|
||||||
|
import {
|
||||||
|
Types as T,
|
||||||
|
randFromArray,
|
||||||
|
} from "@lingdocs/ps-react";
|
||||||
|
|
||||||
|
export const sandwiches: T.Sandwich[] = [
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "له", f: "la" },
|
||||||
|
after: { p: "نه", f: "na" },
|
||||||
|
e: "from",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "له", f: "la" },
|
||||||
|
after: { p: "څخه", f: "tsuxa" },
|
||||||
|
e: "from",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "له", f: "la" },
|
||||||
|
after: { p: "سره", f: "sara" },
|
||||||
|
e: "with",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: undefined,
|
||||||
|
after: { p: "ته", f: "ta" },
|
||||||
|
e: "to",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "د", f: "du" },
|
||||||
|
after: { p: "لپاره", f: "lapaara" },
|
||||||
|
e: "for",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "د", f: "du" },
|
||||||
|
after: { p: "په څانګ", f: "pu tsaang" },
|
||||||
|
e: "beside",
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: "sandwich",
|
||||||
|
// before: { p: "په", f: "pu" },
|
||||||
|
// after: { p: "کې", f: "ke" },
|
||||||
|
// e: "in",
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "د", f: "du" },
|
||||||
|
after: { p: "لاندې", f: "laande" },
|
||||||
|
e: "under",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "د", f: "du" },
|
||||||
|
after: { p: "په شان", f: "pu shaan" },
|
||||||
|
e: "like",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "sandwich",
|
||||||
|
before: { p: "د", f: "du" },
|
||||||
|
after: { p: "غوندې", f: "ghwunde" },
|
||||||
|
e: "like",
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: "sandwich",
|
||||||
|
// before: { p: "د", f: "du" },
|
||||||
|
// after: { p: "په اړه", f: "pu aRa" },
|
||||||
|
// e: "about",
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
|
export function makeSandwich(np: T.NPSelection): T.APSelection {
|
||||||
|
return {
|
||||||
|
type: "AP",
|
||||||
|
selection: {
|
||||||
|
...randFromArray(sandwiches),
|
||||||
|
inside: np,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue