예제 #1
0
파일: phone.py 프로젝트: cdnilsen/PyLaut
 def __init__(self, ipa_string=None):
     super().__init__(featureset.FeatureModel('monophone'), ipa_string)
     self.JSON_OBJECT_NAME = "Phone/MonoPhone"
     self.JSON_VERSION_NO = "MonoPhone-pre-alpha-1"
     if ipa_string:
         self.set_features_from_ipa(ipa_string)
         self.set_symbol_from_features()
예제 #2
0
def test_load_from_package():
    f = featureset.FeatureModel('monophone')
    assert f.features == [
        'syllabic', 'consonantal', 'continuant', 'sonorant', 'nasal', 'labial',
        'dental', 'apical', 'coronal', 'dorsal', 'voice', 'trill', 'flap',
        'lateral', 'pharyngeal', 'glottal', 'front', 'back', 'high', 'low',
        'round', 'tense', 'breathy', 'aspirated', 'long', 'sibilant'
    ]
예제 #3
0
def test_features_from_ipa_string():
    f = featureset.FeatureModel('monophone')
    esh = f.get_features_from_ipa('ʃ')
    esh_ph = f.get_features_from_ipa('ʃˤ')
    assert esh == [
        '-', '+', '+', '-', '-', '-', '-', '-', '+', '-', '-', '-', '-', '-',
        '-', '-', '-', '+', '-', '-', '-', '-', '-', '-', '-', '+'
    ]
    assert esh_ph == [
        '-', '+', '+', '-', '-', '-', '-', '-', '+', '-', '-', '-', '-', '-',
        '+', '-', '-', '+', '-', '-', '-', '-', '-', '-', '-', '+'
    ]
예제 #4
0
def test_ipa_from_features():

    f = featureset.FeatureModel('monophone')
    esh_f = [
        '-', '+', '+', '-', '-', '-', '-', '+', '-', '-', '-', '-', '-', '-',
        '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '+'
    ]
    esh_ph_f = [
        '-', '+', '+', '-', '-', '-', '-', '+', '-', '-', '-', '-', '-', '-',
        '+', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '+'
    ]
    esh = f.get_ipa_from_features(esh_f)
    esh_ph = f.get_ipa_from_features(esh_ph_f)

    assert esh == 'ʂ'
    assert esh_ph == 'ʂˤ'
예제 #5
0
파일: test_phone.py 프로젝트: defseg/PyLaut
def phone():
    fm = featureset.FeatureModel('monophone')
    return ph.Phone(fm, 'e')