Commit 66973f50 authored by Simon Will's avatar Simon Will
Browse files

Add some more meters

parent b601fdd8
Pipeline #445 failed with stages
......@@ -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'
),
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment