add more verbs

This commit is contained in:
lingdocs 2022-03-28 12:53:58 +05:00
parent 693aecdd70
commit f22e6e7f5f
6 changed files with 1080 additions and 64 deletions

View File

@ -9,6 +9,7 @@ import {
ButtonSelect, ButtonSelect,
getVerbInfo, getVerbInfo,
} from "@lingdocs/pashto-inflector"; } from "@lingdocs/pashto-inflector";
// import { useState } from "react";
const tenseOptions: { label: string, value: VerbTense }[] = [{ const tenseOptions: { label: string, value: VerbTense }[] = [{
label: "present", label: "present",
@ -30,62 +31,22 @@ const tenseOptions: { label: string, value: VerbTense }[] = [{
value: "imperfectivePast", value: "imperfectivePast",
}]; }];
function makeVerbSelection(verb: VerbEntry, oldVerbSelection?: VerbSelection): VerbSelection { // type Filters = {
const info = getVerbInfo(verb.entry, verb.complement); // stative: boolean,
function getTransObjFromOldVerbSelection() { // dynamic: boolean,
if ( // transitive: boolean,
!oldVerbSelection || // intransitive: boolean,
oldVerbSelection.object === "none" || // grammaticallyTransitive: boolean,
typeof oldVerbSelection.object === "number" || // }
oldVerbSelection.isCompound === "dynamic" ||
(oldVerbSelection.object?.type === "noun" && oldVerbSelection.object.dynamicComplement)
) return undefined;
return oldVerbSelection.object;
}
const transitivity: T.Transitivity = "grammaticallyTransitive" in info
? "grammatically transitive"
: info.transitivity;
const object = (transitivity === "grammatically transitive")
? T.Person.ThirdPlurMale
: info.type === "dynamic compound"
? makeNounSelection(info.objComplement.entry as NounEntry, true)
: (transitivity === "transitive")
? getTransObjFromOldVerbSelection()
: "none";
const isCompound = "stative" in info
? "stative"
: info.type === "dynamic compound"
? "dynamic"
: false;
const dynAuxVerb: VerbEntry | undefined = isCompound !== "dynamic"
? undefined
: info.type === "dynamic compound"
? { entry: info.auxVerb } as VerbEntry
: "dynamic" in info
? { entry: info.dynamic.auxVerb } as VerbEntry
: undefined;
return {
type: "verb",
verb: verb,
dynAuxVerb,
tense: oldVerbSelection ? oldVerbSelection.tense : "present",
object,
transitivity,
isCompound,
negative: oldVerbSelection ? oldVerbSelection.negative : false,
...("grammaticallyTransitive" in info) ? {
changeTransitivity: function (t) {
return {
...this,
transitivity: t,
object: t === "grammatically transitive" ? T.Person.ThirdPlurMale : undefined,
};
},
} : {},
};
}
function VerbPicker({ onChange, verb, verbs }: { verbs: VerbEntry[], verb: VerbSelection | undefined, onChange: (p: VerbSelection) => void }) { function VerbPicker({ onChange, verb, verbs }: { verbs: VerbEntry[], verb: VerbSelection | undefined, onChange: (p: VerbSelection) => void }) {
// const [filters, useFilters] = useState<Filters>({
// stative: true,
// dynamic: true,
// transitive: true,
// intransitive: true,
// grammaticallyTransitive: true,
// });
const options = verbs.sort((a, b) => (a.entry.p.localeCompare(b.entry.p, "af-PS"))).map(makeVerbSelectOption); const options = verbs.sort((a, b) => (a.entry.p.localeCompare(b.entry.p, "af-PS"))).map(makeVerbSelectOption);
function onEntrySelect({ value }: { label: string, value: string }) { function onEntrySelect({ value }: { label: string, value: string }) {
const v = verbs.find(v => v.entry.ts.toString() === value); const v = verbs.find(v => v.entry.ts.toString() === value);
@ -176,4 +137,59 @@ function VerbPicker({ onChange, verb, verbs }: { verbs: VerbEntry[], verb: VerbS
</div>; </div>;
} }
function makeVerbSelection(verb: VerbEntry, oldVerbSelection?: VerbSelection): VerbSelection {
const info = getVerbInfo(verb.entry, verb.complement);
function getTransObjFromOldVerbSelection() {
if (
!oldVerbSelection ||
oldVerbSelection.object === "none" ||
typeof oldVerbSelection.object === "number" ||
oldVerbSelection.isCompound === "dynamic" ||
(oldVerbSelection.object?.type === "noun" && oldVerbSelection.object.dynamicComplement)
) return undefined;
return oldVerbSelection.object;
}
const transitivity: T.Transitivity = "grammaticallyTransitive" in info
? "grammatically transitive"
: info.transitivity;
const object = (transitivity === "grammatically transitive")
? T.Person.ThirdPlurMale
: info.type === "dynamic compound"
? makeNounSelection(info.objComplement.entry as NounEntry, true)
: (transitivity === "transitive")
? getTransObjFromOldVerbSelection()
: "none";
const isCompound = "stative" in info
? "stative"
: info.type === "dynamic compound"
? "dynamic"
: false;
const dynAuxVerb: VerbEntry | undefined = isCompound !== "dynamic"
? undefined
: info.type === "dynamic compound"
? { entry: info.auxVerb } as VerbEntry
: "dynamic" in info
? { entry: info.dynamic.auxVerb } as VerbEntry
: undefined;
return {
type: "verb",
verb: verb,
dynAuxVerb,
tense: oldVerbSelection ? oldVerbSelection.tense : "present",
object,
transitivity,
isCompound,
negative: oldVerbSelection ? oldVerbSelection.negative : false,
...("grammaticallyTransitive" in info) ? {
changeTransitivity: function (t) {
return {
...this,
transitivity: t,
object: t === "grammatically transitive" ? T.Person.ThirdPlurMale : undefined,
};
},
} : {},
};
}
export default VerbPicker; export default VerbPicker;

View File

@ -8,8 +8,6 @@ import {
import AbbreviationFormSelector from "./AbbreviationFormSelector"; import AbbreviationFormSelector from "./AbbreviationFormSelector";
import { isPastTense } from "../../lib/phrase-building/vp-tools"; import { isPastTense } from "../../lib/phrase-building/vp-tools";
// TODO: Issue when picking dynamic compound and then going back with the object dissappearing
function VPDisplay({ VP }: { VP: VPSelection }) { function VPDisplay({ VP }: { VP: VPSelection }) {
const [form, setForm] = useState<FormVersion>({ removeKing: false, shrinkServant: false }); const [form, setForm] = useState<FormVersion>({ removeKing: false, shrinkServant: false });
const [OSV, setOSV] = useState<boolean>(false); const [OSV, setOSV] = useState<boolean>(false);

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,398 @@
module.exports = [ module.exports = [
{ ts: 1527812732, e: "to work" }, // کار کول {
{ ts: 1527812939, e: "to run" }, // منډې وهل "ts": 1527816643
},
{
"ts": 1527817823
},
{
"ts": 1591002320547
},
{
"ts": 1527821339
},
{
"ts": 1527817226
},
{
"ts": 1527812167
},
{
"ts": 1527812598
},
{
"ts": 1527812002
},
{
"ts": 1527813489
},
{
"ts": 1577390517316
},
{
"ts": 1527820710
},
{
"ts": 1527817312
},
{
"ts": 1527818188
},
{
"ts": 1527811863
},
{
"ts": 1527816383
},
{
"ts": 1527822770
},
{
"ts": 1527821587
},
{
"ts": 1527818390
},
{
"ts": 1527818391
},
{
"ts": 1527814726
},
{
"ts": 1579394718033
},
{
"ts": 1527815968
},
{
"ts": 1592303372377
},
{
"ts": 1577551342853
},
{
"ts": 1527815351
},
{
"ts": 1586452103064
},
{
"ts": 1527816822
},
{
"ts": 1527812186
},
{
"ts": 1527814870
},
{
"ts": 1527815355
},
{
"ts": 1527815867
},
{
"ts": 1527822741
},
{
"ts": 1527814864
},
{
"ts": 1527819607
},
{
"ts": 1527821070
},
{
"ts": 1577812269585
},
{
"ts": 1573768865232
},
{
"ts": 1527822814
},
{
"ts": 1527823161
},
{
"ts": 1527821042
},
{
"ts": 1527818810
},
{
"ts": 1577823792516
},
{
"ts": 1588858155947
},
{
"ts": 1589024311021
},
{
"ts": 1527816916
},
{
"ts": 1527820291
},
{
"ts": 1527813125
},
{
"ts": 1527813937
},
{
"ts": 1591804639647
},
{
"ts": 1527813212
},
{
"ts": 1584529741244
},
{
"ts": 1575128717139
},
{
"ts": 1527813319
},
{
"ts": 1527822368
},
{
"ts": 1527819178
},
{
"ts": 1594129207239
},
{
"ts": 1594129204513
},
{
"ts": 1527815309
},
{
"ts": 1527814102
},
{
"ts": 1527818975
},
{
"ts": 1578326320888
},
{
"ts": 1527816152
},
{
"ts": 1527816463
},
{
"ts": 1527818094
},
{
"ts": 1527814855
},
{
"ts": 1527819033
},
{
"ts": 1577817988469
},
{
"ts": 1527819185
},
{
"ts": 1527814887
},
{
"ts": 1527818217
},
{
"ts": 1571946107980
},
{
"ts": 1581610643511
},
{
"ts": 1527811674
},
{
"ts": 1581610659810
},
{
"ts": 1527818401
},
{
"ts": 1592303194144
},
{
"ts": 1578607689918
},
{
"ts": 1527818341
},
{
"ts": 1527818425
},
{
"ts": 1527818422
},
{
"ts": 1527812633
},
{
"ts": 1527816328
},
{
"ts": 1588784260692
},
{
"ts": 1527812607
},
{
"ts": 1527822096
},
{
"ts": 1588152878869
},
{
"ts": 1527817624
},
{
"ts": 1527812732
},
{
"ts": 1527811600
},
{
"ts": 1527819661
},
{
"ts": 1527814357
},
{
"ts": 1582146016627
},
{
"ts": 1527819872
},
{
"ts": 1579034883717
},
{
"ts": 1527817357
},
{
"ts": 1527818937
},
{
"ts": 1527813950
},
{
"ts": 1527813888
},
{
"ts": 1527822099
},
{
"ts": 1588760636420
},
{
"ts": 1527819089
},
{
"ts": 1527817361
},
{
"ts": 1527812934
},
{
"ts": 1588161314887
},
{
"ts": 1527817165
},
{
"ts": 1609162269829
},
{
"ts": 1579295606403
},
{
"ts": 1589031340746
},
{
"ts": 1527812902
},
{
"ts": 1527817369
},
{
"ts": 1527819687
},
{
"ts": 1527821254
},
{
"ts": 1527817709
},
{
"ts": 1527823208
},
{
"ts": 1527811827
},
{
"ts": 1579459605988
},
{
"ts": 1527815991
},
{
"ts": 1527823707
},
{
"ts": 1527811729
},
{
"ts": 1527823733
},
{
"ts": 1527820620
},
{
"ts": 1527811599
},
{
"ts": 1604431102462
},
{
"ts": 1527818092
},
{
"ts": 1527816106
},
{
"ts": 1579723460957
},
{
"ts": 1527814910
},
{
"ts": 1527816263
},
{
"ts": 1609162463793
},
{
"ts": 1609599425410
},
{
"ts": 1527812939
},
{
"ts": 1614602054303
}
]; ];

View File

@ -1,4 +1,389 @@
module.exports = [ module.exports = [
{ ts: 1581906176268, e: "to be cooked" }, // پخېدل {
{ ts: 1591033069786, e: "to get tired" }, // ستړی کېدل "ts": 1588760879818
] },
{
"ts": 1577223176187
},
{
"ts": 1527814793
},
{
"ts": 1527820761
},
{
"ts": 1527818887
},
{
"ts": 1527821797
},
{
"ts": 1527822931
},
{
"ts": 1588853804403
},
{
"ts": 1527813033
},
{
"ts": 1527812404
},
{
"ts": 1527814231
},
{
"ts": 1527815729
},
{
"ts": 1527813842
},
{
"ts": 1527815032
},
{
"ts": 1588781671306
},
{
"ts": 1527817582
},
{
"ts": 1527815844
},
{
"ts": 1588073731662
},
{
"ts": 1527813895
},
{
"ts": 1527812011
},
{
"ts": 1581906176268
},
{
"ts": 1584689265872
},
{
"ts": 1583269419054
},
{
"ts": 1527814169
},
{
"ts": 1577394057681
},
{
"ts": 1527815170
},
{
"ts": 1581189978440
},
{
"ts": 1527815167
},
{
"ts": 1591872442272
},
{
"ts": 1527815324
},
{
"ts": 1577398809240
},
{
"ts": 1582391432928
},
{
"ts": 1580755448566
},
{
"ts": 1527821367
},
{
"ts": 1527814905
},
{
"ts": 1527821358
},
{
"ts": 1527823430
},
{
"ts": 1577501138221
},
{
"ts": 1527814919
},
{
"ts": 1579644515886
},
{
"ts": 1577571228633
},
{
"ts": 1577571096956
},
{
"ts": 1577571391494
},
{
"ts": 1589019870271
},
{
"ts": 1585310006948
},
{
"ts": 1527816202
},
{
"ts": 1527821166
},
{
"ts": 1527816943
},
{
"ts": 1527812713
},
{
"ts": 1577905544406
},
{
"ts": 1527812522
},
{
"ts": 1527811694
},
{
"ts": 1588783381414
},
{
"ts": 1527814126
},
{
"ts": 1588426001132
},
{
"ts": 1527819313
},
{
"ts": 1527816079
},
{
"ts": 1527811394
},
{
"ts": 1577900112011
},
{
"ts": 1527814184
},
{
"ts": 1577898920635
},
{
"ts": 1527818360
},
{
"ts": 1527814173
},
{
"ts": 1527817114
},
{
"ts": 1527812812
},
{
"ts": 1527816735
},
{
"ts": 1527815784
},
{
"ts": 1577059043220
},
{
"ts": 1527817671
},
{
"ts": 1527817257
},
{
"ts": 1527816895
},
{
"ts": 1527818346
},
{
"ts": 1527815734
},
{
"ts": 1585474304911
},
{
"ts": 1527823278
},
{
"ts": 1527812410
},
{
"ts": 1527815236
},
{
"ts": 1527817576
},
{
"ts": 1566120362058
},
{
"ts": 1527817668
},
{
"ts": 1591033069786
},
{
"ts": 1527816404
},
{
"ts": 1591782112190
},
{
"ts": 1527811948
},
{
"ts": 1589883893191
},
{
"ts": 1527820128
},
{
"ts": 1527814077
},
{
"ts": 1577057620783
},
{
"ts": 1585475932743
},
{
"ts": 1527814972
},
{
"ts": 1527821483
},
{
"ts": 1578607410634
},
{
"ts": 1578683722262
},
{
"ts": 1527823367
},
{
"ts": 1578705585960
},
{
"ts": 1588074081731
},
{
"ts": 1527811848
},
{
"ts": 1578769047886
},
{
"ts": 1578769553469
},
{
"ts": 1527811975
},
{
"ts": 1573149364576
},
{
"ts": 1527814821
},
{
"ts": 1527819155
},
{
"ts": 1579034600343
},
{
"ts": 1588152260378
},
{
"ts": 1527817122
},
{
"ts": 1527817119
},
{
"ts": 1527813947
},
{
"ts": 1527811901
},
{
"ts": 1527814560
},
{
"ts": 1527820885
},
{
"ts": 1579295191646
},
{
"ts": 1579295944312
},
{
"ts": 1527812920
},
{
"ts": 1579387693725
},
{
"ts": 1527815573
},
{
"ts": 1527811761
},
{
"ts": 1527820482
},
{
"ts": 1527817763
},
{
"ts": 1579721195157
},
{
"ts": 1527817238
},
{
"ts": 1589640142987
},
{
"ts": 1588153594269
},
{
"ts": 1527812005
},
{
"ts": 1576947352743
},
{
"ts": 1527819292
},
{
"ts": 1527812941
},
{
"ts": 1527814768
},
{
"ts": 1579824223049
}
];

View File

@ -1,4 +1,227 @@
module.exports = [ module.exports = [
{ ts: 1527815444, e: "to learn" }, // زده کول {
{ ts: 1571859113828, e: "to cook" }, // پخول "ts": 1527812403
},
{
"ts": 1577299232429
},
{
"ts": 1527815728
},
{
"ts": 1527821309
},
{
"ts": 1527821309
},
{
"ts": 1527815843
},
{
"ts": 1588073727998
},
{
"ts": 1527812010
},
{
"ts": 1527820144
},
{
"ts": 1584689306281
},
{
"ts": 1583269391864
},
{
"ts": 1577394118297
},
{
"ts": 1571859113828
},
{
"ts": 1527812385
},
{
"ts": 1581189437955
},
{
"ts": 1527820021
},
{
"ts": 1591872434020
},
{
"ts": 1527815323
},
{
"ts": 1527812388
},
{
"ts": 1580754885011
},
{
"ts": 1527821357
},
{
"ts": 1577501129214
},
{
"ts": 1527822697
},
{
"ts": 1579908304357
},
{
"ts": 1579644522321
},
{
"ts": 1527815731
},
{
"ts": 1589019863017
},
{
"ts": 1527816201
},
{
"ts": 1527821167
},
{
"ts": 1527816945
},
{
"ts": 1527816947
},
{
"ts": 1527812712
},
{
"ts": 1527817455
},
{
"ts": 1527815074
},
{
"ts": 1527811693
},
{
"ts": 1527816239
},
{
"ts": 1527811395
},
{
"ts": 1527812222
},
{
"ts": 1527814183
},
{
"ts": 1577898915919
},
{
"ts": 1592303701516
},
{
"ts": 1527814174
},
{
"ts": 1527812811
},
{
"ts": 1527813502
},
{
"ts": 1527811432
},
{
"ts": 1527813665
},
{
"ts": 1527817258
},
{
"ts": 1527823503
},
{
"ts": 1527818347
},
{
"ts": 1527823277
},
{
"ts": 1527813179
},
{
"ts": 1591033078746
},
{
"ts": 1527813065
},
{
"ts": 1527811949
},
{
"ts": 1589883890933
},
{
"ts": 1527814493
},
{
"ts": 1527823133
},
{
"ts": 1527823366
},
{
"ts": 1527820386
},
{
"ts": 1527814819
},
{
"ts": 1579034597012
},
{
"ts": 1588152253147
},
{
"ts": 1527817121
},
{
"ts": 1527817118
},
{
"ts": 1527814350
},
{
"ts": 1527816012
},
{
"ts": 1579387733916
},
{
"ts": 1527817762
},
{
"ts": 1589640176788
},
{
"ts": 1527812004
},
{
"ts": 1579724723019
},
{
"ts": 1579822065104
},
{
"ts": 1527816559
},
{
"ts": 1527813556
},
{
"ts": 1527815444
}
] ]