diff --git a/java-document-ai/README.md b/java-document-ai/README.md index 3af6e2a0a6f0..0b47998eb002 100644 --- a/java-document-ai/README.md +++ b/java-document-ai/README.md @@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-document-ai - 2.12.0 + 2.13.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-document-ai:2.12.0' +implementation 'com.google.cloud:google-cloud-document-ai:2.13.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-document-ai" % "2.12.0" +libraryDependencies += "com.google.cloud" % "google-cloud-document-ai" % "2.13.0" ``` ## Authentication diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentIoProto.java b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentIoProto.java index 7262e31e4f2d..e4ea56092e20 100644 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentIoProto.java +++ b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentIoProto.java @@ -94,15 +94,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + ".cloud.documentai.v1beta3.DocumentOutput" + "Config.GcsOutputConfig.ShardingConfig\032@\n" + "\016ShardingConfig\022\027\n\017pages_per_shard\030\001 \001(\005" - + "\022\025\n\rpages_overlap\030\002 \001(\005B\r\n\013destination\"." + + "\022\025\n\rpages_overlap\030\002 \001(\005B\r\n\013destination\"L" + "\n\tOcrConfig\022!\n\031enable_native_pdf_parsing" - + "\030\003 \001(\010B\354\001\n#com.google.cloud.documentai.v" - + "1beta3B\017DocumentIoProtoP\001ZIgoogle.golang" - + ".org/genproto/googleapis/cloud/documenta" - + "i/v1beta3;documentai\252\002\037Google.Cloud.Docu" - + "mentAI.V1Beta3\312\002\037Google\\Cloud\\DocumentAI" - + "\\V1beta3\352\002\"Google::Cloud::DocumentAI::V1" - + "beta3b\006proto3" + + "\030\003 \001(\010\022\034\n\024advanced_ocr_options\030\005 \003(\tB\354\001\n" + + "#com.google.cloud.documentai.v1beta3B\017Do" + + "cumentIoProtoP\001ZIgoogle.golang.org/genpr" + + "oto/googleapis/cloud/documentai/v1beta3;" + + "documentai\252\002\037Google.Cloud.DocumentAI.V1B" + + "eta3\312\002\037Google\\Cloud\\DocumentAI\\V1beta3\352\002" + + "\"Google::Cloud::DocumentAI::V1beta3b\006pro" + + "to3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -184,7 +185,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_documentai_v1beta3_OcrConfig_descriptor, new java.lang.String[] { - "EnableNativePdfParsing", + "EnableNativePdfParsing", "AdvancedOcrOptions", }); com.google.protobuf.FieldMaskProto.getDescriptor(); } diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfig.java b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfig.java index 1fa3b928c60b..eac5d8988d11 100644 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfig.java +++ b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfig.java @@ -37,7 +37,9 @@ private OcrConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } - private OcrConfig() {} + private OcrConfig() { + advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } @java.lang.Override @SuppressWarnings({"unused"}) @@ -84,6 +86,69 @@ public boolean getEnableNativePdfParsing() { return enableNativePdfParsing_; } + public static final int ADVANCED_OCR_OPTIONS_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringList advancedOcrOptions_; + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @return A list containing the advancedOcrOptions. + */ + public com.google.protobuf.ProtocolStringList getAdvancedOcrOptionsList() { + return advancedOcrOptions_; + } + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @return The count of advancedOcrOptions. + */ + public int getAdvancedOcrOptionsCount() { + return advancedOcrOptions_.size(); + } + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param index The index of the element to return. + * @return The advancedOcrOptions at the given index. + */ + public java.lang.String getAdvancedOcrOptions(int index) { + return advancedOcrOptions_.get(index); + } + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param index The index of the value to return. + * @return The bytes of the advancedOcrOptions at the given index. + */ + public com.google.protobuf.ByteString getAdvancedOcrOptionsBytes(int index) { + return advancedOcrOptions_.getByteString(index); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -101,6 +166,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (enableNativePdfParsing_ != false) { output.writeBool(3, enableNativePdfParsing_); } + for (int i = 0; i < advancedOcrOptions_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, advancedOcrOptions_.getRaw(i)); + } getUnknownFields().writeTo(output); } @@ -113,6 +181,14 @@ public int getSerializedSize() { if (enableNativePdfParsing_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, enableNativePdfParsing_); } + { + int dataSize = 0; + for (int i = 0; i < advancedOcrOptions_.size(); i++) { + dataSize += computeStringSizeNoTag(advancedOcrOptions_.getRaw(i)); + } + size += dataSize; + size += 1 * getAdvancedOcrOptionsList().size(); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -130,6 +206,7 @@ public boolean equals(final java.lang.Object obj) { (com.google.cloud.documentai.v1beta3.OcrConfig) obj; if (getEnableNativePdfParsing() != other.getEnableNativePdfParsing()) return false; + if (!getAdvancedOcrOptionsList().equals(other.getAdvancedOcrOptionsList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -143,6 +220,10 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ENABLE_NATIVE_PDF_PARSING_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableNativePdfParsing()); + if (getAdvancedOcrOptionsCount() > 0) { + hash = (37 * hash) + ADVANCED_OCR_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getAdvancedOcrOptionsList().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -283,6 +364,8 @@ public Builder clear() { super.clear(); bitField0_ = 0; enableNativePdfParsing_ = false; + advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -310,6 +393,7 @@ public com.google.cloud.documentai.v1beta3.OcrConfig build() { public com.google.cloud.documentai.v1beta3.OcrConfig buildPartial() { com.google.cloud.documentai.v1beta3.OcrConfig result = new com.google.cloud.documentai.v1beta3.OcrConfig(this); + buildPartialRepeatedFields(result); if (bitField0_ != 0) { buildPartial0(result); } @@ -317,6 +401,14 @@ public com.google.cloud.documentai.v1beta3.OcrConfig buildPartial() { return result; } + private void buildPartialRepeatedFields(com.google.cloud.documentai.v1beta3.OcrConfig result) { + if (((bitField0_ & 0x00000002) != 0)) { + advancedOcrOptions_ = advancedOcrOptions_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.advancedOcrOptions_ = advancedOcrOptions_; + } + private void buildPartial0(com.google.cloud.documentai.v1beta3.OcrConfig result) { int from_bitField0_ = bitField0_; if (((from_bitField0_ & 0x00000001) != 0)) { @@ -372,6 +464,16 @@ public Builder mergeFrom(com.google.cloud.documentai.v1beta3.OcrConfig other) { if (other.getEnableNativePdfParsing() != false) { setEnableNativePdfParsing(other.getEnableNativePdfParsing()); } + if (!other.advancedOcrOptions_.isEmpty()) { + if (advancedOcrOptions_.isEmpty()) { + advancedOcrOptions_ = other.advancedOcrOptions_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureAdvancedOcrOptionsIsMutable(); + advancedOcrOptions_.addAll(other.advancedOcrOptions_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -404,6 +506,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000001; break; } // case 24 + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureAdvancedOcrOptionsIsMutable(); + advancedOcrOptions_.add(s); + break; + } // case 42 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -479,6 +588,174 @@ public Builder clearEnableNativePdfParsing() { return this; } + private com.google.protobuf.LazyStringList advancedOcrOptions_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAdvancedOcrOptionsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + advancedOcrOptions_ = new com.google.protobuf.LazyStringArrayList(advancedOcrOptions_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @return A list containing the advancedOcrOptions. + */ + public com.google.protobuf.ProtocolStringList getAdvancedOcrOptionsList() { + return advancedOcrOptions_.getUnmodifiableView(); + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @return The count of advancedOcrOptions. + */ + public int getAdvancedOcrOptionsCount() { + return advancedOcrOptions_.size(); + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param index The index of the element to return. + * @return The advancedOcrOptions at the given index. + */ + public java.lang.String getAdvancedOcrOptions(int index) { + return advancedOcrOptions_.get(index); + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param index The index of the value to return. + * @return The bytes of the advancedOcrOptions at the given index. + */ + public com.google.protobuf.ByteString getAdvancedOcrOptionsBytes(int index) { + return advancedOcrOptions_.getByteString(index); + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param index The index to set the value at. + * @param value The advancedOcrOptions to set. + * @return This builder for chaining. + */ + public Builder setAdvancedOcrOptions(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdvancedOcrOptionsIsMutable(); + advancedOcrOptions_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param value The advancedOcrOptions to add. + * @return This builder for chaining. + */ + public Builder addAdvancedOcrOptions(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdvancedOcrOptionsIsMutable(); + advancedOcrOptions_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param values The advancedOcrOptions to add. + * @return This builder for chaining. + */ + public Builder addAllAdvancedOcrOptions(java.lang.Iterable values) { + ensureAdvancedOcrOptionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, advancedOcrOptions_); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @return This builder for chaining. + */ + public Builder clearAdvancedOcrOptions() { + advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of advanced OCR options to further fine-tune OCR behavior.
+     * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param value The bytes of the advancedOcrOptions to add. + * @return This builder for chaining. + */ + public Builder addAdvancedOcrOptionsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAdvancedOcrOptionsIsMutable(); + advancedOcrOptions_.add(value); + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfigOrBuilder.java b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfigOrBuilder.java index afd96e950340..7ef77f0e1c60 100644 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfigOrBuilder.java +++ b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/OcrConfigOrBuilder.java @@ -36,4 +36,55 @@ public interface OcrConfigOrBuilder * @return The enableNativePdfParsing. */ boolean getEnableNativePdfParsing(); + + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @return A list containing the advancedOcrOptions. + */ + java.util.List getAdvancedOcrOptionsList(); + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @return The count of advancedOcrOptions. + */ + int getAdvancedOcrOptionsCount(); + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param index The index of the element to return. + * @return The advancedOcrOptions at the given index. + */ + java.lang.String getAdvancedOcrOptions(int index); + /** + * + * + *
+   * A list of advanced OCR options to further fine-tune OCR behavior.
+   * 
+ * + * repeated string advanced_ocr_options = 5; + * + * @param index The index of the value to return. + * @return The bytes of the advancedOcrOptions at the given index. + */ + com.google.protobuf.ByteString getAdvancedOcrOptionsBytes(int index); } diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/proto/google/cloud/documentai/v1beta3/document_io.proto b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/proto/google/cloud/documentai/v1beta3/document_io.proto index d6a7fb1c4084..2b441c7c17e9 100644 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/proto/google/cloud/documentai/v1beta3/document_io.proto +++ b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/proto/google/cloud/documentai/v1beta3/document_io.proto @@ -107,4 +107,7 @@ message OcrConfig { // Enables special handling for PDFs with existing text information. Results // in better text extraction quality in such PDF inputs. bool enable_native_pdf_parsing = 3; + + // A list of advanced OCR options to further fine-tune OCR behavior. + repeated string advanced_ocr_options = 5; }