This commit is contained in:
adueck 2024-02-08 23:07:29 +01:00
parent 221249271c
commit ae4ff6f27b
2 changed files with 23 additions and 14 deletions

View File

@ -11,7 +11,7 @@ const working = [
"phrases with simple verbs",
"basic verb tenses",
"noun phrases",
"mini-pronouns for shrunken servants",
"mini-pronouns",
"grammar error correction",
"negatives",
"imperative verbs",
@ -21,14 +21,12 @@ const working = [
const todo = [
"compound verbs",
"adjectival participles",
"adverbial phrases",
"relative clauses",
"equative verbs",
"ability verbs",
"passive verbs",
"quantifiers",
"demonstrative pronouns",
"mini-pronouns for possesives",
"approximate spelling",
];
@ -38,7 +36,7 @@ const examples = [
"یو به مې ړلې",
"د غټې ماشومې زاړه پلار ولیدم",
"ستا پخواني ملګري مې ولیدل",
"پرون مې ولیدې",
"پرون مې دې ملګرې ولیده",
"ما ډوډۍ خوړله",
"وامې نه خیست",
"وبه مې وینې",

View File

@ -47,9 +47,8 @@ export function parseVP(
return [];
}
const blocks = parseBlocks(tokens, lookup, [], []);
const blocksWPossPossibilities = createPossesivePossibilities(blocks);
return bindParseResult(
blocksWPossPossibilities,
createPossesivePossibilities(blocks),
(tokens, { blocks, kids }) => {
const ba = kids.some((k) => k === "ba");
const miniPronouns = getMiniPronouns(kids);
@ -1055,6 +1054,26 @@ function mapOutnpsAndAps(
});
}
/**
* Given a set of blocks and kids, produces all possible arrangements
* with the mini-pronouns being used as possesives, or not
*
* Case 1: no mini pronouns
* 1. return as is
*
* Case 2: one mini pronoun
* 1. don't use any as possesive
* 2. use the mini pronoun as a possesive (in all possible places)
*
* Case 3: two mini pronouns
* 1. don't use any as possesive
* 2. use first as possesive
* 3. use second as possesive
* 4. use both as possesives
*
* @param blocks
* @returns
*/
function createPossesivePossibilities(
blocks: T.ParseResult<{
kids: T.ParsedKid[];
@ -1064,14 +1083,6 @@ function createPossesivePossibilities(
kids: T.ParsedKid[];
blocks: T.ParsedBlock[];
}>[] {
// Case 1: no mini pronouns
// Case 2: 1 mini pronoun
// - don't use any as possesive
// Case 3: 2 mini pronouns
// - don't use any as possesive
// - use first as possesive
// - use second as possesive
// - use both as possesive
function pullOutMiniPronoun(
body: {
kids: T.ParsedKid[];