| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Collections.Generic; |
| | 5 | |
|
| | 6 | | namespace Azure.AI.FormRecognizer.Models |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Represents a cell contained in a table recognized from the input document. |
| | 10 | | /// </summary> |
| | 11 | | public class FormTableCell : FormElement |
| | 12 | | { |
| | 13 | | internal FormTableCell(DataTableCell dataTableCell, IReadOnlyList<ReadResult> readResults, int pageNumber) |
| 2440 | 14 | | : base(new BoundingBox(dataTableCell.BoundingBox), pageNumber, dataTableCell.Text) |
| | 15 | | { |
| 2440 | 16 | | ColumnIndex = dataTableCell.ColumnIndex; |
| 2440 | 17 | | ColumnSpan = dataTableCell.ColumnSpan ?? 1; |
| 2440 | 18 | | Confidence = dataTableCell.Confidence; |
| 2440 | 19 | | IsFooter = dataTableCell.IsFooter ?? false; |
| 2440 | 20 | | IsHeader = dataTableCell.IsHeader ?? false; |
| 2440 | 21 | | RowIndex = dataTableCell.RowIndex; |
| 2440 | 22 | | RowSpan = dataTableCell.RowSpan ?? 1; |
| 2440 | 23 | | FieldElements = dataTableCell.Elements != null |
| 2440 | 24 | | ? FormField.ConvertTextReferences(dataTableCell.Elements, readResults) |
| 2440 | 25 | | : new List<FormElement>(); |
| 2440 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// The column index of the cell. |
| | 30 | | /// </summary> |
| 2552 | 31 | | public int ColumnIndex { get; } |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// The number of columns spanned by this cell. |
| | 35 | | /// </summary> |
| 2240 | 36 | | public int ColumnSpan { get; } |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Measures the degree of certainty of the recognition result. Value is between [0.0, 1.0]. |
| | 40 | | /// </summary> |
| 4344 | 41 | | public float Confidence { get; } |
| | 42 | |
|
| | 43 | | /// <summary> |
| | 44 | | /// <c>true</c> if this cell is a footer cell. Otherwise, <c>false</c>. |
| | 45 | | /// </summary> |
| 136 | 46 | | public bool IsFooter { get; } |
| | 47 | |
|
| | 48 | | /// <summary> |
| | 49 | | /// <c>true</c> if this cell is a header cell. Otherwise, <c>false</c>. |
| | 50 | | /// </summary> |
| 136 | 51 | | public bool IsHeader { get; } |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// The row index of this cell. |
| | 55 | | /// </summary> |
| 2672 | 56 | | public int RowIndex { get; } |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// The number of rows spanned by this cell. |
| | 60 | | /// </summary> |
| 2240 | 61 | | public int RowSpan { get; } |
| | 62 | |
|
| | 63 | | /// <summary> |
| | 64 | | /// When `IncludeFieldElements` is set to <c>true</c>, a list of references to |
| | 65 | | /// the field elements constituting this cell is returned. An empty list otherwise. For calls to recognize conte |
| | 66 | | /// list is always populated. |
| | 67 | | /// </summary> |
| 4720 | 68 | | public IReadOnlyList<FormElement> FieldElements { get; } |
| | 69 | | } |
| | 70 | | } |