summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lexicon.py63
-rw-r--r--main.py32
2 files changed, 64 insertions, 31 deletions
diff --git a/lexicon.py b/lexicon.py
new file mode 100644
index 0000000..7cd27c4
--- /dev/null
+++ b/lexicon.py
@@ -0,0 +1,63 @@
+from phonology import *
+from numpy.random import choice, seed
+
+class Lexicon(object):
+ def makeLexeme(self):
+ def makeProjection(self):
+
+class Lexeme(object):
+ """the specification of an dependant and its agreement"""
+ def __init__(self, cadence=None, antecedent=None, consequent=None):
+ if cadence=None:
+ self.cadence = cadence
+ # lexemes
+ self.antecedents = []
+ self.consequents = []
+ # projections
+ self.anticipations = []
+ self.prolongations = []
+
+ # self.label -- manage serial numbers somehow
+
+ def addAntecedent(self, category):
+ self.antecedents.append(category)
+ return self
+
+ def addConsequent(self, category):
+ self.consequents.append(category)
+ return self
+
+ def addAnticipation(self, projection):
+ self.anticipations.append(projection)
+ return self
+
+ def addProlongation(self, projection):
+ self.prolongations.append(projection)
+ return self
+
+
+ def selectAntecedent(self):
+ antecedent = None
+ if len(self.antecedents>0):
+ antecedent = choice(self.antecedents)
+ return antecedent
+
+ def selectConsequent(self):
+ consequent = None
+ if len(self.consequents>0):
+ consequent = choice(self.consequents)
+ return consequent
+
+ def selectAnticipation(self):
+ anticipation = None
+ if len(self.anticipations>0):
+ anticipation = choice(self.anticipations)
+ return anticipation
+
+ def selectProlongation(self):
+ prolongation = None
+ if len(self.prolongations>0):
+ prolongation = choice(self.prolongations)
+ return prolongation
+
+
diff --git a/main.py b/main.py
index 23e7d39..e92ebb0 100644
--- a/main.py
+++ b/main.py
@@ -1,6 +1,6 @@
from phonology import *
from diagram import *
-
+from grammar import *
'''
modules:
@@ -20,36 +20,6 @@ score.py list of n passages rendered to music21 score object
'''
-phonology = Phonology()
-
-phonology.addFootprintRule([{
- 'span': [2],
- 'gait': ['double','triple'],
- 'foot': [[-1/2, 0, 1/2]],
- 'step': [[0, 1/2], [0, 1/2], [0, 1/2]],
-}])
-phonology.addFunctionRule({
- 'address': ['A1','B1'],
- 'transposition': [-1,0,1],
-})
-phonology.addPathRule({
- 'range': [2,3,4],
- 'figure': ['rampUp', 'rampDown'],
- 'tilt': ['float', 'dive'],
-})
-
-morphology = Morphology()
-morphology.addAnticipationRule(['footprint'])
-morphology.addAnticipationRule(['tilt'])
-morphology.addAnticipationRule([])
-morphology.addProlongationRule(['address','transposition'])
-morphology.addProlongationRule(['address'])
-morphology.addProlongationRule(['figure','range'])
-morphology.addProlongationRule(['range'])
-morphology.addProlongationRule(['range','tilt'])
-
-
-
# lexicon.addCategory()
phonology.print()