This repository has been archived by the owner on May 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phonetic_features_types.py
237 lines (164 loc) · 5.3 KB
/
phonetic_features_types.py
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
from enum import unique, Enum, auto
@unique
class Polarity(Enum):
"""
Represents the '+' (plus) or '-' (minus)
of a binary feature. e.g. [+sonorant],
[-sonorant]
"""
PLUS = auto()
MINUS = auto()
class PhonemeFeature:
"""
According to Linguistics, phonemes can be
analyzed as a set of features. One phoneme
will have one set of features, and a different
phoneme will have a different set of features.
These features are well known in phonology, and
are limited in number. There are two kinds of
features, unary features, and binary features. The
difference is obvious in how they are represented in
the notation that linguists use. Unary features,
are either present or absent. Binary features
can be positive or negative. For example, Nasal
is a unary feature. A phoneme is either nasal,
or it isn't. i.e. [nasal] or not. For example,
Voice is a binary feature, a phoneme can be
[+voice] (can be pronounced: "plus voice")
or [-voice] (can be pronounced: "minus voice").
Because linguists represent phonemic features in these
two different ways. We represent these as two
different kinds of types.
So [nasal] which is a unary feature would be
represented by a value `NasalFeature` of type `PhonemeFeature`.
And [+voice] which is a binary feature would
be represented by a value `VoiceFeature Plus` of type
`PhonemeFeature`.
We represent the plus or minus symbol by
the type Polarity.
Notice that: Linguists write a set of features
as a 2D matrix with one column, roughly like this:
⎡ +voice ⎤
⎢ +sonorant ⎥
⎣ nasal ⎦
Note that certain sets of features cannot coexist,
syntactically. For example a phoneme cannot be
[+voice] and [-voice].
Note that some analyses
are language specific, so for some phonemes (not
the usual case) whether it has feature X (say 'coronal')
depends on the language (theoretical example: e.g. Swahili,
vs French). This is not implemented here.
"""
def __init__(self):
pass
class SyllabicFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
class ConsonantalFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
class SonorantFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
class ContinuantFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
class VoiceFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
class AdvancedTongueRootFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
class NasalFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class LateralFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class DelayedReleaseFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class SpreadGlottisFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class ConstrictedGlottisFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class LabialFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class CoronalFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class DorsalFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class PharyngealFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class LaryngealFeature(PhonemeFeature):
def __init__(self):
super().__init__()
class RoundFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
def __eq__(self, other):
return self.polarity == other.polarity
def __ne__(self, other):
return not self.__eq__(other)
class AnteriorFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
def __eq__(self, other):
return self.polarity == other.polarity
def __ne__(self, other):
return not self.__eq__(other)
class DistributedFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
def __eq__(self, other):
return self.polarity == other.polarity
def __ne__(self, other):
return not self.__eq__(other)
class StridentFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
def __eq__(self, other):
return self.polarity == other.polarity
def __ne__(self, other):
return not self.__eq__(other)
class HighFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
def __eq__(self, other):
return self.polarity == other.polarity
def __ne__(self, other):
return not self.__eq__(other)
class LowFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
def __eq__(self, other):
return self.polarity == other.polarity
def __ne__(self, other):
return not self.__eq__(other)
class BackFeature(PhonemeFeature):
def __init__(self, polarity: Polarity):
super().__init__()
self.polarity = polarity
def __eq__(self, other):
return self.polarity == other.polarity
def __ne__(self, other):
return not self.__eq__(other)