summaryrefslogtreecommitdiff
path: root/packages/langlib/src/dbtypes.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/langlib/src/dbtypes.ts')
-rw-r--r--packages/langlib/src/dbtypes.ts69
1 files changed, 69 insertions, 0 deletions
diff --git a/packages/langlib/src/dbtypes.ts b/packages/langlib/src/dbtypes.ts
new file mode 100644
index 0000000..d86d32e
--- /dev/null
+++ b/packages/langlib/src/dbtypes.ts
@@ -0,0 +1,69 @@
+export type ToneQuery = Array<string | null>;
+export type MutationType = { change: string } | { keep: string };
+export type MutationOrder = MutationType[];
+
+export const thaiTones: Record<string, string> = {
+ "˧": "mid",
+ "˨˩": "low",
+ "˥˩": "falling",
+ "˦˥": "high",
+ "˩˩˦": "rising",
+};
+export const thaiToneNums: Record<string, number> = {
+ "˧": 33,
+ "˨˩": 21,
+ "˥˩": 41,
+ "˦˥": 45,
+ "˩˩˦": 214,
+};
+
+export type FullWordData = {
+ id: number;
+ spelling: string;
+ frequency: number;
+ phonetic: PhoneticData;
+ senses: Sense[];
+};
+
+export type PhoneticData = {
+ word_id: number;
+ tone_sequence: string; // e.g. "1-4-3"
+ syl_seq: string; // e.g. "pre-si-dent"
+ syllable_count: number;
+ syllables: Syllable[];
+ ipa: string;
+};
+export type Sense = {
+ confidence: number;
+ examples: Example[];
+ categories: string[];
+ etymology: string;
+ derivation: Derivation[];
+ pos: string;
+ glosses: string[];
+};
+export type Tone = {
+ letters: string;
+ numbers: number;
+ name: string;
+};
+
+export type Phoneme = {
+ ipa: string;
+ spelling: string;
+};
+export type Syllable = {
+ stressed: boolean;
+ long: boolean;
+ spelling: string;
+ ipa: string;
+ nucleus: Phoneme;
+ onset: Phoneme;
+ medial: Phoneme;
+ coda: Phoneme;
+ rhyme: Phoneme;
+ tone: Tone;
+};
+
+export type Example = { ref: string; text: string };
+export type Derivation = { type: string; text: string; tags: any };