From 2a6446bd77f0e330784d14a291d6db7b9bee91df Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Sat, 9 Jun 2018 15:17:03 +0200 Subject: reprojected features don't inherit value --- grammar.py | 59 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'grammar.py') diff --git a/grammar.py b/grammar.py index 44ad7d8..e908730 100644 --- a/grammar.py +++ b/grammar.py @@ -10,8 +10,37 @@ class Grammar(object): self.syntax = syntax + +class Morphology(object): + + def __init__(self): + self.anticipationRules = [] + self.prolongationRules = [] + + def addAnticipationRule(self, projectedFeatures): + self.anticipationRules.append(projectedFeatures) + + def addProlongationRule(self, projectedFeatures): + self.prolongationRules.append(projectedFeatures) + + def selectAnticipation(self): + return choice(self.anticipationRules) + + def selectProlongation(self): + return choice(self.prolongationRules) + + def print(self): + features = { + 'anticipations': self.anticipationRules, + 'prolongations': self.prolongationRules, + } + print("\nMorphology") + pprint(features) + print() + + class Phonology(object): - """weighted repository of rhythmic, harmonic and gestural features""" + """weighted repository of rhythmic, harmonic and gestural features, and feature dependencies""" def __init__(self, ligatures=[], functions=[], paths=[]): self.ligatures = ligatures @@ -108,31 +137,3 @@ class Phonology(object): return path -class Morphology(object): - - def __init__(self): - self.anticipationRules = [] - self.prolongationRules = [] - - def addAnticipationRule(self, projectedFeatures): - self.anticipationRules.append(projectedFeatures) - - def addProlongationRule(self, projectedFeatures): - self.prolongationRules.append(projectedFeatures) - - def selectAnticipation(self): - return choice(self.anticipationRules) - - def selectProlongation(self): - return choice(self.prolongationRules) - - def print(self): - features = { - 'anticipations': self.anticipationRules, - 'prolongations': self.prolongationRules, - } - print("\nMorphology") - pprint(features) - print() - - -- cgit v1.2.3