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

Updating the conditional of whether to assign a page number. #35

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cpr_sdk/parser_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ def to_passage_level_json(self) -> list[dict[str, Any]]:
]

for passage in passages_array:
page_number = passage.get("page_number")
page_number = passage.get("page_number", None)
passage[PDF_PAGE_METADATA_KEY] = (
self.get_page_metadata_by_page_number(page_number)
if page_number
if page_number is not None
else None
)

Expand Down
2 changes: 1 addition & 1 deletion src/cpr_sdk/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
_MAJOR = "1"
_MINOR = "1"
_PATCH = "4"
_PATCH = "5"
_SUFFIX = ""

VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR)
Expand Down
1 change: 1 addition & 0 deletions tests/test_parser_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def test_to_passage_level_json_method(
)

if passage["document_content_type"] == CONTENT_TYPE_PDF:
assert passage[PDF_PAGE_METADATA_KEY] is not None
assert set(passage["pdf_data"].keys()) == expected_pdf_data_fields
elif passage["document_content_type"] == CONTENT_TYPE_HTML:
assert set(passage["html_data"].keys()) == expected_html_data_fields
Expand Down
Loading