diff options
| author | Houyhnhnm <hykusb@bitmai.la> | 2018-06-03 13:03:35 +0200 |
|---|---|---|
| committer | Houyhnhnm <hykusb@bitmai.la> | 2018-06-03 13:03:35 +0200 |
| commit | dc5a3bd592f7dda585dc97aa0647b3326b20d8d2 (patch) | |
| tree | 2f511533ae1e4dbc5356ceda52c493069aabf466 | |
| parent | dbd040425b7c066b0803e0f329dd887b11156635 (diff) | |
add generation methods to phonology, morphology classes
| -rw-r--r-- | main.py | 29 | ||||
| -rw-r--r-- | phonology.py | 24 |
2 files changed, 48 insertions, 5 deletions
@@ -6,10 +6,14 @@ from diagram import * modules: cadence.py define musical morphemes +projection.py dependencies and agreement + antecedent or consequent cadence bundled with prolongation rules for each feature - (dominates) or (dominates, agrees) or (dominates, agrees, submits) + (1)==Head; (0)==Complement; (1,0)==XP; (1,1)==XBar; (0,1)==X; (0,0)==None; + diagram.py define binary tree structures -phonology.py distribution of cadential features for given lexicon -lexicon.py repository of lexemes w/ weighted dependency correlations -passage.py cadences from lexicon mapped to tree diagram +phonology.py distribution of cadential features for given grammar +lexicon.py repository of lexemes: (cadence, dependencies, prolongation) +passage.py lexemes unified over tree diagram spellout() sequence of unified cadences in passage (for each voice) score.py list of n passages rendered to music21 score object export() to xml, midi, ly @@ -34,10 +38,25 @@ phonology.addPathRule({ '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() +morphology.print() -lex = phonology.makeCadence(label=1) -lex.print() +lexeme = phonology.makeCadence(label=1) +lexeme.print() syntax = Diagram() syntax.print() diff --git a/phonology.py b/phonology.py index 1853523..55d1cc6 100644 --- a/phonology.py +++ b/phonology.py @@ -98,3 +98,27 @@ class Phonology(object): path['tilt'] = choice(pathRule['tilt']) 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 print(self): + features = { + 'anticipations': self.anticipationRules, + 'prolongations': self.prolongationRules, + } + print("\nMorphology") + pprint(features) + print() + + |