/* * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.comprehend.model; import java.io.Serializable; /** *
* Information about each word or line of text in the input document. *
** For additional information, see Block in the Amazon Textract API reference. *
*/ public class Block implements Serializable { /** ** Unique identifier for the block. *
*
* Constraints:
* Length: 1 -
*/
private String id;
/**
*
* The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is one or more * ISO basic Latin script characters that aren't separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are detected on a * document page *
*
* Constraints:
* Allowed Values: LINE, WORD
*/
private String blockType;
/**
*
* The word or line of text extracted from the block. *
*
* Constraints:
* Length: 1 -
*/
private String text;
/**
*
* Page number where the block appears. *
*/ private Integer page; /** ** Co-ordinates of the rectangle or polygon that contains the text. *
*/ private Geometry geometry; /** ** A list of child blocks of the current block. For example, a LINE object * has child blocks for each WORD block that's part of the line of text. *
*/ private java.util.List* Unique identifier for the block. *
*
* Constraints:
* Length: 1 -
*
* @return
* Unique identifier for the block. *
*/ public String getId() { return id; } /** ** Unique identifier for the block. *
*
* Constraints:
* Length: 1 -
*
* @param id
* Unique identifier for the block. *
*/ public void setId(String id) { this.id = id; } /** ** Unique identifier for the block. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 -
*
* @param id
* Unique identifier for the block. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Block withId(String id) { this.id = id; return this; } /** ** The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is one or more * ISO basic Latin script characters that aren't separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are detected on a * document page *
*
* Constraints:
* Allowed Values: LINE, WORD
*
* @return
* The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is one * or more ISO basic Latin script characters that aren't separated * by spaces. *
** LINE - A string of tab-delimited, contiguous words that are * detected on a document page *
** The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is one or more * ISO basic Latin script characters that aren't separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are detected on a * document page *
*
* Constraints:
* Allowed Values: LINE, WORD
*
* @param blockType
* The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is * one or more ISO basic Latin script characters that aren't * separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are * detected on a document page *
** The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is one or more * ISO basic Latin script characters that aren't separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are detected on a * document page *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: LINE, WORD
*
* @param blockType
* The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is * one or more ISO basic Latin script characters that aren't * separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are * detected on a document page *
** The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is one or more * ISO basic Latin script characters that aren't separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are detected on a * document page *
*
* Constraints:
* Allowed Values: LINE, WORD
*
* @param blockType
* The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is * one or more ISO basic Latin script characters that aren't * separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are * detected on a document page *
** The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is one or more * ISO basic Latin script characters that aren't separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are detected on a * document page *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: LINE, WORD
*
* @param blockType
* The block represents a line of text or one word of text. *
** WORD - A word that's detected on a document page. A word is * one or more ISO basic Latin script characters that aren't * separated by spaces. *
** LINE - A string of tab-delimited, contiguous words that are * detected on a document page *
** The word or line of text extracted from the block. *
*
* Constraints:
* Length: 1 -
*
* @return
* The word or line of text extracted from the block. *
*/ public String getText() { return text; } /** ** The word or line of text extracted from the block. *
*
* Constraints:
* Length: 1 -
*
* @param text
* The word or line of text extracted from the block. *
*/ public void setText(String text) { this.text = text; } /** ** The word or line of text extracted from the block. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 -
*
* @param text
* The word or line of text extracted from the block. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Block withText(String text) { this.text = text; return this; } /** ** Page number where the block appears. *
* * @return* Page number where the block appears. *
*/ public Integer getPage() { return page; } /** ** Page number where the block appears. *
* * @param page* Page number where the block appears. *
*/ public void setPage(Integer page) { this.page = page; } /** ** Page number where the block appears. *
** Returns a reference to this object so that method calls can be chained * together. * * @param page
* Page number where the block appears. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Block withPage(Integer page) { this.page = page; return this; } /** ** Co-ordinates of the rectangle or polygon that contains the text. *
* * @return* Co-ordinates of the rectangle or polygon that contains the text. *
*/ public Geometry getGeometry() { return geometry; } /** ** Co-ordinates of the rectangle or polygon that contains the text. *
* * @param geometry* Co-ordinates of the rectangle or polygon that contains the * text. *
*/ public void setGeometry(Geometry geometry) { this.geometry = geometry; } /** ** Co-ordinates of the rectangle or polygon that contains the text. *
** Returns a reference to this object so that method calls can be chained * together. * * @param geometry
* Co-ordinates of the rectangle or polygon that contains the * text. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Block withGeometry(Geometry geometry) { this.geometry = geometry; return this; } /** ** A list of child blocks of the current block. For example, a LINE object * has child blocks for each WORD block that's part of the line of text. *
* * @return* A list of child blocks of the current block. For example, a LINE * object has child blocks for each WORD block that's part of the * line of text. *
*/ public java.util.List* A list of child blocks of the current block. For example, a LINE object * has child blocks for each WORD block that's part of the line of text. *
* * @param relationships* A list of child blocks of the current block. For example, a * LINE object has child blocks for each WORD block that's part * of the line of text. *
*/ public void setRelationships(java.util.Collection* A list of child blocks of the current block. For example, a LINE object * has child blocks for each WORD block that's part of the line of text. *
** Returns a reference to this object so that method calls can be chained * together. * * @param relationships
* A list of child blocks of the current block. For example, a * LINE object has child blocks for each WORD block that's part * of the line of text. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Block withRelationships(RelationshipsListItem... relationships) { if (getRelationships() == null) { this.relationships = new java.util.ArrayList* A list of child blocks of the current block. For example, a LINE object * has child blocks for each WORD block that's part of the line of text. *
** Returns a reference to this object so that method calls can be chained * together. * * @param relationships
* A list of child blocks of the current block. For example, a * LINE object has child blocks for each WORD block that's part * of the line of text. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Block withRelationships(java.util.Collection