diff --git a/allzweckmesser/meters.py b/allzweckmesser/meters.py index 11ecd48c5695e391646ef4c0d87bf913e687bd3c..fdfcc9d4c042f527f0e1bc8b18ec833ec0b3f4e0 100644 --- a/allzweckmesser/meters.py +++ b/allzweckmesser/meters.py @@ -17,7 +17,7 @@ def caesurae_together(position_specs, reward): return get_reward -def bridge(position, reward): +def bridge(position_spec, reward): def get_reward(meter: Meter, reading: Reading): position = Position.after(position_spec[0], reading, meter, position_spec[1]) @@ -46,6 +46,8 @@ class Meter: return sum(cond(reading) for cond in self.conditions) +AEOLIC_BASE = r'(?:(–)(–)|(–)(â‘)|(â‘)(–))' + ALL_METERS = { 'Catalectic Dactylic Hexameter': Meter( @@ -60,6 +62,14 @@ ALL_METERS = { }, short_name='6da‸' ), + 'Dactylic Pentameter': Meter( + 'Dactylic Pentameter', + r'(–)(â‘â‘|–)(–)(â‘â‘|–)(–)(–)(â‘â‘)(–)(â‘â‘)(â‘|–)', + conditions={ + caesurae_together([('mora', 5, 'Middle diaresis')], 2) + }, + short_name='3da‸3da‸' + ), 'Iambic Trimeter': Meter( 'Iambic Trimeter', r'(â‘|â‘â‘|–)(â‘â‘|–)(â‘)(â‘â‘|–)(â‘|â‘â‘|–)(â‘â‘|–)(â‘)(â‘â‘|–)(â‘|â‘â‘|–)(â‘â‘|–)(â‘)(â‘|–)', @@ -69,4 +79,28 @@ ALL_METERS = { }, short_name='3ia' ), + 'Iambic Senarius': Meter( + 'Iambic Senarius', + r'(â‘|â‘â‘|–)(â‘â‘|–)(â‘|â‘â‘|–)(â‘â‘|–)(â‘|â‘â‘|–)(â‘â‘|–)(â‘|â‘â‘|–)(â‘â‘|–)(â‘|â‘â‘|–)(â‘â‘|–)(â‘)(â‘|–)', + short_name='6ia' + ), + 'Sapphic Hendecasyllable': Meter( + 'Sapphic Hendecasyllable', + r'(–)(–|â‘)(–)(–|â‘)(–)(â‘)(â‘)(–)(â‘)(–)(â‘|–)', + conditions={}, + short_name='sap hen' + ), + 'Adoneus': Meter( + 'Adoneus', + r'(–)(â‘â‘)(–)(â‘|–)', + short_name='adoneus', + ), + 'Phalaecian Hendecasyllable': Meter( + 'Phalaecian Hendecasyllable', + AEOLIC_BASE + r'(–)(â‘)(â‘)(–)(â‘)(–)(â‘)(–)(â‘|–)', + conditions={ + caesurae_together([('element', 6, 'After sixth element')], 1) + }, + short_name='hen' + ), }