-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.py
156 lines (140 loc) · 5.34 KB
/
examples.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
from data import *
from segments import voiced_consonants, voiceless_consonants, consonants, vowels, voice_obstruents, voiceless_obstruents
# start English z suffix devoicing examples
consonant = u_seg(consonants)
voiceless_consonant = u_seg(voiceless_consonants)
voiced_consonant = u_seg(voiced_consonants)
voice_obstruent = u_seg(voice_obstruents)
voiceless_obstruent = u_seg(voiceless_obstruents)
vowel = u_seg(vowels)
# TODO consider making these proportions random variables
cats = [consonant, vowel, seg('t'), seg('s')]
catz = [consonant, vowel, seg('t'), seg('z')]
# UR is CVTD
cats1 = [consonant, vowel, voiceless_obstruent, voiceless_obstruent]
cats2 = [consonant, vowel, voiceless_obstruent, voiceless_obstruent]
cats3 = [consonant, vowel, voiceless_obstruent, voiceless_obstruent]
cats4 = [consonant, vowel, voiceless_obstruent, voice_obstruent]
cats5 = [consonant, vowel, voiceless_obstruent, voice_obstruent]
gz = [consonant, vowel, seg('g'), seg('z')]
nz = [consonant, vowel, seg('n'), seg('z')]
five_v_th = [
voiceless_consonant,
voiceless_consonant,
vowel,
seg('l'),
seg('v'),
seg('θ')]
five_f_th = [
voiceless_consonant,
voiceless_consonant,
vowel,
seg('l'),
seg('f'),
seg('θ')]
four_v_th = [consonant, vowel, seg('l'), seg('v'), seg('θ')]
four_f_th = [consonant, vowel, seg('l'), seg('f'), seg('θ')]
two_vowel_t_theta = [consonant, vowel, vowel, seg('t'), seg('θ')]
one_vowel_t_theta = [consonant, vowel, seg('t'), seg('θ')]
n_theta = [consonant, vowel, seg('n'), seg('θ')]
end_voi_words = list(map(Word, [
cats,
catz,
cats1, cats2, cats3, cats4, cats5,
gz,
nz,
five_f_th,
five_v_th,
four_f_th,
four_v_th,
two_vowel_t_theta,
one_vowel_t_theta,
n_theta]))
sos = '<sos>' # TODO make this an automatic prepend for rankings
eos = '<eos>' # TODO make this an automatic apend for rankings
agree, ident_voi, star_d, star_d_sigma = 'Agree', '*Ident-IO(voi)', '*D', '*D_sigma'
english_voi: Ranking = [sos, agree, ident_voi, star_d, star_d_sigma, eos]
faith_voi: Ranking = [sos, ident_voi, agree, star_d, star_d_sigma, eos]
end_voi_examples = []
for word in end_voi_words:
if word.segments[-1].all_obstruent() and word.segments[-2].all_obstruent():
if word.segments[-1].all_voiced() == word.segments[-2].all_voiced():
ranking = single_ranking(english_voi)
else:
ranking = single_ranking(faith_voi)
else:
ranking = single_ranking(faith_voi)
end_voi_examples.append((word, ranking))
# end English z suffix devoicing examples
# start hypothetical simple examples
faith_voi: Ranking = [sos, ident_voi, agree, star_d, star_d_sigma, eos]
agree_above: Ranking = [sos, agree, ident_voi, star_d, star_d_sigma, eos]
star_above: Ranking = [sos, star_d, agree, ident_voi, star_d_sigma, eos]
cv_voice = Word([voice_obstruent, vowel])
vc_voice = Word([vowel, voice_obstruent])
cv_voiceless = Word([voiceless_obstruent, vowel])
cv_voiceless2 = Word([voiceless_obstruent, vowel])
vc_voiceless = Word([vowel, voiceless_obstruent])
vc_voiceless2 = Word([vowel, voiceless_obstruent])
hypo_voi_examples = [
(cv_voice,
single_ranking(faith_voi)),
(vc_voice,
single_ranking(faith_voi)),
(cv_voiceless,
single_ranking(star_above)),
(cv_voiceless2,
single_ranking(star_above)),
(vc_voiceless,
single_ranking(star_above)),
(vc_voiceless2,
single_ranking(star_above))]
# UR is voice, voiceless, vowel
# ccv_agree = Word([voice_obstruent, voice_obstruent, vowel])
ccv_dis1 = Word([voice_obstruent, voiceless_obstruent, vowel])
# ccv_dis2 = Word([voiceless_obstruent, voice_obstruent, vowel])
ccv_agree_voiceless = Word([voiceless_obstruent, voiceless_obstruent, vowel])
ccv_agree_voiceless2 = Word([voiceless_obstruent, voiceless_obstruent, vowel])
ccv_agree_voiceless3 = Word([voiceless_obstruent, voiceless_obstruent, vowel])
star_agree_examples = [
(ccv_dis1,
single_ranking(faith_voi)),
(ccv_agree_voiceless,
single_ranking(star_above)),
(ccv_agree_voiceless2,
single_ranking(star_above)),
(ccv_agree_voiceless3,
single_ranking(star_above))
]
# UR is voice, voiceless, vowel, voice
ccvc_dis1 = Word(
[voice_obstruent, voiceless_obstruent, vowel, voice_obstruent])
# ccv_dis2 = Word([voiceless_obstruent, voice_obstruent, vowel])
ccvc_agree_voiceless = Word(
[voiceless_obstruent, voiceless_obstruent, vowel, voiceless_obstruent])
ccvc_agree_voiceless2 = Word(
[voiceless_obstruent, voiceless_obstruent, vowel, voiceless_obstruent])
star_agree_double_c_examples = [
(ccv_dis1,
single_ranking(faith_voi)),
(ccv_agree_voiceless,
single_ranking(star_above)),
(ccv_agree_voiceless2,
single_ranking(star_above))
]
# UR is vowel, voice, voiceless, vowel
# vccv_agree = Word([vowel, voice_obstruent, voice_obstruent, vowel])
vccv_dis1 = Word([vowel, voice_obstruent, voiceless_obstruent, vowel])
# vccv_dis2 = Word([vowel, voiceless_obstruent, voice_obstruent, vowel])
vccv_agree_voiceless = Word(
[vowel, voiceless_obstruent, voiceless_obstruent, vowel])
vccv_agree_voiceless2 = Word(
[vowel, voiceless_obstruent, voiceless_obstruent, vowel])
star_agree_double_vowel_examples = [
(vccv_dis1,
single_ranking(faith_voi)),
(vccv_agree_voiceless,
single_ranking(star_above)),
(vccv_agree_voiceless2,
single_ranking(star_above))
]