Skip to content

Commit

Permalink
Re-enable removal of facny quotes (#1256)
Browse files Browse the repository at this point in the history
* comment out the rm of special characters

* bump vers

* re-enable text removal for fancy quotation marks
  • Loading branch information
kylepjohnson authored Apr 20, 2024
1 parent 1be4538 commit 8ea1b26
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cltk"
version = "1.2.2"
version = "1.2.5"
description = "The Classical Language Toolkit"
license = "MIT"
authors = ["Kyle P. Johnson <[email protected]>", "Patrick J. Burns <[email protected]>", "John Stewart <[email protected]>", "Todd Cook <[email protected]>", "Clément Besnier <[email protected]>", "William J. B. Mattingly <https://github.com/wjbmattingly>"]
Expand Down
2 changes: 1 addition & 1 deletion src/cltk/alphabet/lat.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def normalize_lat(
text_cltk_normalized: str = cltk_normalize(text=text)
text_cltk_normalized = split_trailing_punct(text=text_cltk_normalized)
text_cltk_normalized = split_leading_punct(text=text_cltk_normalized)
# text_cltk_normalized = remove_odd_punct(text=text_cltk_normalized)
text_cltk_normalized = remove_odd_punct(text=text_cltk_normalized)
if drop_macrons:
text_cltk_normalized = remove_macrons(text_cltk_normalized)
if drop_accents:
Expand Down
2 changes: 1 addition & 1 deletion src/cltk/alphabet/text_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@ def remove_odd_punct(text: str, punctuation: list[str] = None) -> str:
'κατηγόρων, οὐκ οἶδα ἐγὼ δ᾽ οὖν'
"""
if not punctuation:
punctuation = ["‘", "“", ":", "’", "”"]
punctuation = ["‘", "“", "’", "”"]
chars: list[str] = [char for char in text if char not in punctuation]
return "".join(chars)
12 changes: 7 additions & 5 deletions src/cltk/prosody/grc.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ def _long_by_nature(self, syllable: str) -> bool:
vowel_group += char
return bool("".join(vowel_group) in self.diphthongs)

def _long_by_position(self, sentence_index, syllable: str, sentence: list[str]) -> bool:
def _long_by_position(
self, sentence_index, syllable: str, sentence: list[str]
) -> bool:
"""Check if syllable is long by position. Returns ``True``
if syllable is long by position Long by position
includes contexts when:
Expand Down Expand Up @@ -321,10 +323,10 @@ def _scansion(self, sentence_syllables: list[list[str]]) -> list[str]:
scanned_text = list()
for sentence in sentence_syllables:
scanned_sent = list()
for i, syllable in enumerate(sentence):
if self._long_by_position(i, syllable, sentence) or self._long_by_nature(
syllable
):
for i, syllable in enumerate(sentence):
if self._long_by_position(
i, syllable, sentence
) or self._long_by_nature(syllable):
scanned_sent.append("¯")
else:
scanned_sent.append("˘")
Expand Down

0 comments on commit 8ea1b26

Please sign in to comment.