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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
import * as lang from './language';
test('correctly output basic vowels', () => {
expect(lang.vowelFeaturesToIpa({
height: lang.VowelHeight.Close,
depth: lang.VowelDepth.Front,
round: false,
long: false,
nasal: false,
})).toBe('i');
expect(lang.vowelFeaturesToIpa({
height: lang.VowelHeight.Mid,
depth: lang.VowelDepth.Central,
round: false,
long: false,
nasal: false,
})).toBe('ə');
expect(lang.vowelFeaturesToIpa({
height: lang.VowelHeight.Open,
depth: lang.VowelDepth.Back,
round: true,
long: false,
nasal: true,
})).toBe('ɒ̃');
expect(lang.vowelFeaturesToIpa({
height: lang.VowelHeight.CloseMid,
depth: lang.VowelDepth.Front,
round: false,
long: true,
nasal: false,
})).toBe('eː');
});
test('correctly output basic consonants', () => {
expect(lang.consonantFeaturesToIpa({
place: lang.ConsonantPlace.Bilabial,
manner: lang.ConsonantManner.Nasal,
voice: true,
})).toBe('m');
expect(lang.consonantFeaturesToIpa({
place: lang.ConsonantPlace.Uvular,
manner: lang.ConsonantManner.NonSibilantFricative,
voice: true,
})).toBe('ʁ');
expect(lang.consonantFeaturesToIpa({
place: lang.ConsonantPlace.Velar,
manner: lang.ConsonantManner.Plosive,
voice: false,
})).toBe('k');
});
test('fail to output impossible consonants', () => {
expect(lang.consonantFeaturesToIpa({
place: lang.ConsonantPlace.Retroflex,
manner: lang.ConsonantManner.NonSibilantAffricate,
voice: false,
})).toBe('');
expect(lang.consonantFeaturesToIpa({
place: lang.ConsonantPlace.Labiodental,
manner: lang.ConsonantManner.Trill,
voice: true,
})).toBe('');
expect(lang.consonantFeaturesToIpa({
place: lang.ConsonantPlace.Palatal,
manner: lang.ConsonantManner.Approximant,
voice: false,
})).toBe('');
});
test('all consonants can be selected', () => {
expect(lang.pickConsonants(
[ lang.ConsonantPlace.Bilabial ],
[ lang.ConsonantManner.Nasal ],
[ true, true ],
)).toEqual([
{
place: lang.ConsonantPlace.Bilabial,
manner: lang.ConsonantManner.Nasal,
voice: false,
},
{
place: lang.ConsonantPlace.Bilabial,
manner: lang.ConsonantManner.Nasal,
voice: true,
},
]);
expect(lang.pickConsonants(
[ lang.ConsonantPlace.Labiodental ],
[
lang.ConsonantManner.Nasal,
lang.ConsonantManner.Plosive,
lang.ConsonantManner.SibilantAffricate,
lang.ConsonantManner.NonSibilantAffricate,
lang.ConsonantManner.SibilantFricative,
lang.ConsonantManner.NonSibilantFricative,
lang.ConsonantManner.Approximant,
lang.ConsonantManner.Tap,
lang.ConsonantManner.Trill,
lang.ConsonantManner.LateralAffricate,
lang.ConsonantManner.LateralFricative,
lang.ConsonantManner.LateralApproximant,
lang.ConsonantManner.LateralTap,
],
[ true, false ],
)).toEqual([
{
place: lang.ConsonantPlace.Labiodental,
manner: lang.ConsonantManner.Nasal,
voice: false,
},
{
place: lang.ConsonantPlace.Labiodental,
manner: lang.ConsonantManner.Plosive,
voice: false,
},
{
place: lang.ConsonantPlace.Labiodental,
manner: lang.ConsonantManner.NonSibilantAffricate,
voice: false,
},
{
place: lang.ConsonantPlace.Labiodental,
manner: lang.ConsonantManner.NonSibilantFricative,
voice: false,
},
]);
expect(lang.pickConsonants(
[ lang.ConsonantPlace.Bilabial, lang.ConsonantPlace.Alveolar ],
[ lang.ConsonantManner.Plosive, lang.ConsonantManner.Tap ],
[ true, true ],
).map(lang.consonantFeaturesToIpa)).toEqual([
'p', 'b', 'ⱱ̟', 't', 'd', 'ɾ̥', 'ɾ',
]);
});
test('vowel positions work correctly', () => {
expect(
lang._vowelXY(lang.VowelHeight.Open, lang.VowelDepth.Back)
).toEqual([0, 0]);
expect(
lang._vowelXY(lang.VowelHeight.NearOpen, lang.VowelDepth.Central)
).toEqual([1.5, 1]);
expect(
lang._vowelXY(lang.VowelHeight.Close, lang.VowelDepth.Front)
).toEqual([8, 6]);
expect(
lang._vowelXY(lang.VowelHeight.Close, lang.VowelDepth.Back)
).toEqual([0, 6]);
});
|