Skip to content

Commit

Permalink
List comprehension for word text
Browse files Browse the repository at this point in the history
  • Loading branch information
duckduckgrayduck authored Sep 7, 2023
1 parent 5d92aba commit 3ca7f0b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,8 @@ def set_doc_text(self, document, blobs_list):
] # Bottommost y-coordinate

symbols_list = word["symbols"]
# Initialize an empty string to store the full text of the word
full_text = ""
# Concatenate the "text" attribute of each symbol to form the word
for symbol in symbols_list:
full_text += symbol["text"]

full_text = ''.join(symbol["text"] for symbol in symbols_list)

position_info = {
"text": full_text,
"x1": x1,
Expand All @@ -202,10 +198,10 @@ def set_doc_text(self, document, blobs_list):
)

# Set the pages with text and position information to the document
print(pages)
# print(pages) debug
resp = self.client.patch(f"documents/{document.id}/", json={"pages": pages})
print(resp.status_code)
print(resp.json())
# print(resp.status_code) debug
# print(resp.json()) debug

def vision_method(self, document, input_dir, filename):
"""Main method that calls the sub-methods to perform OCR on a doc"""
Expand Down

0 comments on commit 3ca7f0b

Please sign in to comment.