Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Messerschleifer
Allzweckmesser
Commits
66973f50
Commit
66973f50
authored
Sep 26, 2018
by
Simon Will
Browse files
Add some more meters
parent
b601fdd8
Pipeline
#445
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
allzweckmesser/meters.py
View file @
66973f50
...
...
@@ -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'
),
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment