File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
vision/cloud-client/detect Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,29 @@ def async_detect_document(gcs_source_uri, gcs_destination_uri):
92
92
first_page_response = response .responses [0 ]
93
93
94
94
# Print the full text from the first page.
95
- # The response additionally includes individual detected symbol's
96
- # confidence and bounding box.
97
95
print (u'Full text:\n {}' .format (
98
96
first_page_response .full_text_annotation .text ))
99
97
98
+ # The response additionally includes individual detected symbol's
99
+ # confidence and bounding box.
100
+ for page in first_page_response .full_text_annotation .pages :
101
+ for block in page .blocks :
102
+ print ('\n Block confidence: {}\n ' .format (block .confidence ))
103
+
104
+ for paragraph in block .paragraphs :
105
+ print ('Paragraph confidence: {}' .format (
106
+ paragraph .confidence ))
107
+
108
+ for word in paragraph .words :
109
+ word_text = '' .join ([
110
+ symbol .text for symbol in word .symbols
111
+ ])
112
+ print (u'Word text: {} (confidence: {})' .format (
113
+ word_text , word .confidence ))
114
+
115
+ for symbol in word .symbols :
116
+ print (u'\t Symbol: {} (confidence: {})' .format (
117
+ symbol .text , symbol .confidence ))
100
118
# [END vision_async_detect_document_ocr]
101
119
102
120
You can’t perform that action at this time.
0 commit comments