Skip to content

Commit 8b8c0dd

Browse files
authored
VoSS 3.8
Fixes the articulation ranges in Phonology.py The population now begins with 'size' agents and grows at a constant rate. A few very minor fixes to the graphics.
1 parent 54e73bc commit 8b8c0dd

8 files changed

Lines changed: 1316 additions & 930 deletions

File tree

Agent.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def e2_min():
2121
max_e2 = e2_max()
2222
min_e2 = e2_min()
2323

24-
import Vowel, Word
24+
import Vowel, Word, datetime
2525
from random import uniform, randint
2626

2727
class Agent:
@@ -178,6 +178,7 @@ def guess_by_margin(self, unknown_v):
178178
new_e2 = min_e2
179179

180180
new_v = Vowel.Vowel(new_e1, new_e2, new_length, w)
181+
new_v.set_features(max_e1, max_e2, min_e1, min_e2)
181182
return new_v
182183

183184

@@ -292,7 +293,11 @@ def call_matchers(self, w):
292293
if self.age < 1:
293294
v.weight += .1
294295
if self.prox_margin:
296+
t0 = datetime.datetime.now()
295297
self.settle_conflicts()
298+
t1 = datetime.datetime.now()
299+
dif = t1 - t0
300+
#print(dif)
296301

297302
if self.age > 0: #baby--agents under 1 only hear the vowel
298303
self.word_match(v, w) #child--add word to vocabulary
@@ -1037,10 +1042,17 @@ def dissimilate(self, syllable):
10371042
c1 = P(fm[onset.name])
10381043
c2 = P(fm[coda.name])
10391044
ofl = onset.features
1045+
nfl = nuc.features
10401046
cfl = coda.features
1047+
10411048
for of in ofl:
10421049
ofns = c1.articulations
10431050
nuc = ofns[of]( (onset, nuc, coda), 0, False)
1051+
1052+
for nf in nfl:
1053+
nf_nuc = ofns[nf]((onset, n_nuc, coda), 1, False)
1054+
n_nuc = nf_nuc
1055+
10441056
for cf in cfl:
10451057
cfns = c2.articulations
10461058
nuc = cfns[cf]( (onset, nuc, coda), 2, False)

Convention.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'''Vowel evolution program.
22
Run with Vowel, Prototype, Game_fns, Agent, Word
33
Also import time, random and graphics modules
4-
Last update February 2017 HJMS'''
4+
Last update July 2017 HJMS'''
55

66
import Vowel, Prototype, time, random, Word, re, Agent, Segment
77
from graphics import *
@@ -21,7 +21,7 @@ class Convention:
2121

2222
def __init__(self, show = False, color_on = True, ls = 50):
2323
'''
24-
Can be initialized with no arguments.
24+
Can be initialized with no arguments.d
2525
show == True means more output e.g. step reports.
2626
color_on == True means vowels are color-coded,
2727
where the colors are static according to master set (IPA symbol names).
@@ -51,7 +51,7 @@ def __init__(self, show = False, color_on = True, ls = 50):
5151
self.param_str = "" #center label
5252
self.set_vowels() #creates ipa_dict "master set"
5353
self.plot = self.plot_spots #plot_symbols will use symbols instead
54-
54+
self.func_load_max = 5
5555

5656

5757
def __str__(self):
@@ -337,26 +337,26 @@ def set_vowels(self):
337337
#BACK
338338
new_pro( p_hz(331, 999, 150, "turned_m") ) #unrounded [turned_m]
339339
new_pro( p_hz(331, 999, 250, "turned_m:") ) #unrounded [turned_m:]
340-
new_pro( p_hz(331, 800, 150, "u") ) #rounded [u]
341-
new_pro( p_hz(331, 800, 250, "u:") ) #rounded [u:]
340+
new_pro( p_hz(331, 850, 150, "u") ) #rounded [u]
341+
new_pro( p_hz(331, 850, 250, "u:") ) #rounded [u:]
342342

343343
new_pro( p_hz(405, 1150, 150, "horseshoe") ) #singleton [omega]
344344
new_pro( p_hz(405, 1150, 250, "horseshoe:") ) #singleton [omega:]
345345

346346
new_pro( p_hz(465, 1000, 150, "rams_horn") ) #unrounded [rams_horn]
347347
new_pro( p_hz(465, 1000, 250, "rams_horn:") ) #unrounded [rams_horn:]
348-
new_pro( p_hz(465, 800, 150, "o") ) # rounded [o]
349-
new_pro( p_hz(465, 800, 250, "o:") ) # rounded [o:]
348+
new_pro( p_hz(465, 850, 150, "o") ) # rounded [o]
349+
new_pro( p_hz(465, 850, 250, "o:") ) # rounded [o:]
350350

351351
new_pro( p_hz(600, 1000, 150, "wedge") ) #unrounded [wedge] aka ^
352352
new_pro( p_hz(600, 1000, 250, "wedge:") ) #unrounded [wedge:] aka ^
353-
new_pro( p_hz(600, 800, 150, "open_o") ) #rounded [open_o]
354-
new_pro( p_hz(600, 800, 250, "open_o:") ) #rounded [open_o:]
353+
new_pro( p_hz(600, 850, 150, "open_o") ) #rounded [open_o]
354+
new_pro( p_hz(600, 850, 250, "open_o:") ) #rounded [open_o:]
355355

356356
new_pro( p_hz(734, 1020, 150, "script_a") ) #unrounded [script_a]
357357
new_pro( p_hz(734, 1020, 250, "script_a:") ) #unrounded [script_a:]
358-
new_pro( p_hz(734, 800, 150, "rev_script_a") ) #rounded [rev_script_a]
359-
new_pro( p_hz(734, 800, 250, "rev_script_a:") ) #rounded [rev_script_a:]
358+
new_pro( p_hz(734, 850, 150, "rev_script_a") ) #rounded [rev_script_a]
359+
new_pro( p_hz(734, 850, 250, "rev_script_a:") ) #rounded [rev_script_a:]
360360

361361

362362
############Add new prototypes above this line##############
@@ -446,7 +446,7 @@ def rand_lexicon(self):
446446
#proto balance (functional load)
447447
#should probably seed instead of generating inside the loop.
448448
#ex. ratio_lim = 5 means any proto can have up to 5x as many words as another proto
449-
ratio_lim = 5 # (min_words_vowel) <= number of words in class <= (min_words_vowel * ratio lim)
449+
ratio_lim = self.func_load_max # (min_words_vowel) <= number of words in class <= (min_words_vowel * ratio lim)
450450

451451
for nucleus in p_list:
452452
num_words_vowel = r.randint(min_words_vowel, min_words_vowel*ratio_lim)
@@ -750,7 +750,7 @@ def plot_spots(self, pause = 0, mc = 1, s = None):
750750

751751
#update the printout of prototypes
752752
if self.color_on:
753-
w = self.chart_w+(self.win_margin*2)+125
753+
w = self.chart_w+(self.win_margin*2)+145
754754
message1 = self.side_label("Convention Vowels", w, h_side)
755755
message2 = self.label(self.param_str, h)
756756

@@ -857,7 +857,7 @@ def plot_symbols(self, pause = 0, mc = 1, s = None):
857857

858858
#update the printout of prototypes
859859
if self.color_on:
860-
w = self.chart_w+(self.win_margin*2)+125
860+
w = self.chart_w+(self.win_margin*2)+145
861861
message1 = self.side_label("Convention Vowels", w, h_side)
862862
message2 = self.label(self.param_str, h)
863863

@@ -912,12 +912,12 @@ def plot_symbols(self, pause = 0, mc = 1, s = None):
912912
symb = ipa_trans[p_class] #proto's name (may be unicode)
913913

914914
#black outlines of the symbols
915-
proto_symb_stroke = self.get_symbol_obj(symb, tp, 20, 'gray4', 'bold')
915+
proto_symb_stroke = self.get_symbol_obj(symb, tp, 30, 'gray4', 'bold')
916916
proto_symb_stroke.draw(win)
917917
curr_proto_pts.append(proto_symb_stroke) #store so we can undraw later
918918

919919
if self.color_on:
920-
proto_symb = self.get_symbol_obj(symb, tp, 20, color)
920+
proto_symb = self.get_symbol_obj(symb, tp, 30, color)
921921
proto_symb.draw(win)
922922
curr_proto_pts.append(proto_symb)
923923

@@ -1269,7 +1269,7 @@ def set_formant_limits(self):
12691269
#second formant (x axis)
12701270

12711271
self.e2_closed_max = 24.5
1272-
self.e2_min = 12.25
1272+
self.e2_min = 11.75
12731273
e2_range = self.e2_closed_max - self.e2_min
12741274
self.e2_open_max = self.e2_closed_max - (e2_range/8)
12751275

@@ -1281,7 +1281,7 @@ def set_formant_limits(self):
12811281
#if using color coding, make the window bigger
12821282
co = self.color_on
12831283
if co:
1284-
self.win_width = 1025
1284+
self.win_width = 1100
12851285
self.win_height = 650
12861286
self.win_margin = 40
12871287
self.chart_w = 800 - (self.win_margin*4)
@@ -1310,7 +1310,7 @@ def draw_color_map(self, ipa = False):
13101310
h = self.win_margin
13111311
h2 = h #+ 15
13121312

1313-
w = self.chart_w+(self.win_margin*2)+62
1313+
w = self.chart_w+(self.win_margin*2)+100
13141314

13151315
#check to see if side label has been drawn already
13161316
if not self.proto_label:
@@ -1346,7 +1346,7 @@ def draw_color_map(self, ipa = False):
13461346
ps = ipa_trans[protos[i]]
13471347
else:
13481348
ps = p1
1349-
message2 = self.side_label(ps, w+57, h2)
1349+
message2 = self.side_label(ps, w+70, h2)
13501350

13511351
message2.draw(win)
13521352
circle = Circle(Point(w, h2), 6.5)
@@ -1369,7 +1369,7 @@ def draw_color_map(self, ipa = False):
13691369
ps2 = p2
13701370
w2 = w+155
13711371
p_color = self.color_map[p2]
1372-
message2 = self.side_label(ps2, w2+57, h2)
1372+
message2 = self.side_label(ps2, w2+57, h2)#proto names
13731373
message2.draw(win)
13741374
circle = Circle(Point(w2, h2), 6.5)
13751375
circle.setFill(p_color)
@@ -1388,7 +1388,7 @@ def draw_color_map(self, ipa = False):
13881388
ps = ipa_trans[p1]
13891389
else:
13901390
ps = p1
1391-
message2 = self.side_label(ps, w+57, h2)
1391+
message2 = self.side_label(ps, w+57, h2) #proto names
13921392
message2.draw(win)
13931393
circle = Circle(Point(w, h2), 7)
13941394
circle.setFill(p_color)

0 commit comments

Comments
 (0)