Skip to content

Commit

Permalink
Merge pull request #124 from linhd-postdata/fix/output
Browse files Browse the repository at this point in the history
Fix output
  • Loading branch information
alvp authored Sep 13, 2021
2 parents 8cf17cb + 765b897 commit 4847a0c
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 18 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ Changelog
=========


0.7.0 (2021-01-28)
0.7.1 (2021-09-13)
------------------

* Fix output.

0.7.0 (2021-09-13)
------------------

* Added option to generate a new output format, compliant with POSTDATA ontology.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.0
current_version = 0.7.1
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def read(*names, **kwargs):

setup(
name='rantanplan',
version='0.7.0',
version='0.7.1',
license='Apache Software License 2.0',
description='Scansion tool for Spanish texts',
long_description='%s\n%s' % (
Expand Down
2 changes: 1 addition & 1 deletion src/rantanplan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.7.0'
__version__ = '0.7.1'
from .core import get_scansion # noqa
6 changes: 4 additions & 2 deletions src/rantanplan/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,8 @@ def _get_scansion(text, rhyme_analysis=False, rhythm_format="pattern",
break
if not pos_output:
remove_pos_from_output(lines)
scansion = remove_exact_length_matches(lines)
# scansion = remove_exact_length_matches(lines)
scansion = lines
if alternative_output\
and split_stanzas_on is not None\
and rhyme_analysis\
Expand Down Expand Up @@ -1018,6 +1019,7 @@ def transform_scansion(scansion, text):
new_line = copy.deepcopy(scheme["stanzaList"][0]["lineList"][0])
tokens, _, rhythm, structure, rhyme, ending, ending_stress, \
rhyme_type, rhyme_relaxation = [v for v in line.values()]
print(rhythm)
phonological_list = []
for pg in line["phonological_groups"]:
phonological_dict = copy.deepcopy(
Expand Down Expand Up @@ -1087,7 +1089,7 @@ def transform_scansion(scansion, text):
"ending": ending,
"rhymeGrapheme": ending,
"typeOfRhymeMatching": rhyme_type,
"endingStressedVowel": ending[ending_stress],
"endingStressedVowel": ending[ending_stress] if ending else None,
})
new_line.update({
"relativeLineNumber": line_idx + 1,
Expand Down
18 changes: 15 additions & 3 deletions tests/fixtures/haiku.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@
"rhythm": {
"stress": "+--+-",
"type": "pattern",
"length": 5
"length": 5,
"length_range": {
"min_length": 5,
"max_length": 5
}
},
"structure": "haiku",
"rhyme": "a",
Expand Down Expand Up @@ -167,7 +171,11 @@
"rhythm": {
"stress": "---+-+-",
"type": "pattern",
"length": 7
"length": 7,
"length_range": {
"min_length": 7,
"max_length": 7
}
},
"structure": "haiku",
"rhyme": "a",
Expand Down Expand Up @@ -248,7 +256,11 @@
"rhythm": {
"stress": "-+-+-",
"type": "pattern",
"length": 5
"length": 5,
"length_range": {
"min_length": 5,
"max_length": 5
}
},
"structure": "haiku",
"rhyme": "-",
Expand Down
6 changes: 5 additions & 1 deletion tests/fixtures/scansion_sonnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,11 @@
"rhythm": {
"stress": "---+-+-",
"type": "pattern",
"length": 7
"length": 7,
"length_range": {
"min_length": 7,
"max_length": 7
}
},
"structure": "unknown",
"rhyme": "-",
Expand Down
48 changes: 40 additions & 8 deletions tests/fixtures/sonnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@
"rhythm": {
"stress": "-+-+-+---+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "a",
Expand Down Expand Up @@ -287,7 +291,11 @@
"rhythm": {
"stress": "-+---+-+-+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "b",
Expand Down Expand Up @@ -626,7 +634,11 @@
"rhythm": {
"stress": "-+-+-+---+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "a",
Expand Down Expand Up @@ -786,7 +798,11 @@
"rhythm": {
"stress": "+--+-+---+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "a",
Expand Down Expand Up @@ -928,7 +944,11 @@
"rhythm": {
"stress": "+--+---+-+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "b",
Expand Down Expand Up @@ -1257,7 +1277,11 @@
"rhythm": {
"stress": "---+-++--+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "a",
Expand Down Expand Up @@ -1409,7 +1433,11 @@
"rhythm": {
"stress": "-+-+-++--+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "c",
Expand Down Expand Up @@ -2060,7 +2088,11 @@
"rhythm": {
"stress": "--+--+---+-",
"type": "pattern",
"length": 11
"length": 11,
"length_range": {
"min_length": 11,
"max_length": 11
}
},
"structure": "sonnet",
"rhyme": "c",
Expand Down

0 comments on commit 4847a0c

Please sign in to comment.