Skip to content

Commit

Permalink
fix the overtext extraction where overlaps start with an odd numbered…
Browse files Browse the repository at this point in the history
… unit
  • Loading branch information
catsmith committed Mar 23, 2024
1 parent 6fe666f commit e69215c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def get_lemma_text(self, overtext, start, end):
end = int(end)
if start == end and start % 2 == 1:
return ['', 'om']
if start % 2 == 1:
start += 1
real_start = int(start/2)-1
real_end = int(end/2)-1
if real_start < 0:
Expand Down
8 changes: 8 additions & 0 deletions tests_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,14 @@ def test_get_lemma_text_defaults(self):
generated_text = exp.get_lemma_text(overtext, '24', '24')
self.assertEqual(expected_text, generated_text)

expected_text = ['αὐτοῦ ἐν ἐμοί ἵνα εὐαγγελίζωμαι αὐτὸν ἐν']
generated_text = exp.get_lemma_text(overtext, '7', '20')
self.assertEqual(expected_text, generated_text)

expected_text = ['αὐτοῦ ἐν ἐμοί ἵνα εὐαγγελίζωμαι αὐτὸν ἐν']
generated_text = exp.get_lemma_text(overtext, '8', '21')
self.assertEqual(expected_text, generated_text)

# test where there is no data
expected_text = ['', 'om']
generated_text = exp.get_lemma_text(overtext, '27', '27')
Expand Down

0 comments on commit e69215c

Please sign in to comment.