summaryrefslogtreecommitdiff
path: root/spec.py
blob: 84d74fcf9897a8ae33ef7bf846c49258403dcac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
from grammar import *

ligatureRules = [
	[{
		'span': [2],
		'gait': ['double'],
		'foot': [[-1/2, 0, 1/2]],
		'sync': [[0, 1/2], [0, 1/2], [0, 1/2]],
	}],
	[{
		'span': [1],
		'gait': ['double'],
		'foot': [[-1/2, 0, 1/2]],
		'sync': [[0], [0], [0]],
	}],
	[{
		'span': [2],
		'gait': ['double'],
		'foot': [[-1/2, -1/4, 0, 1/2]],
		'sync': [[0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2]],
	}],
	[{
		'span': [1],
		'gait': ['double'],
		'foot': [[-1/2, -1/4, 0, 1/4]],
		'sync': [[0], [0], [0], [0]],
	}],
	[{
		'span': [1],
		'gait': ['double'],
		'foot': [[-1/2, -1/4, 0, 1/2]],
		'sync': [[0], [0], [0], [0]],
	}],
	[{
		'span': [2],
		'gait': ['double'],
		'foot': [[-1/2, -1/4, 0, 1/4]],
		'sync': [[0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2]],
	}],
]

functionRules = [
	{
	'address': ['A1','B1'],
	'transposition': [-1,0],
	},
	{
	'address': ['C1','D1'],
	'transposition': [0,1],
	},
	# {
	# 'address': ['D2','C2'],
	# 'transposition': [0,1],
	# },
	# {
	# 'address': ['E1','E2'],
	# 'transposition': [0,1],
	# },
]

pathRules = [
	{
	'range': [2,3,4],
	'figure': ['zigZagUp', 'zigZagDown'],
	'direction': [-1, 0, 1],
	},
	{
	'range': [5,6,7],
	'figure': ['rampUp'],
	'direction': [-4,-5,-6],
	},
	{
	'range': [5,6,7],
	'figure': ['rampDown'],
	'direction': [4,5,6],
	},
]

anticipationRules = [
	# ['ligature'],
	# ['ligature','direction'],
	# ['ligature','figure'],
	[],
	['direction'],
	['figure'],
]

prolongationRules = [
	['address','figure','range'],
	['address','figure'],
	['address','range'],
	['address'],
	['figure','range'],
	['figure'],
	['range'],
]

# assemble grammar object
phonology = Phonology()
for rule in ligatureRules:
	phonology.addligatureRule(rule)
for rule in functionRules:
	phonology.addFunctionRule(rule)
for rule in pathRules:
	phonology.addPathRule(rule)

morphology = Morphology()
for rule in anticipationRules:
	morphology.addAnticipationRule(rule)
for rule in prolongationRules:
	morphology.addProlongationRule(rule)

g = Grammar()
g.phonology = phonology
g.morphology = morphology