summaryrefslogtreecommitdiff
path: root/src/lib/types/phonetics.ts
blob: 1d0db5a3cf3afc2ec3bb678166da9fd22d51abf5 (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
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 ToneQuery = Array<string | null>;
export type MutationType = { change: string } | { keep: string };
export type MutationOrder = MutationType[];

export type PhoneticData = {
  word_id: number;
  tone_sequence: string;
  syllable_count: number;
  syl_seq: string;
  spelling: string;
  ipa: string;
  frequency: number;
};

export const thaiTones: Record<string, string> = {
  "˧": "mid",
  "˨˩": "low",
  "˥˩": "falling",
  "˦˥": "high",
  "˩˩˦": "rising",
};
export const thaiToneNums: Record<string, number> = {
  "˧": 33,
  "˨˩": 21,
  "˥˩": 41,
  "˦˥": 45,
  "˩˩˦": 214,
};