Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
feat: add content field in TextAnchor (#787)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 435142243

Source-Link: googleapis/googleapis@721b367

Source-Link: googleapis/googleapis-gen@b627aae
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjYyN2FhZWIzYWZhZmU3ZDk0ZDYwOTlhMmQxOTQ1YWE5YjRkYWRhZCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Mar 17, 2022
1 parent 982d772 commit a0b46b5
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 21 deletions.
Expand Up @@ -35347,6 +35347,33 @@ public interface TextAnchorOrBuilder
*/
com.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegmentOrBuilder
getTextSegmentsOrBuilder(int index);

/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @return The content.
*/
java.lang.String getContent();
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @return The bytes for content.
*/
com.google.protobuf.ByteString getContentBytes();
}
/**
*
Expand All @@ -35369,6 +35396,7 @@ private TextAnchor(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {

private TextAnchor() {
textSegments_ = java.util.Collections.emptyList();
content_ = "";
}

@java.lang.Override
Expand Down Expand Up @@ -35416,6 +35444,13 @@ private TextAnchor(
extensionRegistry));
break;
}
case 18:
{
java.lang.String s = input.readStringRequireUtf8();

content_ = s;
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
Expand Down Expand Up @@ -36217,6 +36252,57 @@ public com.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment getTe
return textSegments_.get(index);
}

public static final int CONTENT_FIELD_NUMBER = 2;
private volatile java.lang.Object content_;
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @return The content.
*/
@java.lang.Override
public java.lang.String getContent() {
java.lang.Object ref = content_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
content_ = s;
return s;
}
}
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @return The bytes for content.
*/
@java.lang.Override
public com.google.protobuf.ByteString getContentBytes() {
java.lang.Object ref = content_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
content_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -36234,6 +36320,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
for (int i = 0; i < textSegments_.size(); i++) {
output.writeMessage(1, textSegments_.get(i));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(content_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, content_);
}
unknownFields.writeTo(output);
}

Expand All @@ -36246,6 +36335,9 @@ public int getSerializedSize() {
for (int i = 0; i < textSegments_.size(); i++) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, textSegments_.get(i));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(content_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, content_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -36263,6 +36355,7 @@ public boolean equals(final java.lang.Object obj) {
(com.google.cloud.documentai.v1beta2.Document.TextAnchor) obj;

if (!getTextSegmentsList().equals(other.getTextSegmentsList())) return false;
if (!getContent().equals(other.getContent())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
Expand All @@ -36278,6 +36371,8 @@ public int hashCode() {
hash = (37 * hash) + TEXT_SEGMENTS_FIELD_NUMBER;
hash = (53 * hash) + getTextSegmentsList().hashCode();
}
hash = (37 * hash) + CONTENT_FIELD_NUMBER;
hash = (53 * hash) + getContent().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -36434,6 +36529,8 @@ public Builder clear() {
} else {
textSegmentsBuilder_.clear();
}
content_ = "";

return this;
}

Expand Down Expand Up @@ -36471,6 +36568,7 @@ public com.google.cloud.documentai.v1beta2.Document.TextAnchor buildPartial() {
} else {
result.textSegments_ = textSegmentsBuilder_.build();
}
result.content_ = content_;
onBuilt();
return result;
}
Expand Down Expand Up @@ -36550,6 +36648,10 @@ public Builder mergeFrom(com.google.cloud.documentai.v1beta2.Document.TextAnchor
}
}
}
if (!other.getContent().isEmpty()) {
content_ = other.content_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
Expand Down Expand Up @@ -36998,6 +37100,117 @@ public Builder removeTextSegments(int index) {
return textSegmentsBuilder_;
}

private java.lang.Object content_ = "";
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @return The content.
*/
public java.lang.String getContent() {
java.lang.Object ref = content_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
content_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @return The bytes for content.
*/
public com.google.protobuf.ByteString getContentBytes() {
java.lang.Object ref = content_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
content_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @param value The content to set.
* @return This builder for chaining.
*/
public Builder setContent(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}

content_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @return This builder for chaining.
*/
public Builder clearContent() {

content_ = getDefaultInstance().getContent();
onChanged();
return this;
}
/**
*
*
* <pre>
* Contains the content of the text span so that users do
* not have to look it up in the text_segments.
* </pre>
*
* <code>string content = 2;</code>
*
* @param value The bytes for content to set.
* @return This builder for chaining.
*/
public Builder setContentBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);

content_ = value;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
Expand Down
Expand Up @@ -142,7 +142,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "le/cloud/documentai/v1beta2/geometry.pro"
+ "to\032\027google/rpc/status.proto\032\027google/type"
+ "/color.proto\032\034google/api/annotations.pro"
+ "to\"\302+\n\010Document\022\r\n\003uri\030\001 \001(\tH\000\022\021\n\007conten"
+ "to\"\323+\n\010Document\022\r\n\003uri\030\001 \001(\tH\000\022\021\n\007conten"
+ "t\030\002 \001(\014H\000\022\021\n\tmime_type\030\003 \001(\t\022\014\n\004text\030\004 \001"
+ "(\t\022D\n\013text_styles\030\005 \003(\0132/.google.cloud.d"
+ "ocumentai.v1beta2.Document.Style\022=\n\005page"
Expand Down Expand Up @@ -267,27 +267,27 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "ntend\030\010 \001(\0132-.google.cloud.documentai.v1"
+ "beta2.BoundingPolyB\003\340A\001\032I\n\016EntityRelatio"
+ "n\022\022\n\nsubject_id\030\001 \001(\t\022\021\n\tobject_id\030\002 \001(\t"
+ "\022\020\n\010relation\030\003 \001(\t\032\234\001\n\nTextAnchor\022W\n\rtex"
+ "\022\020\n\010relation\030\003 \001(\t\032\255\001\n\nTextAnchor\022W\n\rtex"
+ "t_segments\030\001 \003(\0132@.google.cloud.document"
+ "ai.v1beta2.Document.TextAnchor.TextSegme"
+ "nt\0325\n\013TextSegment\022\023\n\013start_index\030\001 \001(\003\022\021"
+ "\n\tend_index\030\002 \001(\003\032\201\003\n\nPageAnchor\022O\n\tpage"
+ "_refs\030\001 \003(\0132<.google.cloud.documentai.v1"
+ "beta2.Document.PageAnchor.PageRef\032\241\002\n\007Pa"
+ "geRef\022\021\n\004page\030\001 \001(\003B\003\340A\002\022a\n\013layout_type\030"
+ "\002 \001(\0162G.google.cloud.documentai.v1beta2."
+ "Document.PageAnchor.PageRef.LayoutTypeB\003"
+ "\340A\001\022\026\n\tlayout_id\030\003 \001(\tB\003\340A\001\"\207\001\n\nLayoutTy"
+ "pe\022\033\n\027LAYOUT_TYPE_UNSPECIFIED\020\000\022\t\n\005BLOCK"
+ "\020\001\022\r\n\tPARAGRAPH\020\002\022\010\n\004LINE\020\003\022\t\n\005TOKEN\020\004\022\022"
+ "\n\016VISUAL_ELEMENT\020\005\022\t\n\005TABLE\020\006\022\016\n\nFORM_FI"
+ "ELD\020\007B\010\n\006sourceB\352\001\n#com.google.cloud.doc"
+ "umentai.v1beta2B\rDocumentProtoP\001ZIgoogle"
+ ".golang.org/genproto/googleapis/cloud/do"
+ "cumentai/v1beta2;documentai\252\002\037Google.Clo"
+ "ud.DocumentAI.V1Beta2\312\002\037Google\\Cloud\\Doc"
+ "umentAI\\V1beta2\352\002\"Google::Cloud::Documen"
+ "tAI::V1beta2b\006proto3"
+ "nt\022\017\n\007content\030\002 \001(\t\0325\n\013TextSegment\022\023\n\013st"
+ "art_index\030\001 \001(\003\022\021\n\tend_index\030\002 \001(\003\032\201\003\n\nP"
+ "ageAnchor\022O\n\tpage_refs\030\001 \003(\0132<.google.cl"
+ "oud.documentai.v1beta2.Document.PageAnch"
+ "or.PageRef\032\241\002\n\007PageRef\022\021\n\004page\030\001 \001(\003B\003\340A"
+ "\002\022a\n\013layout_type\030\002 \001(\0162G.google.cloud.do"
+ "cumentai.v1beta2.Document.PageAnchor.Pag"
+ "eRef.LayoutTypeB\003\340A\001\022\026\n\tlayout_id\030\003 \001(\tB"
+ "\003\340A\001\"\207\001\n\nLayoutType\022\033\n\027LAYOUT_TYPE_UNSPE"
+ "CIFIED\020\000\022\t\n\005BLOCK\020\001\022\r\n\tPARAGRAPH\020\002\022\010\n\004LI"
+ "NE\020\003\022\t\n\005TOKEN\020\004\022\022\n\016VISUAL_ELEMENT\020\005\022\t\n\005T"
+ "ABLE\020\006\022\016\n\nFORM_FIELD\020\007B\010\n\006sourceB\352\001\n#com"
+ ".google.cloud.documentai.v1beta2B\rDocume"
+ "ntProtoP\001ZIgoogle.golang.org/genproto/go"
+ "ogleapis/cloud/documentai/v1beta2;docume"
+ "ntai\252\002\037Google.Cloud.DocumentAI.V1Beta2\312\002"
+ "\037Google\\Cloud\\DocumentAI\\V1beta2\352\002\"Googl"
+ "e::Cloud::DocumentAI::V1beta2b\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand Down Expand Up @@ -541,7 +541,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_documentai_v1beta2_Document_TextAnchor_descriptor,
new java.lang.String[] {
"TextSegments",
"TextSegments", "Content",
});
internal_static_google_cloud_documentai_v1beta2_Document_TextAnchor_TextSegment_descriptor =
internal_static_google_cloud_documentai_v1beta2_Document_TextAnchor_descriptor
Expand Down
Expand Up @@ -421,6 +421,10 @@ message Document {

// The text segments from the [Document.text][google.cloud.documentai.v1beta2.Document.text].
repeated TextSegment text_segments = 1;

// Contains the content of the text span so that users do
// not have to look it up in the text_segments.
string content = 2;
}

// Referencing elements in [Document.pages][google.cloud.documentai.v1beta2.Document.pages].
Expand Down

0 comments on commit a0b46b5

Please sign in to comment.