Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def matches(self, other):
return make_phoneme(self).matches(other)
def __eq__(self, other):
return False if type(self) != type(other) else IntEnum.__eq__(self, other)
def __floordiv__(self, other):
return make_phoneme(self) // other
class Consonantal(PhonologicalFeature):
neg = auto()
pos = auto()
class Voiced(PhonologicalFeature):
neg = auto()
pos = auto()
class Aspirated(PhonologicalFeature):
neg = auto()
pos = auto()
class Geminate(PhonologicalFeature):
neg = auto()
pos = auto()
class Roundedness(PhonologicalFeature):
neg = auto()
return make_phoneme(self) <= other
def __ge__(self, other):
return make_phoneme(self) >= other
def matches(self, other):
return make_phoneme(self).matches(other)
def __eq__(self, other):
return False if type(self) != type(other) else IntEnum.__eq__(self, other)
def __floordiv__(self, other):
return make_phoneme(self) // other
class Consonantal(PhonologicalFeature):
neg = auto()
pos = auto()
class Voiced(PhonologicalFeature):
neg = auto()
pos = auto()
class Aspirated(PhonologicalFeature):
neg = auto()
pos = auto()
class Geminate(PhonologicalFeature):
neg = auto()
close = auto()
near_close = auto()
close_mid = auto()
mid = auto()
open_mid = auto()
near_open = auto()
open = auto()
class Backness(PhonologicalFeature):
front = auto()
central = auto()
back = auto()
class Manner(PhonologicalFeature):
stop = auto()
fricative = auto()
affricate = auto()
nasal = auto()
lateral = auto()
trill = auto()
spirant = auto()
approximant = auto()
class Place(PhonologicalFeature):
bilabial = auto()
labio_dental = auto()
dental = auto()
alveolar = auto()
post_alveolar = auto()
class Aspirated(PhonologicalFeature):
neg = auto()
pos = auto()
class Geminate(PhonologicalFeature):
neg = auto()
pos = auto()
class Roundedness(PhonologicalFeature):
neg = auto()
pos = auto()
class Length(PhonologicalFeature):
short = auto()
long = auto()
overlong = auto()
# order for Height, Backness, and Manner is important
# the feature values must be ordered by *increasing sonority*
class Height(PhonologicalFeature):
close = auto()
near_close = auto()
close_mid = auto()
mid = auto()
open_mid = auto()
near_open = auto()
open = auto()
class Consonantal(PhonologicalFeature):
neg = auto()
pos = auto()
class Voiced(PhonologicalFeature):
neg = auto()
pos = auto()
class Aspirated(PhonologicalFeature):
neg = auto()
pos = auto()
class Geminate(PhonologicalFeature):
neg = auto()
pos = auto()
class Roundedness(PhonologicalFeature):
neg = auto()
pos = auto()
class Length(PhonologicalFeature):
short = auto()
long = auto()
overlong = auto()
# order for Height, Backness, and Manner is important
central = auto()
back = auto()
class Manner(PhonologicalFeature):
stop = auto()
fricative = auto()
affricate = auto()
nasal = auto()
lateral = auto()
trill = auto()
spirant = auto()
approximant = auto()
class Place(PhonologicalFeature):
bilabial = auto()
labio_dental = auto()
dental = auto()
alveolar = auto()
post_alveolar = auto()
retroflex = auto()
palatal = auto()
velar = auto()
uvular = auto()
glottal = auto()
# ------------------- Phonemes -------------------
class AbstractPhoneme:
"""
overlong = auto()
# order for Height, Backness, and Manner is important
# the feature values must be ordered by *increasing sonority*
class Height(PhonologicalFeature):
close = auto()
near_close = auto()
close_mid = auto()
mid = auto()
open_mid = auto()
near_open = auto()
open = auto()
class Backness(PhonologicalFeature):
front = auto()
central = auto()
back = auto()
class Manner(PhonologicalFeature):
stop = auto()
fricative = auto()
affricate = auto()
nasal = auto()
lateral = auto()
trill = auto()
spirant = auto()
approximant = auto()
class Voiced(PhonologicalFeature):
neg = auto()
pos = auto()
class Aspirated(PhonologicalFeature):
neg = auto()
pos = auto()
class Geminate(PhonologicalFeature):
neg = auto()
pos = auto()
class Roundedness(PhonologicalFeature):
neg = auto()
pos = auto()
class Length(PhonologicalFeature):
short = auto()
long = auto()
overlong = auto()
# order for Height, Backness, and Manner is important
# the feature values must be ordered by *increasing sonority*
class Height(PhonologicalFeature):
close = auto()
near_close = auto()
close_mid = auto()
def __getitem__(self, feature_name):
"""
Use dict-type syntax for accessing the values of features.
"""
if not issubclass(feature_name, PhonologicalFeature):
raise TypeError(str(feature_name) + ' is not a phonological feature')
return self.features.get(feature_name, None)
def __init__(self, *phonemes):
super().__init__(self)
if any([not isinstance(p, AbstractPhoneme) and
not isinstance(p, PhonologicalFeature) and
not isinstance(p, list) for p in phonemes]):
raise TypeError(phonemes)
true_phonemes = [make_phoneme(p) if not isinstance(p, AbstractPhoneme) else p for p in phonemes]
self.extend(true_phonemes)