@@ -138,8 +138,8 @@ def __new__(cls, first_page_number, last_page_number):
138
138
return super (FormPageRange , cls ).__new__ (cls , first_page_number , last_page_number )
139
139
140
140
141
- class FormContent (object ):
142
- """Base type which includes properties for text .
141
+ class FormElement (object ):
142
+ """Base type which includes properties for a form element .
143
143
144
144
:ivar str text: The text content of the line.
145
145
:ivar list[~azure.ai.formrecognizer.Point] bounding_box:
@@ -188,10 +188,10 @@ def __repr__(self):
188
188
class FormField (object ):
189
189
"""Represents a field recognized in an input form.
190
190
191
- :ivar ~azure.ai.formrecognizer.FieldText label_data:
192
- Contains the text, bounding box, and text content of the field label.
193
- :ivar ~azure.ai.formrecognizer.FieldText value_data:
194
- Contains the text, bounding box, and text content of the field value.
191
+ :ivar ~azure.ai.formrecognizer.FieldData label_data:
192
+ Contains the text, bounding box, and field elements for the field label.
193
+ :ivar ~azure.ai.formrecognizer.FieldData value_data:
194
+ Contains the text, bounding box, and field elements for the field value.
195
195
:ivar str name: The unique name of the field or label.
196
196
:ivar value:
197
197
The value for the recognized field. Possible types include: 'string',
@@ -212,8 +212,8 @@ def __init__(self, **kwargs):
212
212
@classmethod
213
213
def _from_generated (cls , field , value , read_result ):
214
214
return cls (
215
- label_data = FieldText ._from_generated (field , read_result ),
216
- value_data = FieldText ._from_generated (value , read_result ),
215
+ label_data = FieldData ._from_generated (field , read_result ),
216
+ value_data = FieldData ._from_generated (value , read_result ),
217
217
value = get_field_value (field , value , read_result ),
218
218
name = field ,
219
219
confidence = adjust_confidence (value .confidence ) if value else None ,
@@ -222,8 +222,8 @@ def _from_generated(cls, field, value, read_result):
222
222
@classmethod
223
223
def _from_generated_unlabeled (cls , field , idx , page , read_result ):
224
224
return cls (
225
- label_data = FieldText ._from_generated_unlabeled (field .key , page , read_result ),
226
- value_data = FieldText ._from_generated_unlabeled (field .value , page , read_result ),
225
+ label_data = FieldData ._from_generated_unlabeled (field .key , page , read_result ),
226
+ value_data = FieldData ._from_generated_unlabeled (field .value , page , read_result ),
227
227
value = field .value .text ,
228
228
name = "field-" + str (idx ),
229
229
confidence = adjust_confidence (field .confidence ),
@@ -235,7 +235,7 @@ def __repr__(self):
235
235
)[:1024 ]
236
236
237
237
238
- class FieldText ( FormContent ):
238
+ class FieldData ( FormElement ):
239
239
"""Represents the text that is part of a form field. This includes
240
240
the location of the text in the form and a collection of the
241
241
elements that make up the text.
@@ -248,16 +248,16 @@ class FieldText(FormContent):
248
248
that outlines the text. The points are listed in clockwise
249
249
order: top-left, top-right, bottom-right, bottom-left.
250
250
Units are in pixels for images and inches for PDF.
251
- :ivar text_content :
252
- When `include_text_content ` is set to true, a list of text
251
+ :ivar field_elements :
252
+ When `include_field_elements ` is set to true, a list of
253
253
elements constituting this field or value is returned. The list
254
- constitutes of text elements such as lines and words.
255
- :vartype text_content : list[~azure.ai.formrecognizer.FormWord, ~azure.ai.formrecognizer.FormLine]
254
+ constitutes of elements such as lines and words.
255
+ :vartype field_elements : list[~azure.ai.formrecognizer.FormWord, ~azure.ai.formrecognizer.FormLine]
256
256
"""
257
257
258
258
def __init__ (self , ** kwargs ):
259
- super (FieldText , self ).__init__ (** kwargs )
260
- self .text_content = kwargs .get ("text_content " , None )
259
+ super (FieldData , self ).__init__ (** kwargs )
260
+ self .field_elements = kwargs .get ("field_elements " , None )
261
261
262
262
@classmethod
263
263
def _from_generated (cls , field , read_result ):
@@ -272,7 +272,7 @@ def _from_generated(cls, field, read_result):
272
272
Point (x = field .bounding_box [4 ], y = field .bounding_box [5 ]),
273
273
Point (x = field .bounding_box [6 ], y = field .bounding_box [7 ])
274
274
] if field .bounding_box else None ,
275
- text_content = get_elements (field , read_result ) if field .elements else None
275
+ field_elements = get_elements (field , read_result ) if field .elements else None
276
276
)
277
277
278
278
@classmethod
@@ -286,12 +286,12 @@ def _from_generated_unlabeled(cls, field, page, read_result):
286
286
Point (x = field .bounding_box [4 ], y = field .bounding_box [5 ]),
287
287
Point (x = field .bounding_box [6 ], y = field .bounding_box [7 ])
288
288
] if field .bounding_box else None ,
289
- text_content = get_elements (field , read_result ) if field .elements else None
289
+ field_elements = get_elements (field , read_result ) if field .elements else None
290
290
)
291
291
292
292
def __repr__ (self ):
293
- return "FieldText (page_number={}, text={}, bounding_box={}, text_content ={})" .format (
294
- self .page_number , self .text , self .bounding_box , repr (self .text_content )
293
+ return "FieldData (page_number={}, text={}, bounding_box={}, field_elements ={})" .format (
294
+ self .page_number , self .text , self .bounding_box , repr (self .field_elements )
295
295
)[:1024 ]
296
296
297
297
@@ -315,7 +315,7 @@ class FormPage(object):
315
315
:ivar list[~azure.ai.formrecognizer.FormTable] tables:
316
316
A list of extracted tables contained in a page.
317
317
:ivar list[~azure.ai.formrecognizer.FormLine] lines:
318
- When `include_text_content ` is set to true, a list of recognized text lines is returned.
318
+ When `include_field_elements ` is set to true, a list of recognized text lines is returned.
319
319
For calls to recognize content, this list is always populated. The maximum number of lines
320
320
returned is 300 per page. The lines are sorted top to bottom, left to right, although in
321
321
certain cases proximity is treated with higher priority. As the sorting order depends on
@@ -349,7 +349,7 @@ def __repr__(self):
349
349
)[:1024 ]
350
350
351
351
352
- class FormLine (FormContent ):
352
+ class FormLine (FormElement ):
353
353
"""An object representing an extracted line of text.
354
354
355
355
:ivar str text: The text content of the line.
@@ -388,7 +388,7 @@ def __repr__(self):
388
388
)[:1024 ]
389
389
390
390
391
- class FormWord (FormContent ):
391
+ class FormWord (FormElement ):
392
392
"""Represents a word recognized from the input document.
393
393
394
394
:ivar str text: The text content of the word.
@@ -452,7 +452,7 @@ def __repr__(self):
452
452
)[:1024 ]
453
453
454
454
455
- class FormTableCell (FormContent ):
455
+ class FormTableCell (FormElement ):
456
456
"""Represents a cell contained in a table recognized from the input document.
457
457
458
458
:ivar str text: Text content of the cell.
@@ -471,12 +471,12 @@ class FormTableCell(FormContent):
471
471
:ivar bool is_footer: Whether the current cell is a footer cell.
472
472
:ivar int page_number:
473
473
The 1-based number of the page in which this content is present.
474
- :ivar text_content :
475
- When `include_text_content ` is set to true, a list of text
474
+ :ivar field_elements :
475
+ When `include_field_elements ` is set to true, a list of
476
476
elements constituting this cell is returned. The list
477
- constitutes of text elements such as lines and words.
478
- For calls to recognize content , this list is always populated.
479
- :vartype text_content : list[~azure.ai.formrecognizer.FormWord, ~azure.ai.formrecognizer.FormLine]
477
+ constitutes of elements such as lines and words.
478
+ For calls to begin_recognize_content() , this list is always populated.
479
+ :vartype field_elements : list[~azure.ai.formrecognizer.FormWord, ~azure.ai.formrecognizer.FormLine]
480
480
"""
481
481
482
482
def __init__ (self , ** kwargs ):
@@ -488,7 +488,7 @@ def __init__(self, **kwargs):
488
488
self .confidence = kwargs .get ("confidence" , None )
489
489
self .is_header = kwargs .get ("is_header" , False )
490
490
self .is_footer = kwargs .get ("is_footer" , False )
491
- self .text_content = kwargs .get ("text_content " , None )
491
+ self .field_elements = kwargs .get ("field_elements " , None )
492
492
493
493
@classmethod
494
494
def _from_generated (cls , cell , page , read_result ):
@@ -508,14 +508,14 @@ def _from_generated(cls, cell, page, read_result):
508
508
is_header = cell .is_header or False ,
509
509
is_footer = cell .is_footer or False ,
510
510
page_number = page ,
511
- text_content = get_elements (cell , read_result ) if cell .elements else None
511
+ field_elements = get_elements (cell , read_result ) if cell .elements else None
512
512
)
513
513
514
514
def __repr__ (self ):
515
515
return "FormTableCell(text={}, row_index={}, column_index={}, row_span={}, column_span={}, " \
516
- "bounding_box={}, confidence={}, is_header={}, is_footer={}, page_number={}, text_content ={})" .format (
516
+ "bounding_box={}, confidence={}, is_header={}, is_footer={}, page_number={}, field_elements ={})" .format (
517
517
self .text , self .row_index , self .column_index , self .row_span , self .column_span , self .bounding_box ,
518
- self .confidence , self .is_header , self .is_footer , self .page_number , repr (self .text_content )
518
+ self .confidence , self .is_header , self .is_footer , self .page_number , repr (self .field_elements )
519
519
)[:1024 ]
520
520
521
521
0 commit comments