Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential issue with duplicated verses in references #169

Open
christopherpickering opened this issue Jun 22, 2024 · 2 comments
Open

Potential issue with duplicated verses in references #169

christopherpickering opened this issue Jun 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@christopherpickering
Copy link

Thanks again for this, I'm getting a lot of use :)

I found another potential issue. When a set of text has repeating references, they are grouped by book, but it seems not by chapter or verse. Meaning that the formatted output has duplicate verses. Here's an example, notice the refs for John and Hebrews for dupe verses, and Genesis for dupe chapter. I added a dupe remove on the verse id's to get the output I was expecting:

import pythonbible as bible

text ='Jeremiah 10:11-12;John 1:1;Hebrews 1:8-12;Genesis 1:1,2:4,2:7;Malachi 3:18;John 1:1;Psalms 33:6,9,136:5;John 1:1-3;Colossians 1:16-17;Hebrews 1:8-10,11:3'

references = bible.get_references(text)
formatted = bible.format_scripture_references(references)

print(formatted)

# list and set to remove dups
verse_ids = list(set(bible.convert_references_to_verse_ids(references)))

new_references = bible.convert_verse_ids_to_references(verse_ids)
formatted_2 = bible.format_scripture_references(new_references)

print(formatted_2)

output:

# initial output
Genesis 1:1,2:4,2:7;Psalms 33:6,9,136:5;Jeremiah 10:11-12;Malachi 3:18;John 1:1,1,1-3;Colossians 1:16-17;Hebrews 1:8,8-9,9-10,10-12,11:3

# with dupes manually removed list(set(...)) on verse_ids
Genesis 1:1,2:4,2:7;Psalms 33:6,9,136:5;Jeremiah 10:11-12;Malachi 3:18;John 1:1-3;Colossians 1:16-17;Hebrews 1:8-12,11:3
@avendesora
Copy link
Owner

Thanks for reporting this and sorry for the delay. It's been a busy summer. This is something we should fix, and I'll hopefully be able to start on that soon.

@avendesora avendesora self-assigned this Jul 30, 2024
@avendesora avendesora added the bug Something isn't working label Jul 30, 2024
@christopherpickering
Copy link
Author

Thanks!

Since then I found another possible issue (or preference :) ), you can see it in the 2nd output:

# with dupes manually removed list(set(...)) on verse_ids
Genesis 1:1,2:4,2:7;Psalms 33:6,9,136:5;Jeremiah 10:11-12;Malachi 3:18;John 1:1-3;Colossians 1:16-17;Hebrews 1:8-12,11:3

# the first ref should maybe be..?... 
Genesis 1:1,2:4,7

Nested commas get tricky tho. I just did a regex in my out and swapped commas to semi colons, then added in the comma between verses in the same ch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants