seperated habitual and subjunctive equatives

This commit is contained in:
lingdocs 2022-02-17 15:53:54 +04:00
parent be90289c07
commit 55b7a1ce0e
9 changed files with 6776 additions and 97 deletions

View File

@ -5,7 +5,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.2.0",
"@lingdocs/pashto-inflector": "^1.4.4",
"@lingdocs/pashto-inflector": "^1.5.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",

View File

@ -3,16 +3,88 @@ const fetch = require("node-fetch");
const path = require("path");
const { readDictionary } = require("@lingdocs/pashto-inflector");
const verbsPath = path.join(".", "src", "words");
const pChars = [
"آ",
'ځ',
'څ',
'ښ',
'ئ',
'ي',
'پ',
'ټ',
'ڼ',
'ظ',
'ط',
'ژ',
'ډ',
'ض',
'ص',
'ث',
'ق',
'ف',
'غ',
'ع',
'ه',
'خ',
'ح',
'ج',
'چ',
'ش',
'س',
'ی',
'ب',
'ل',
'ا',
'ت',
'ن',
'م',
'ک',
'ګ',
'ۍ',
'ې',
'ز',
'ر',
'ذ',
'د',
'ړ',
'و',
'ږ',
];
fetch(process.env.LINGDOCS_DICTIONARY_URL).then(res => res.arrayBuffer()).then(data => {
const { entries } = readDictionary(data);
const filtered = entries.filter(e => (
e.c?.includes("loc. adv.")
));
const content = `module.exports = [
${filtered.reduce((text, entry) => (
text + `{ ts: ${entry.ts}, e: \`${entry.e.replace(/"/g, '\\"')}\` }, // ${entry.p} - ${entry.f}
`), "")}
const filtered = shuffle(entries.filter(e => (
e.p.length === 5 && e.p.split("").every((char) => pChars.includes(char))
)));
// const content = `module.exports = [
// ${filtered.reduce((text, entry) => (
// text + `{ ts: ${entry.ts}, e: \`${entry.e.replace(/"/g, '\\"')}\` }, // ${entry.p} - ${entry.f}
// `), "")}
// ];`;
const content = `export const WORDS = [
${filtered.map((entry) => (entry.p.replace("آ", "ا"))).reduce((text, p) => (
text + `"${p}",\n`
), "")}
];`;
fs.writeFileSync(path.join(verbsPath, "query-results.js"), content);
fs.writeFileSync(path.join(verbsPath, "wordle-words.ts"), content);
});
function shuffle(array) {
let currentIndex = array.length, randomIndex;
// While there remain elements to shuffle...
while (currentIndex != 0) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;
// And swap it with the current element.
[array[currentIndex], array[randomIndex]] = [
array[randomIndex], array[currentIndex]];
}
return array;
}

View File

