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
  • Loading branch information
munkhuushmgl authored Nov 11, 2020
1 parent d1e4a53 commit 71987a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion document_ai/snippets/process_document_sample_v1beta3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion document_ai/snippets/quickstart_sample_v1beta3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 71987a6

Please sign in to comment.