-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hey! Thanks for your work on this project. There's a slight issue when getting references to Jonah if it's written as "jon". I didn't look too closely, but I think it's a problem with the regex. This is obviously a super niche error, but I thought I'd mention it anyways.
Input:
import pythonbible as bible
bible.get_references("micah-jon")
# or bible.get_references("jon-jon")
Output:
ValueError: invalid literal for int() with base 10: 'n'
Input:
bible.get_references("obadiah-jon")
bible.get_references("jon-john")
Output:
[NormalizedReference(book=<Book.OBADIAH: 31>, start_chapter=None, start_verse=None, end_chapter=None, end_verse=None, end_book=<Book.JONAH: 32>)]
[NormalizedReference(book=<Book.JONAH: 32>, start_chapter=None, start_verse=None, end_chapter=None, end_verse=None, end_book=<Book.JOHN: 43>)]
Here's a quick fix, but there might be a better one.
Old:
_JOHN_REGULAR_EXPRESSION = r"(John|Joh\.*|Jhn\.*|Jo\.*(?!shua|b|nah|el)|Jn\.*)"
New:
_JOHN_REGULAR_EXPRESSION = r"(John|Joh\.*|Jhn\.*|Jo\.*(?!shua|b|nah|el|n)|Jn\.*)"
Metadata
Metadata
Assignees
Labels
No labels