@ -1,5 +1,5 @@
---
title: Subjunctive / Habitual Equative
title: Habitual Equative
---
import {
@ -17,16 +17,16 @@ import Link from "../../components/Link";
export const opts = defaultTextOptions;
import grassBeWet from "../../images/grass-be-wet.jpg";
In the last section we looked at the present equative, which we use to say something *is* something currently. But **we can only use the present equative for something is something *right now, at this moment***. What if we want to say that something *generally is something* or if we *hope something is something*? For that **we need to use a different form**.
In the last section we looked at the <Link to="/equatives/present-equative/">present equative</Link>, which we use to say something *is* something currently. But **we can only use the <Link to="/equatives/present-equative/">present equative</Link> for something is something *right now, at this moment***. What if we want to say that something *generally is something*?
## Subjunctive / Habitual Equative Form
## Habitual Equative Form
<EquativeFormChoice
forms={{
sentence: {
displayForm: addToForm(
[grammarUnits.pronouns.far.plain, " ", { p: "...", f: "..." }, " "],
grammarUnits.equativeEndings.subjunctive,
grammarUnits.equativeEndings.habitual,
),
english: [
["I am ...", "We are ..."],
@ -38,90 +38,20 @@ In the last section we looked at the present equative, which we use to say somet
],
},
pure: {
displayForm: grammarUnits.equativeEndings.subjunctive,
displayForm: grammarUnits.equativeEndings.habitual,
},
}}
opts={opts}
/>
This form is used with two different meanings:
This form is used to say that something is something (A = B) **generally, habitually, or repeatedly**.
1. **Subjunctive** - to talk about something being something when the statement involves a hypothetical condition, a wish, desire, hope, or statement of whether it should or shouldn't be, as in:
<Examples opts={opts}>{[
psmd({
p: "امید لرم چې خوشحاله **وي**",
f: "Umeed larum che khosháala **wee**",
e: "I hope he **is** happy",
}),
]}</Examples>
2. **Habitual** - to say that something is generally or repeatedly something, as in:
<Examples opts={opts}>{[
psmd({
<Examples opts={opts}>{psmd([
{
p: "سحار کې چمن لوند **وي**",
f: "saháar ke chaman loond **wee**",
e: "The grass **is** wet in the morning. (generally, habitually)",
}),
]}</Examples>
### With a Subjunctive Meaning
#### Judgement/obligation
The subjunctive form can be used to talk about it being being good or bad, necessary, or required that something is something.
<Examples opts={opts}>{psmd([
{
p: "ښه ده چې دلته **یې**",
f: "xa da che dălta **ye**.",
e: "It's good that you're here.",
},
{
p: "هغوي باید په ښووونځي کې **وي**",
f: "hagwee baayad pu xowoondzee ke **wee**.",
e: "They have to be in school.",
},
])}</Examples>
#### Desire
<Examples opts={opts}>{psmd([
{
p: "امید لرم چې هلته **وي**",
f: "Umeed larum che halta **wee**.",
e: "I hope they're there.",
},
{
p: "هغه غواړي چې مونږ په کور کې **یو**",
f: "haghá ghwaaRee che moonG pu kor ke **yoo**.",
e: "He wants us to be home.",
},
])}</Examples>
#### Conditions
The subjunctive form is also used to talk about conditions or possibilities. *If A = B, then...* or *It could be that A = B ...*
<Examples opts={opts}>{psmd([
{
p: "که دوکان کې وریژې **وي** نو وایې خله",
f: "ku dokaan ke wrejze **wee**, no waa-ye-khla",
e: "If there's rice in the store, buy it",
},
{
p: "کېدی شي چې ډوډۍ تیاره **وي**",
f: "kedey shee che DoDúy tayaara **wee**",
e: "The food could be ready",
},
])}</Examples>
### With a Habitual Meaning
This same form is used when you are saying that **A = B generally, habitually, or repeatedly**. For example:
<Examples opts={opts}>{psmd([
{
p: "هغه تر ماښامه پورې په دوکان کې **وي**",
f: "haghá tur maaxaama pore pu dookáan ke **wee**",

View File

@ -28,6 +28,116 @@ import EquativeFormChoice from "../../components/EquativeFormChoice";
import Formula from "../../components/formula/Formula";
import Link from "../../components/Link";
## Subjunctive Equative
The subjunctive equative is used to talk about something being something when the statement involves a hypothetical condition, a wish, desire, hope, or statement of whether it should or shouldn't be, as in:
<Examples opts={opts}>{[
psmd({
p: "امید لرم چې خوشحاله **وي**",
f: "Umeed larum che khosháala **wee**",
e: "I hope he **is** happy",
}),
]}</Examples>
<EquativeFormChoice
forms={{
sentence: {
displayForm: addToForm(
[grammarUnits.pronouns.far.plain, " ", { p: "...", f: "..." }, " "],
grammarUnits.equativeEndings.subjunctive,
),
english: [
["I am ...", "We are ..."],
["I am ...", "We are ..."],
["You are ...", "You are ..."],
["You are ...", "You are ..."],
["He/she/it is ...", "They are ..."],
["He/she/it is ...", "They are ..."],
],
},
pure: {
displayForm: grammarUnits.equativeEndings.subjunctive,
},
}}
opts={opts}
/>
#### Purpose
The subjunctive is used in clauses that express a purpose or an aim of something being something.
<Examples opts={opts}>{psmd([
{
p: "زه به درته سندره وایم، چې ته خوشحاله **وې**",
f: "zu ba taa ta sandura waayum, che tu khoshaala **we**.",
e: "I'll sing to you, so that you'll **be** happy.",
},
])}</Examples>
#### Judgement/obligation
The subjunctive form can be used to talk about it being being good or bad, necessary, or required that something is something.
<Examples opts={opts}>{psmd([
{
p: "هغوي باید په ښووونځي کې **وي**",
f: "hagwee baayad pu xowoondzee ke **wee**.",
e: "They have to be in school.",
},
])}</Examples>
#### Desire
<Examples opts={opts}>{psmd([
{
p: "امید لرم چې هلته **وي**",
f: "Umeed larum che halta **wee**.",
e: "I hope they're there.",
},
{
p: "هغه غواړي چې مونږ په کور کې **وو**",
f: "haghá ghwaaRee che moonG pu kor ke **woo**.",
e: "He wants us to be home.",
},
])}</Examples>
#### Conditions
The subjunctive form is also used to talk about conditions or possibilities. *If A = B, then...* or *It could be that A = B ...*
<Examples opts={opts}>{psmd([
{
p: "که دوکان کې وریژې **وي** نو وایې خله",
f: "ku dokaan ke wrejze **wee**, no waa-ye-khla",
e: "If there's rice in the store, buy it",
},
{
p: "کېدی شي چې ډوډۍ تیاره **وي**",
f: "kedey shee che DoDúy tayaara **wee**",
e: "The food could be ready",
},
])}</Examples>
#### Important Note on Common Use:
This is the standard/written form of the subjunctive equative. However in many dialects you will find that people use the same forms as the <Link to="/equative/habitual-equative">habitual equative</Link> when speaking. For example:
<Examples opts={opts}>{psmd([
{
p: "هغه غواړي چې مونږ په کور کې **وو**",
f: "haghá ghwaaRee che moonG pu kor ke **woo**.",
e: "He wants us to be home.",
sub: "proper / standard",
},
{
p: "هغه غواړي چې مونږ په کور کې **یو**",
f: "haghá ghwaaRee che moonG pu kor ke **yoo**.",
e: "He wants us to be home.",
sub: "often spoken / colloquial",
},
])}</Examples>
## Future Equative
This is used for:
@ -36,7 +146,7 @@ This is used for:
2. To guess or surmise about something being something (now or in the future). ("I'll be...")
<Formula>
<InlinePs opts={opts} ps={grammarUnits.baParticle} /> + <Link to="/equatives/subjunctive-habitual-equative/">subjunctive/habitual equative</Link>
<InlinePs opts={opts} ps={grammarUnits.baParticle} /> + <Link to="/equatives/habitual-equative/">habitual equative</Link>
</Formula>
<EquativeFormChoice

View File

@ -11,9 +11,9 @@
import * as intro from "!babel-loader!@lingdocs/mdx-loader!./intro.mdx";
// @ts-ignore
import * as presentEquative from "!babel-loader!@lingdocs/mdx-loader!./equatives/present-equative.mdx"
import * as presentEquative from "!babel-loader!@lingdocs/mdx-loader!./equatives/present-equative.mdx";
// @ts-ignore
import * as subjunctiveHabitualEquative from "!babel-loader!@lingdocs/mdx-loader!./equatives/subjunctive-habitual-equative.mdx";
import * as habitualEquative from "!babel-loader!@lingdocs/mdx-loader!./equatives/habitual-equative.mdx";
// @ts-ignore
import * as otherEquatives from "!babel-loader!@lingdocs/mdx-loader!./equatives/other-equatives.mdx";
// @ts-ignore
@ -95,8 +95,8 @@ const contentTree = [
slug: "present-equative",
},
{
import: subjunctiveHabitualEquative,
slug: "subjunctive-habitual-equative",
import: habitualEquative,
slug: "habitual-equative",
},
{
import: otherEquatives,

63
src/gen-g.d.ts vendored Normal file
View File

@ -0,0 +1,63 @@
// type MascSingNounEntry = ""; // can change number only
// type FemSingNounEntry = ""; // can change nuber only
// type MascPlurNounEntry = ""; // can change nothing
// type FemPlurNounEntry = ""; // can change nothing
// type UnisexNounEntry = ""; // can change number or gender
type NPSelection = NounSelection | PronounSelection | ParticipleSelection;
// TODO require/import Person and PsString
type NounSelection = {
type: "noun",
ps: string,
// BETTER TO USE (or keep handy) FULL ENTRY FOR USE WITH INFLECTING
e: {
sing: string,
plur: string,
} | undefined,
gender: "masc" | "fem",
number: "sing" | "plur",
// TODO: Implement
// adjectives: [],
// TODO: Implement
// possesor: NPSelection | undefined,
/* method only present if it's possible to change gender */
changeGender?: (gender: "masc" | "fem") => NounWord,
/* method only present if it's possible to change number */
changeNumber?: (number: "sing" | "plur") => NounWord,
};
// take an argument for subject/object in rendering English
type PronounSelection = {
type: "pronoun",
e: string,
person: Person,
distance: "near" | "far",
changeDistance: (distance: "near" | "far") => PronounSelection,
};
type ParticipleSelection = {
type: "participle",
ps: string,
e: string | undefined,
// entry in here
}
// not object
// type Primitive = string | Function | number | boolean | Symbol | undefined | null;
// If T has key K ("user"), replace it
type ReplaceKey<T, K extends string, R> = T extends Record<K, unknown> ? (Omit<T, K> & Record<K, R>) : T;
type Rendered<T extends NPSelection> = ReplaceKey<
Omit<T, "changeGender" | "changeNumber" | "changeDistance">,
"e",
string,
> & { inflected: boolean };
// TODO: recursive changing this down into the possesor etc.
// TPSelection => TPRendered => TPCompiled
// NPSelection => NPRendered => NPCompiled

3284
src/words/query-results.js Normal file

File diff suppressed because it is too large Load Diff

3220
src/words/wordle-words.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1684,10 +1684,10 @@
pbf "^3.2.1"
rambda "^6.7.0"
"@lingdocs/pashto-inflector@^1.4.4":
version "1.4.4"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.4.4.tgz#5015bf1e4abd913bdb2cbcc08a89ab64a7194d9e"
integrity sha512-RGf3AZFpy4JWzjWLeeGNLvy1PsDljRcDF4mQIqMPrFeakkuT4h3/exbGAANehNWGt9hm6LbPvXyXQmxe7SWaXg==
"@lingdocs/pashto-inflector@^1.5.0":
version "1.5.0"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.5.0.tgz#5fed055341c41fe3f72e9afdbab96d96b30737fb"
integrity sha512-K0VZiCV5lOkY2/s3xS1iIfIiitNA9n4uzdJIeqO2mU1Ce3UwA8OLlnaQq3/MnurXK5V1/dOEut5Ey0eMlGsAJg==
dependencies:
classnames "^2.2.6"
pbf "^3.2.1"