public sealed class TextSegment : IMessage<Document.Types.TextAnchor.Types.TextSegment>, IEquatable<Document.Types.TextAnchor.Types.TextSegment>, IDeepCloneable<Document.Types.TextAnchor.Types.TextSegment>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Document AI v1 API class Document.Types.TextAnchor.Types.TextSegment.
A text segment in the
[Document.text][google.cloud.documentai.v1.Document.text]. The indices
may be out of bounds which indicate that the text extends into another
document shard for large sharded documents. See
[ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
[TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
half open end UTF-8 char index in the
[Document.text][google.cloud.documentai.v1.Document.text].
[TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
start UTF-8 char index in the
[Document.text][google.cloud.documentai.v1.Document.text].
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-19 UTC."],[[["\u003cp\u003eThe latest version of the Document AI v1 API class \u003ccode\u003eDocument.Types.TextAnchor.Types.TextSegment\u003c/code\u003e is 3.19.0, with versions ranging back to 1.0.0 available for reference.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTextSegment\u003c/code\u003e is a class that represents a segment of text within a larger \u003ccode\u003eDocument.text\u003c/code\u003e, and the indices may be out of bounds for sharded documents.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTextSegment\u003c/code\u003e class implements multiple interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes two constructors: one default \u003ccode\u003eTextSegment()\u003c/code\u003e and another \u003ccode\u003eTextSegment(Document.Types.TextAnchor.Types.TextSegment other)\u003c/code\u003e for creating a copy.\u003c/p\u003e\n"],["\u003cp\u003eKey properties within \u003ccode\u003eTextSegment\u003c/code\u003e are \u003ccode\u003eEndIndex\u003c/code\u003e and \u003ccode\u003eStartIndex\u003c/code\u003e, both of type \u003ccode\u003eInt64\u003c/code\u003e, which define the boundaries of the text segment within the document.\u003c/p\u003e\n"]]],[],null,[]]