Skip to content

Commit

Permalink
chores: fixed small issue with start index problem (#56)
Browse files Browse the repository at this point in the history
* chores: fixed small issue with start index problem

* added missing update
munkhuushmgl authored and dandhlee committed Jan 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0db8d69 commit 97b52b8
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ def get_text(doc_element: dict, document: dict):
for segment in doc_element.text_anchor.text_segments:
start_index = (
int(segment.start_index)
if "start_index" in doc_element.text_anchor.__dict__
if segment in doc_element.text_anchor.text_segments
else 0
)
end_index = int(segment.end_index)
2 changes: 1 addition & 1 deletion documentai/snippets/process_document_sample_v1beta3.py
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ def get_text(doc_element: dict, document: dict):
for segment in doc_element.text_anchor.text_segments:
start_index = (
int(segment.start_index)
if segment.start_index in doc_element.text_anchor.text_segments
if segment in doc_element.text_anchor.text_segments
else 0
)
end_index = int(segment.end_index)
2 changes: 1 addition & 1 deletion documentai/snippets/quickstart_sample_v1beta3.py
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ def get_text(doc_element: dict, document: dict):
for segment in doc_element.text_anchor.text_segments:
start_index = (
int(segment.start_index)
if segment.start_index in doc_element.text_anchor.text_segments
if segment in doc_element.text_anchor.text_segments
else 0
)
end_index = int(segment.end_index)

0 comments on commit 97b52b8

Please sign in to comment.