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

Commit

Permalink
feat: Add TextDetectionParams.advanced_ocr_options (#962)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

Advanced OCR options allow users to customize behavior for a specific OCR engine
version.

PiperOrigin-RevId: 465402148

Source-Link: googleapis/googleapis@ad64930

Source-Link: googleapis/googleapis-gen@5d2c8b2
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWQyYzhiMmIxY2IwZDE1YmY3MjQzNTEzYTU1NDNhOWVjM2VjZDc3OCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Aug 5, 2022
1 parent 7b55995 commit 62ce19b
Show file tree
Hide file tree
Showing 116 changed files with 2,383 additions and 736 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ private TextDetectionParams(com.google.protobuf.GeneratedMessageV3.Builder<?> bu
super(builder);
}

private TextDetectionParams() {}
private TextDetectionParams() {
advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
}

@java.lang.Override
@SuppressWarnings({"unused"})
Expand All @@ -59,6 +61,7 @@ private TextDetectionParams(
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
Expand All @@ -74,6 +77,16 @@ private TextDetectionParams(
enableTextDetectionConfidenceScore_ = input.readBool();
break;
}
case 90:
{
java.lang.String s = input.readStringRequireUtf8();
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
advancedOcrOptions_ = new com.google.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000001;
}
advancedOcrOptions_.add(s);
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
Expand All @@ -90,6 +103,9 @@ private TextDetectionParams(
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
advancedOcrOptions_ = advancedOcrOptions_.getUnmodifiableView();
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
Expand Down Expand Up @@ -130,6 +146,67 @@ public boolean getEnableTextDetectionConfidenceScore() {
return enableTextDetectionConfidenceScore_;
}

public static final int ADVANCED_OCR_OPTIONS_FIELD_NUMBER = 11;
private com.google.protobuf.LazyStringList advancedOcrOptions_;
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @return A list containing the advancedOcrOptions.
*/
public com.google.protobuf.ProtocolStringList getAdvancedOcrOptionsList() {
return advancedOcrOptions_;
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @return The count of advancedOcrOptions.
*/
public int getAdvancedOcrOptionsCount() {
return advancedOcrOptions_.size();
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @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);
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @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
Expand All @@ -147,6 +224,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (enableTextDetectionConfidenceScore_ != false) {
output.writeBool(9, enableTextDetectionConfidenceScore_);
}
for (int i = 0; i < advancedOcrOptions_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 11, advancedOcrOptions_.getRaw(i));
}
unknownFields.writeTo(output);
}

Expand All @@ -161,6 +241,14 @@ public int getSerializedSize() {
com.google.protobuf.CodedOutputStream.computeBoolSize(
9, enableTextDetectionConfidenceScore_);
}
{
int dataSize = 0;
for (int i = 0; i < advancedOcrOptions_.size(); i++) {
dataSize += computeStringSizeNoTag(advancedOcrOptions_.getRaw(i));
}
size += dataSize;
size += 1 * getAdvancedOcrOptionsList().size();
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -179,6 +267,7 @@ public boolean equals(final java.lang.Object obj) {

if (getEnableTextDetectionConfidenceScore() != other.getEnableTextDetectionConfidenceScore())
return false;
if (!getAdvancedOcrOptionsList().equals(other.getAdvancedOcrOptionsList())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
Expand All @@ -194,6 +283,10 @@ public int hashCode() {
hash =
(53 * hash)
+ com.google.protobuf.Internal.hashBoolean(getEnableTextDetectionConfidenceScore());
if (getAdvancedOcrOptionsCount() > 0) {
hash = (37 * hash) + ADVANCED_OCR_OPTIONS_FIELD_NUMBER;
hash = (53 * hash) + getAdvancedOcrOptionsList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -342,6 +435,8 @@ public Builder clear() {
super.clear();
enableTextDetectionConfidenceScore_ = false;

advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}

Expand Down Expand Up @@ -369,7 +464,13 @@ public com.google.cloud.vision.v1.TextDetectionParams build() {
public com.google.cloud.vision.v1.TextDetectionParams buildPartial() {
com.google.cloud.vision.v1.TextDetectionParams result =
new com.google.cloud.vision.v1.TextDetectionParams(this);
int from_bitField0_ = bitField0_;
result.enableTextDetectionConfidenceScore_ = enableTextDetectionConfidenceScore_;
if (((bitField0_ & 0x00000001) != 0)) {
advancedOcrOptions_ = advancedOcrOptions_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000001);
}
result.advancedOcrOptions_ = advancedOcrOptions_;
onBuilt();
return result;
}
Expand Down Expand Up @@ -422,6 +523,16 @@ public Builder mergeFrom(com.google.cloud.vision.v1.TextDetectionParams other) {
if (other.getEnableTextDetectionConfidenceScore() != false) {
setEnableTextDetectionConfidenceScore(other.getEnableTextDetectionConfidenceScore());
}
if (!other.advancedOcrOptions_.isEmpty()) {
if (advancedOcrOptions_.isEmpty()) {
advancedOcrOptions_ = other.advancedOcrOptions_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureAdvancedOcrOptionsIsMutable();
advancedOcrOptions_.addAll(other.advancedOcrOptions_);
}
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
Expand Down Expand Up @@ -451,6 +562,8 @@ public Builder mergeFrom(
return this;
}

private int bitField0_;

private boolean enableTextDetectionConfidenceScore_;
/**
*
Expand Down Expand Up @@ -509,6 +622,174 @@ public Builder clearEnableTextDetectionConfidenceScore() {
return this;
}

private com.google.protobuf.LazyStringList advancedOcrOptions_ =
com.google.protobuf.LazyStringArrayList.EMPTY;

private void ensureAdvancedOcrOptionsIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
advancedOcrOptions_ = new com.google.protobuf.LazyStringArrayList(advancedOcrOptions_);
bitField0_ |= 0x00000001;
}
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @return A list containing the advancedOcrOptions.
*/
public com.google.protobuf.ProtocolStringList getAdvancedOcrOptionsList() {
return advancedOcrOptions_.getUnmodifiableView();
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @return The count of advancedOcrOptions.
*/
public int getAdvancedOcrOptionsCount() {
return advancedOcrOptions_.size();
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @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);
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @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);
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @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;
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @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;
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @param values The advancedOcrOptions to add.
* @return This builder for chaining.
*/
public Builder addAllAdvancedOcrOptions(java.lang.Iterable<java.lang.String> values) {
ensureAdvancedOcrOptionsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(values, advancedOcrOptions_);
onChanged();
return this;
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @return This builder for chaining.
*/
public Builder clearAdvancedOcrOptions() {
advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
*
*
* <pre>
* A list of advanced OCR options to fine-tune OCR behavior.
* </pre>
*
* <code>repeated string advanced_ocr_options = 11;</code>
*
* @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);
Expand Down
Loading

0 comments on commit 62ce19b

Please sign in to comment.