summaryrefslogtreecommitdiff
path: root/packages/langlib/src/dbtypes.ts
blob: d86d32e6fabe63e9deb9ae1d2521eac2555c59e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 };