Commit 5c5104b
refactor: Updates to Document AI Python Samples (#323)
* Updated OCR Quickstart Sample
Added Types to Request Creation
Added ClientOptions object for type safety
Simplified output code to print full text instead of paragraphs
Updated Link to Document Object v1 specification
Added mime_type as variable
* Updates to process_document_sample
- Same Updates as Quickstart Sample
- Moved Imports to top of quickstart file
* Updated Batch Process Example
- Added typing
- Use BatchProcessMetadata instead of Operation ID to get output files from GCS
- Added MimeType specification
- Added Alternatives for Directory Processing & Callbacks
- Minor Changes to process_document/quickstart for unified style with batch
* Updates to OCR Response Handling Sample
- Separated Online Processing Request into function
- Added explicit typing for documentai objects
- Converted `.format()` to f-string
- Simplified `layout_to_text()`
* Updated Form Processing Sample
- Updated to `v1` API
- Separated processing request into function
- Added explicit typing for Document AI Types
- Separated `print_table_rows()` into function for modularity
- Fixed Spelling error "Collumns"
* Updated Specialized Processor Sample
- Added Extraction of Properties (Nested Entities) and Normalized Values
* Updates to Splitter/Classifier Sample
- Updated to `v1` API
- Changed Page Numeber Printout
- (Splitter Classifiers now output all page numbers within a subdocument, instead of just the first and last)
* Updated Test for process_document_sample
- Added mime_type
* Updated Document Quality Processor Sample
- Updated to `v1` API
- Moved API Call to separate function
- Updated `.format()` to f-strings
- Added Handling for Multiple Page Numbers per entity
- Reused `page_refs_to_string()` from splitter/classifier example
- Added `mime_type` as parameter
* Updated Batch Processing Directory sample variable from CR comments
* Added Sample Input PDF Files & Output JSON Files
* Fixed Spelling Error in Invoice Parser Output filenames
* Addressed Code Review Comments
- Changed Copyright Year back to 2020
- Changed "property" variable to "prop" to avoid naming conflicts
* Updated Client Library Requirements versions
* Addressed Unit Test Failures
* Re-added google-api-core to requirements.txt
* Update samples/snippets/process_document_form_sample.py
Co-authored-by: Anthonios Partheniou <[email protected]>
* Update samples/snippets/requirements.txt
Co-authored-by: Anthonios Partheniou <[email protected]>
* Fixed "entirity" spelling error
Co-authored-by: Gal Zahavi <[email protected]>
Co-authored-by: Anthonios Partheniou <[email protected]>1 parent ace73f6 commit 5c5104b
File tree
58 files changed
+462989
-392
lines changed- documentai/snippets
- resources/sample_output
- input_files
- output_files_full
- output_files_short
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
58 files changed
+462989
-392
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
52 | 51 | | |
53 | 52 | | |
54 | | - | |
55 | | - | |
| 53 | + | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
61 | 69 | | |
62 | 70 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
66 | 80 | | |
67 | 81 | | |
68 | 82 | | |
69 | 83 | | |
70 | 84 | | |
| 85 | + | |
71 | 86 | | |
72 | 87 | | |
73 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
74 | 92 | | |
75 | 93 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
81 | 100 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
86 | 104 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 105 | + | |
| 106 | + | |
91 | 107 | | |
92 | | - | |
93 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
94 | 142 | | |
95 | 143 | | |
96 | | - | |
| 144 | + | |
97 | 145 | | |
98 | 146 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 147 | + | |
| 148 | + | |
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | | - | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments