From dc5a3bd592f7dda585dc97aa0647b3326b20d8d2 Mon Sep 17 00:00:00 2001 From: Houyhnhnm Date: Sun, 3 Jun 2018 13:03:35 +0200 Subject: add generation methods to phonology, morphology classes --- main.py | 29 ++++++++++++++++++++++++----- phonology.py | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 3706113..23e7d39 100644 --- a/main.py +++ b/main.py @@ -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() + + -- cgit v1.2.3