pashto-inflector/src/library.ts

296 lines
7.3 KiB
TypeScript
Raw Normal View History

2021-03-09 12:39:13 +00:00
/**
* Copyright (c) 2021 lingdocs.com
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import {
2021-03-09 12:39:13 +00:00
conjugateVerb,
} from "./lib/verb-conjugation";
import {
inflectWord,
} from "./lib/pashto-inflector";
import {
getVerbInfo,
2022-07-26 18:02:24 +00:00
getPassiveRootsAndStems,
getAbilityRootsAndStems,
2021-03-09 12:39:13 +00:00
} from "./lib/verb-info";
import InflectionsTable from "./components/InflectionsTable";
import Pashto from "./components/Pashto";
import Phonetics from "./components/Phonetics";
import InlinePs from "./components/InlinePs";
import ButtonSelect from "./components/ButtonSelect";
import VerbFormDisplay from "./components/VerbFormDisplay";
import VerbTable from "./components/VerbTable";
2022-06-11 15:57:59 +00:00
import EPDisplay from "./components/ep-explorer/EPDisplay";
2021-03-09 12:39:13 +00:00
import Examples from "./components/Examples";
import Hider from "./components/Hider";
import EntrySelect from "./components/EntrySelect";
2021-03-09 12:39:13 +00:00
import VerbInfo, { RootsAndStems } from "./components/verb-info/VerbInfo";
import VPExplorer from "./components/vp-explorer/VPExplorer";
2022-08-23 12:11:32 +00:00
import { makeVPSelectionState } from "./components/vp-explorer/verb-selection";
2022-06-23 21:19:44 +00:00
import { vpsReducer } from "./components/vp-explorer/vps-reducer";
import type { VpsReducerAction as VpsA } from "./components/vp-explorer/vps-reducer";
import useStickyState from "./lib/useStickyState";
2022-07-01 00:54:32 +00:00
import { isPastTense } from "./lib/phrase-building/vp-tools";
2022-06-04 23:19:24 +00:00
import Block, { NPBlock, APBlock } from "./components/blocks/Block";
2022-06-22 23:52:09 +00:00
import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal";
2022-07-05 21:42:43 +00:00
import CompiledPTextDisplay from "./components/CompiledPTextDisplay";
import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay";
2021-03-09 12:39:13 +00:00
import {
makePsString,
removeFVarients,
} from "./lib/accent-and-ps-utils";
import {
addToForm,
concatPsString,
2021-07-15 09:57:04 +00:00
isVerbBlock,
isImperativeBlock,
2021-09-15 00:55:47 +00:00
isPluralInflectionSet,
isUnisexSet,
2021-07-15 09:57:04 +00:00
isInflectionSet,
2021-10-06 01:31:45 +00:00
addEnglish,
2021-10-16 01:58:56 +00:00
endsWith,
2022-03-18 21:32:01 +00:00
hasBaParticle,
2022-03-20 12:45:47 +00:00
psRemove,
firstVariation,
psStringFromEntry,
getLong,
capitalizeFirstLetter,
2021-03-09 12:39:13 +00:00
} from "./lib/p-text-helpers";
2021-10-05 01:15:13 +00:00
import {
getEnglishWord,
} from "./lib/get-english-word";
2021-09-16 17:52:52 +00:00
import {
standardizePashto,
standardizePhonetics,
} from "./lib/standardize-pashto";
2021-03-18 12:01:52 +00:00
import { phoneticsToDiacritics } from "./lib/phonetics-to-diacritics";
import {
randomPerson,
isInvalidSubjObjCombo,
randomSubjObj,
2022-06-21 21:30:51 +00:00
getEnglishVerb,
} from "./lib/np-tools";
2022-05-14 21:55:52 +00:00
import {
getEnglishFromRendered,
getPashtoFromRendered,
} from "./lib/phrase-building/np-tools"; // TODO should be one np-tools file?
2021-03-09 12:39:13 +00:00
import {
2021-07-24 15:43:53 +00:00
convertSpelling,
revertSpelling,
2021-03-09 12:39:13 +00:00
} from "./lib/convert-spelling";
import {
dictionaryEntryBooleanFields,
dictionaryEntryNumberFields,
dictionaryEntryTextFields,
} from "./lib/fields";
import {
2021-09-16 17:52:52 +00:00
validateEntry,
standardizeEntry,
2021-03-09 12:39:13 +00:00
} from "./lib/validate-entry";
2022-05-09 16:02:19 +00:00
import {
psJSXMap,
} from "./lib/jsx-map";
2021-03-10 11:37:35 +00:00
import {
readDictionary,
writeDictionary,
readDictionaryInfo,
writeDictionaryInfo,
} from "./lib/protobuf";
2021-03-10 16:51:40 +00:00
import {
pashtoConsonants,
} from "./lib/pashto-consonants";
import {
isNounAdjOrVerb,
2021-07-14 00:44:27 +00:00
getEnglishPersonInfo,
getPersonFromVerbForm,
getPersonNumber,
2021-07-15 09:57:04 +00:00
personFromVerbBlockPos,
2021-10-05 03:27:26 +00:00
getVerbBlockPosFromPerson,
2021-10-06 00:52:54 +00:00
personIsPlural,
2021-10-06 01:13:47 +00:00
personGender,
2021-10-07 17:17:04 +00:00
parseEc,
personNumber,
2022-05-06 20:33:00 +00:00
randFromArray,
2022-05-06 20:54:15 +00:00
chooseLength,
2022-05-07 05:52:56 +00:00
isFirstPerson,
isSecondPerson,
isThirdPerson,
2021-03-10 16:51:40 +00:00
} from "./lib/misc-helpers";
2022-05-06 20:54:15 +00:00
import {
flattenLengths,
2022-06-20 22:45:40 +00:00
} from "./lib/phrase-building/compile";
2021-03-16 13:35:41 +00:00
import {
simplifyPhonetics,
} from "./lib/simplify-phonetics";
2021-03-18 12:05:49 +00:00
import {
translatePhonetics,
} from "./lib/translate-phonetics";
2021-06-05 16:29:35 +00:00
import {
addDiacritics,
} from "./lib/diacritics";
2021-09-02 12:37:45 +00:00
import {
removeAccents,
2021-09-03 11:27:02 +00:00
hasAccents,
splitUpSyllables,
countSyllables,
2021-09-02 12:37:45 +00:00
} from "./lib/accent-helpers";
2022-05-06 19:57:39 +00:00
import {
makeNounSelection,
} from "./components/np-picker/picker-tools";
2022-05-06 20:33:00 +00:00
import {
renderEP,
} from "./lib/phrase-building/render-ep";
import {
renderVP,
} from "./lib/phrase-building/render-vp";
2022-05-14 21:28:25 +00:00
import {
renderNPSelection,
} from "./lib/phrase-building/render-np";
2022-05-06 20:33:00 +00:00
import {
compileEP,
compileVP,
} from "./lib/phrase-building/compile";
2022-05-26 20:01:25 +00:00
import {
2022-05-26 20:05:38 +00:00
renderAPSelection,
2022-05-26 20:01:25 +00:00
} from "./lib/phrase-building/render-ap";
2022-08-29 13:47:51 +00:00
import { humanReadableTense } from "./lib/human-readable";
2022-04-14 17:11:45 +00:00
import NPPicker from "./components/np-picker/NPPicker";
2022-06-11 17:42:50 +00:00
import EPPicker from "./components/ep-explorer/EPPicker";
2022-04-26 08:02:18 +00:00
import EPExplorer from "./components/ep-explorer/EPExplorer";
2022-04-12 08:39:03 +00:00
import shuffleArray from "./lib/shuffle-array";
2021-03-09 12:39:13 +00:00
import defaultTextOptions from "./lib/default-text-options";
import * as grammarUnits from "./lib/grammar-units";
2021-11-03 00:33:39 +00:00
import genderColors from "./lib/gender-colors";
2021-03-09 12:39:13 +00:00
import * as Types from "./types";
import * as typePredicates from "./lib/type-predicates";
2022-05-26 20:13:59 +00:00
import APPicker from "./components/ap-picker/APPicker";
2022-06-22 23:52:09 +00:00
import VPDisplay from "./components/vp-explorer/VPDisplay";
import VPPicker from "./components/vp-explorer/VPPicker";
2022-08-23 12:25:54 +00:00
import * as blockUtils from "./lib/phrase-building/blocks-utils";
2021-03-09 12:39:13 +00:00
export {
// FUNCTIONS
conjugateVerb,
getVerbInfo,
2022-07-26 18:02:24 +00:00
getPassiveRootsAndStems,
getAbilityRootsAndStems,
2021-03-09 12:39:13 +00:00
inflectWord,
addToForm,
concatPsString,
makePsString,
removeFVarients,
2021-03-09 12:39:13 +00:00
standardizePashto,
2021-09-16 17:52:52 +00:00
standardizePhonetics,
2021-07-24 15:43:53 +00:00
convertSpelling,
revertSpelling,
2021-03-09 12:39:13 +00:00
validateEntry,
2021-09-16 17:52:52 +00:00
standardizeEntry,
2021-03-10 16:51:40 +00:00
isNounAdjOrVerb,
2021-03-16 13:35:41 +00:00
simplifyPhonetics,
2021-03-18 12:01:52 +00:00
phoneticsToDiacritics,
2021-06-05 16:29:35 +00:00
addDiacritics,
2021-03-18 12:05:49 +00:00
translatePhonetics,
2021-07-14 00:44:27 +00:00
getEnglishPersonInfo,
getPersonFromVerbForm,
getPersonNumber,
2021-07-15 09:57:04 +00:00
isVerbBlock,
isImperativeBlock,
isInflectionSet,
2021-09-15 00:55:47 +00:00
isPluralInflectionSet,
isUnisexSet,
2021-07-15 09:57:04 +00:00
personFromVerbBlockPos,
2021-09-02 12:37:45 +00:00
removeAccents,
2021-09-03 11:27:02 +00:00
hasAccents,
2021-10-05 01:15:13 +00:00
getEnglishWord,
2021-10-05 03:27:26 +00:00
getVerbBlockPosFromPerson,
2021-10-06 00:52:54 +00:00
personIsPlural,
2021-10-06 01:13:47 +00:00
personGender,
2021-10-06 01:31:45 +00:00
addEnglish,
2021-10-07 17:17:04 +00:00
parseEc,
2021-10-16 01:58:56 +00:00
endsWith,
splitUpSyllables,
countSyllables,
2022-03-18 21:32:01 +00:00
hasBaParticle,
2022-03-20 12:45:47 +00:00
psRemove,
firstVariation,
capitalizeFirstLetter,
psStringFromEntry,
getLong,
useStickyState,
randomPerson,
isInvalidSubjObjCombo,
randomSubjObj,
2022-04-12 08:39:03 +00:00
shuffleArray,
personNumber,
2022-05-06 19:57:39 +00:00
makeNounSelection,
2022-05-06 20:33:00 +00:00
randFromArray,
renderEP,
renderVP,
compileEP,
compileVP,
2022-05-06 20:54:15 +00:00
chooseLength,
flattenLengths,
2022-05-07 05:52:56 +00:00
isFirstPerson,
isSecondPerson,
isThirdPerson,
2022-07-01 00:54:32 +00:00
isPastTense,
2022-05-09 16:02:19 +00:00
psJSXMap,
2022-05-14 21:28:25 +00:00
renderNPSelection,
2022-05-14 21:55:52 +00:00
getEnglishFromRendered,
getPashtoFromRendered,
2022-05-26 20:05:38 +00:00
renderAPSelection,
2022-06-21 21:30:51 +00:00
getEnglishVerb,
2022-08-29 13:47:51 +00:00
humanReadableTense,
2022-06-22 23:52:09 +00:00
roleIcon,
2022-06-23 21:19:44 +00:00
vpsReducer,
2022-08-23 12:11:32 +00:00
makeVPSelectionState,
2022-08-23 12:25:54 +00:00
blockUtils,
2021-03-10 11:37:35 +00:00
// protobuf helpers
readDictionary,
writeDictionary,
readDictionaryInfo,
writeDictionaryInfo,
2021-03-09 12:39:13 +00:00
// COMPONENTS
2022-04-26 08:02:18 +00:00
EPExplorer,
VPExplorer,
2021-03-09 12:39:13 +00:00
Examples,
VerbFormDisplay,
VerbTable,
VerbInfo,
RootsAndStems,
InflectionsTable,
Pashto,
Phonetics,
InlinePs,
ButtonSelect,
Hider,
EntrySelect,
2022-04-14 17:11:45 +00:00
NPPicker,
2022-05-26 20:13:59 +00:00
APPicker,
2022-06-04 23:19:24 +00:00
NPBlock,
APBlock,
Block,
2022-06-11 15:57:59 +00:00
EPDisplay,
2022-06-22 23:52:09 +00:00
VPDisplay,
2022-06-11 17:42:50 +00:00
EPPicker,
2022-06-22 23:52:09 +00:00
VPPicker,
2022-07-05 21:42:43 +00:00
CompiledPTextDisplay,
RenderedBlocksDisplay,
2021-03-09 12:39:13 +00:00
// OTHER
typePredicates,
2021-03-09 12:39:13 +00:00
grammarUnits,
2021-03-10 16:51:40 +00:00
pashtoConsonants,
2021-03-09 12:39:13 +00:00
defaultTextOptions,
dictionaryEntryTextFields,
dictionaryEntryNumberFields,
dictionaryEntryBooleanFields,
2021-11-03 00:33:39 +00:00
genderColors,
2021-03-09 12:39:13 +00:00
// TYPES
Types,
2022-06-23 21:19:44 +00:00
}
export type VpsReducerAction = VpsA;