diff options
| author | Houyhnhnm <hykusb@bitmai.la> | 2018-06-03 18:47:29 +0200 |
|---|---|---|
| committer | Houyhnhnm <hykusb@bitmai.la> | 2018-06-03 18:47:29 +0200 |
| commit | 01071c8123e6b30eeff88272bf4fc7325d62dd5a (patch) | |
| tree | 9598b4cc53546df62804e672e3c14215edf8ee94 /grammar.py | |
| parent | 3786e330479d00517ecb894804180f59b0544e1a (diff) | |
added syntax tree generation, feature unification
Diffstat (limited to 'grammar.py')
| -rw-r--r-- | grammar.py | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -2,16 +2,12 @@ from cadence import * from numpy import array from numpy.random import choice, seed - - class Grammar(object): def __init__(self, phonology=None, morphology=None, syntax=None): - self.phonology - self.morphology - self.syntax - - + self.phonology = phonology + self.morphology = morphology + self.syntax = syntax class Phonology(object): @@ -124,6 +120,12 @@ class Morphology(object): 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, |