summaryrefslogtreecommitdiff
path: root/grammar.py
diff options
context:
space:
mode:
Diffstat (limited to 'grammar.py')
-rw-r--r--grammar.py59
1 files changed, 30 insertions, 29 deletions
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()
-
-