com.google.cloud.speech.v1.PhraseSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proto-google-cloud-speech-v1 Show documentation
Show all versions of proto-google-cloud-speech-v1 Show documentation
PROTO library for proto-google-cloud-speech-v1
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/speech/v1/resource.proto
// Protobuf Java Version: 3.25.3
package com.google.cloud.speech.v1;
/**
*
*
*
* Provides "hints" to the speech recognizer to favor specific words and phrases
* in the results.
*
*
* Protobuf type {@code google.cloud.speech.v1.PhraseSet}
*/
public final class PhraseSet extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.cloud.speech.v1.PhraseSet)
PhraseSetOrBuilder {
private static final long serialVersionUID = 0L;
// Use PhraseSet.newBuilder() to construct.
private PhraseSet(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private PhraseSet() {
name_ = "";
phrases_ = java.util.Collections.emptyList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new PhraseSet();
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.speech.v1.PhraseSet.class,
com.google.cloud.speech.v1.PhraseSet.Builder.class);
}
public interface PhraseOrBuilder
extends
// @@protoc_insertion_point(interface_extends:google.cloud.speech.v1.PhraseSet.Phrase)
com.google.protobuf.MessageOrBuilder {
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @return The value.
*/
java.lang.String getValue();
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @return The bytes for value.
*/
com.google.protobuf.ByteString getValueBytes();
/**
*
*
*
* Hint Boost. Overrides the boost set at the phrase set level.
* Positive value will increase the probability that a specific phrase will
* be recognized over other similar sounding phrases. The higher the boost,
* the higher the chance of false positive recognition as well. Negative
* boost will simply be ignored. Though `boost` can accept a wide range of
* positive values, most use cases are best served
* with values between 0 and 20. We recommend using a binary search approach
* to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 2;
*
* @return The boost.
*/
float getBoost();
}
/**
*
*
*
* A phrases containing words and phrase "hints" so that
* the speech recognition is more likely to recognize them. This can be used
* to improve the accuracy for specific words and phrases, for example, if
* specific commands are typically spoken by the user. This can also be used
* to add additional words to the vocabulary of the recognizer. See
* [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
*
* List items can also include pre-built or custom classes containing groups
* of words that represent common concepts that occur in natural language. For
* example, rather than providing a phrase hint for every month of the
* year (e.g. "i was born in january", "i was born in febuary", ...), use the
* pre-built `$MONTH` class improves the likelihood of correctly transcribing
* audio that includes months (e.g. "i was born in $month").
* To refer to pre-built classes, use the class' symbol prepended with `$`
* e.g. `$MONTH`. To refer to custom classes that were defined inline in the
* request, set the class's `custom_class_id` to a string unique to all class
* resources and inline classes. Then use the class' id wrapped in $`{...}`
* e.g. "${my-months}". To refer to custom classes resources, use the class'
* id wrapped in `${}` (e.g. `${my-months}`).
*
* Speech-to-Text supports three locations: `global`, `us` (US North America),
* and `eu` (Europe). If you are calling the `speech.googleapis.com`
* endpoint, use the `global` location. To specify a region, use a
* [regional endpoint](https://cloud.google.com/speech-to-text/docs/endpoints)
* with matching `us` or `eu` location value.
*
*
* Protobuf type {@code google.cloud.speech.v1.PhraseSet.Phrase}
*/
public static final class Phrase extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.cloud.speech.v1.PhraseSet.Phrase)
PhraseOrBuilder {
private static final long serialVersionUID = 0L;
// Use Phrase.newBuilder() to construct.
private Phrase(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private Phrase() {
value_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new Phrase();
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_Phrase_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_Phrase_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.speech.v1.PhraseSet.Phrase.class,
com.google.cloud.speech.v1.PhraseSet.Phrase.Builder.class);
}
public static final int VALUE_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private volatile java.lang.Object value_ = "";
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @return The value.
*/
@java.lang.Override
public java.lang.String getValue() {
java.lang.Object ref = value_;
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();
value_ = s;
return s;
}
}
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @return The bytes for value.
*/
@java.lang.Override
public com.google.protobuf.ByteString getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int BOOST_FIELD_NUMBER = 2;
private float boost_ = 0F;
/**
*
*
*
* Hint Boost. Overrides the boost set at the phrase set level.
* Positive value will increase the probability that a specific phrase will
* be recognized over other similar sounding phrases. The higher the boost,
* the higher the chance of false positive recognition as well. Negative
* boost will simply be ignored. Though `boost` can accept a wide range of
* positive values, most use cases are best served
* with values between 0 and 20. We recommend using a binary search approach
* to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 2;
*
* @return The boost.
*/
@java.lang.Override
public float getBoost() {
return boost_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_);
}
if (java.lang.Float.floatToRawIntBits(boost_) != 0) {
output.writeFloat(2, boost_);
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_);
}
if (java.lang.Float.floatToRawIntBits(boost_) != 0) {
size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, boost_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.speech.v1.PhraseSet.Phrase)) {
return super.equals(obj);
}
com.google.cloud.speech.v1.PhraseSet.Phrase other =
(com.google.cloud.speech.v1.PhraseSet.Phrase) obj;
if (!getValue().equals(other.getValue())) return false;
if (java.lang.Float.floatToIntBits(getBoost())
!= java.lang.Float.floatToIntBits(other.getBoost())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + VALUE_FIELD_NUMBER;
hash = (53 * hash) + getValue().hashCode();
hash = (37 * hash) + BOOST_FIELD_NUMBER;
hash = (53 * hash) + java.lang.Float.floatToIntBits(getBoost());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseDelimitedFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.cloud.speech.v1.PhraseSet.Phrase prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
*
* A phrases containing words and phrase "hints" so that
* the speech recognition is more likely to recognize them. This can be used
* to improve the accuracy for specific words and phrases, for example, if
* specific commands are typically spoken by the user. This can also be used
* to add additional words to the vocabulary of the recognizer. See
* [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
*
* List items can also include pre-built or custom classes containing groups
* of words that represent common concepts that occur in natural language. For
* example, rather than providing a phrase hint for every month of the
* year (e.g. "i was born in january", "i was born in febuary", ...), use the
* pre-built `$MONTH` class improves the likelihood of correctly transcribing
* audio that includes months (e.g. "i was born in $month").
* To refer to pre-built classes, use the class' symbol prepended with `$`
* e.g. `$MONTH`. To refer to custom classes that were defined inline in the
* request, set the class's `custom_class_id` to a string unique to all class
* resources and inline classes. Then use the class' id wrapped in $`{...}`
* e.g. "${my-months}". To refer to custom classes resources, use the class'
* id wrapped in `${}` (e.g. `${my-months}`).
*
* Speech-to-Text supports three locations: `global`, `us` (US North America),
* and `eu` (Europe). If you are calling the `speech.googleapis.com`
* endpoint, use the `global` location. To specify a region, use a
* [regional endpoint](https://cloud.google.com/speech-to-text/docs/endpoints)
* with matching `us` or `eu` location value.
*
*
* Protobuf type {@code google.cloud.speech.v1.PhraseSet.Phrase}
*/
public static final class Builder
extends com.google.protobuf.GeneratedMessageV3.Builder
implements
// @@protoc_insertion_point(builder_implements:google.cloud.speech.v1.PhraseSet.Phrase)
com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_Phrase_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_Phrase_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.speech.v1.PhraseSet.Phrase.class,
com.google.cloud.speech.v1.PhraseSet.Phrase.Builder.class);
}
// Construct using com.google.cloud.speech.v1.PhraseSet.Phrase.newBuilder()
private Builder() {}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
value_ = "";
boost_ = 0F;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_Phrase_descriptor;
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet.Phrase getDefaultInstanceForType() {
return com.google.cloud.speech.v1.PhraseSet.Phrase.getDefaultInstance();
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet.Phrase build() {
com.google.cloud.speech.v1.PhraseSet.Phrase result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet.Phrase buildPartial() {
com.google.cloud.speech.v1.PhraseSet.Phrase result =
new com.google.cloud.speech.v1.PhraseSet.Phrase(this);
if (bitField0_ != 0) {
buildPartial0(result);
}
onBuilt();
return result;
}
private void buildPartial0(com.google.cloud.speech.v1.PhraseSet.Phrase result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.value_ = value_;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.boost_ = boost_;
}
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index,
java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.speech.v1.PhraseSet.Phrase) {
return mergeFrom((com.google.cloud.speech.v1.PhraseSet.Phrase) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.speech.v1.PhraseSet.Phrase other) {
if (other == com.google.cloud.speech.v1.PhraseSet.Phrase.getDefaultInstance()) return this;
if (!other.getValue().isEmpty()) {
value_ = other.value_;
bitField0_ |= 0x00000001;
onChanged();
}
if (other.getBoost() != 0F) {
setBoost(other.getBoost());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
value_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
case 21:
{
boost_ = input.readFloat();
bitField0_ |= 0x00000002;
break;
} // case 21
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private java.lang.Object value_ = "";
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @return The value.
*/
public java.lang.String getValue() {
java.lang.Object ref = value_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
value_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @return The bytes for value.
*/
public com.google.protobuf.ByteString getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @param value The value to set.
* @return This builder for chaining.
*/
public Builder setValue(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
value_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @return This builder for chaining.
*/
public Builder clearValue() {
value_ = getDefaultInstance().getValue();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
*
*
*
* The phrase itself.
*
*
* string value = 1;
*
* @param value The bytes for value to set.
* @return This builder for chaining.
*/
public Builder setValueBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
value_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
private float boost_;
/**
*
*
*
* Hint Boost. Overrides the boost set at the phrase set level.
* Positive value will increase the probability that a specific phrase will
* be recognized over other similar sounding phrases. The higher the boost,
* the higher the chance of false positive recognition as well. Negative
* boost will simply be ignored. Though `boost` can accept a wide range of
* positive values, most use cases are best served
* with values between 0 and 20. We recommend using a binary search approach
* to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 2;
*
* @return The boost.
*/
@java.lang.Override
public float getBoost() {
return boost_;
}
/**
*
*
*
* Hint Boost. Overrides the boost set at the phrase set level.
* Positive value will increase the probability that a specific phrase will
* be recognized over other similar sounding phrases. The higher the boost,
* the higher the chance of false positive recognition as well. Negative
* boost will simply be ignored. Though `boost` can accept a wide range of
* positive values, most use cases are best served
* with values between 0 and 20. We recommend using a binary search approach
* to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 2;
*
* @param value The boost to set.
* @return This builder for chaining.
*/
public Builder setBoost(float value) {
boost_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
*
*
* Hint Boost. Overrides the boost set at the phrase set level.
* Positive value will increase the probability that a specific phrase will
* be recognized over other similar sounding phrases. The higher the boost,
* the higher the chance of false positive recognition as well. Negative
* boost will simply be ignored. Though `boost` can accept a wide range of
* positive values, most use cases are best served
* with values between 0 and 20. We recommend using a binary search approach
* to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 2;
*
* @return This builder for chaining.
*/
public Builder clearBoost() {
bitField0_ = (bitField0_ & ~0x00000002);
boost_ = 0F;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.cloud.speech.v1.PhraseSet.Phrase)
}
// @@protoc_insertion_point(class_scope:google.cloud.speech.v1.PhraseSet.Phrase)
private static final com.google.cloud.speech.v1.PhraseSet.Phrase DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.speech.v1.PhraseSet.Phrase();
}
public static com.google.cloud.speech.v1.PhraseSet.Phrase getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser PARSER =
new com.google.protobuf.AbstractParser() {
@java.lang.Override
public Phrase parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException()
.setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet.Phrase getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
public static final int NAME_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private volatile java.lang.Object name_ = "";
/**
*
*
*
* The resource name of the phrase set.
*
*
* string name = 1;
*
* @return The name.
*/
@java.lang.Override
public java.lang.String getName() {
java.lang.Object ref = name_;
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();
name_ = s;
return s;
}
}
/**
*
*
*
* The resource name of the phrase set.
*
*
* string name = 1;
*
* @return The bytes for name.
*/
@java.lang.Override
public com.google.protobuf.ByteString getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int PHRASES_FIELD_NUMBER = 2;
@SuppressWarnings("serial")
private java.util.List phrases_;
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
@java.lang.Override
public java.util.List getPhrasesList() {
return phrases_;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
@java.lang.Override
public java.util.List extends com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder>
getPhrasesOrBuilderList() {
return phrases_;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
@java.lang.Override
public int getPhrasesCount() {
return phrases_.size();
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet.Phrase getPhrases(int index) {
return phrases_.get(index);
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder getPhrasesOrBuilder(int index) {
return phrases_.get(index);
}
public static final int BOOST_FIELD_NUMBER = 4;
private float boost_ = 0F;
/**
*
*
*
* Hint Boost. Positive value will increase the probability that a specific
* phrase will be recognized over other similar sounding phrases. The higher
* the boost, the higher the chance of false positive recognition as well.
* Negative boost values would correspond to anti-biasing. Anti-biasing is not
* enabled, so negative boost will simply be ignored. Though `boost` can
* accept a wide range of positive values, most use cases are best served with
* values between 0 (exclusive) and 20. We recommend using a binary search
* approach to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 4;
*
* @return The boost.
*/
@java.lang.Override
public float getBoost() {
return boost_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
for (int i = 0; i < phrases_.size(); i++) {
output.writeMessage(2, phrases_.get(i));
}
if (java.lang.Float.floatToRawIntBits(boost_) != 0) {
output.writeFloat(4, boost_);
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
for (int i = 0; i < phrases_.size(); i++) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, phrases_.get(i));
}
if (java.lang.Float.floatToRawIntBits(boost_) != 0) {
size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, boost_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.speech.v1.PhraseSet)) {
return super.equals(obj);
}
com.google.cloud.speech.v1.PhraseSet other = (com.google.cloud.speech.v1.PhraseSet) obj;
if (!getName().equals(other.getName())) return false;
if (!getPhrasesList().equals(other.getPhrasesList())) return false;
if (java.lang.Float.floatToIntBits(getBoost())
!= java.lang.Float.floatToIntBits(other.getBoost())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
if (getPhrasesCount() > 0) {
hash = (37 * hash) + PHRASES_FIELD_NUMBER;
hash = (53 * hash) + getPhrasesList().hashCode();
}
hash = (37 * hash) + BOOST_FIELD_NUMBER;
hash = (53 * hash) + java.lang.Float.floatToIntBits(getBoost());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.speech.v1.PhraseSet parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.speech.v1.PhraseSet parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.cloud.speech.v1.PhraseSet prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
*
* Provides "hints" to the speech recognizer to favor specific words and phrases
* in the results.
*
*
* Protobuf type {@code google.cloud.speech.v1.PhraseSet}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder
implements
// @@protoc_insertion_point(builder_implements:google.cloud.speech.v1.PhraseSet)
com.google.cloud.speech.v1.PhraseSetOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.speech.v1.PhraseSet.class,
com.google.cloud.speech.v1.PhraseSet.Builder.class);
}
// Construct using com.google.cloud.speech.v1.PhraseSet.newBuilder()
private Builder() {}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
name_ = "";
if (phrasesBuilder_ == null) {
phrases_ = java.util.Collections.emptyList();
} else {
phrases_ = null;
phrasesBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
boost_ = 0F;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.cloud.speech.v1.SpeechResourceProto
.internal_static_google_cloud_speech_v1_PhraseSet_descriptor;
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet getDefaultInstanceForType() {
return com.google.cloud.speech.v1.PhraseSet.getDefaultInstance();
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet build() {
com.google.cloud.speech.v1.PhraseSet result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet buildPartial() {
com.google.cloud.speech.v1.PhraseSet result = new com.google.cloud.speech.v1.PhraseSet(this);
buildPartialRepeatedFields(result);
if (bitField0_ != 0) {
buildPartial0(result);
}
onBuilt();
return result;
}
private void buildPartialRepeatedFields(com.google.cloud.speech.v1.PhraseSet result) {
if (phrasesBuilder_ == null) {
if (((bitField0_ & 0x00000002) != 0)) {
phrases_ = java.util.Collections.unmodifiableList(phrases_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.phrases_ = phrases_;
} else {
result.phrases_ = phrasesBuilder_.build();
}
}
private void buildPartial0(com.google.cloud.speech.v1.PhraseSet result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.name_ = name_;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.boost_ = boost_;
}
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.speech.v1.PhraseSet) {
return mergeFrom((com.google.cloud.speech.v1.PhraseSet) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.speech.v1.PhraseSet other) {
if (other == com.google.cloud.speech.v1.PhraseSet.getDefaultInstance()) return this;
if (!other.getName().isEmpty()) {
name_ = other.name_;
bitField0_ |= 0x00000001;
onChanged();
}
if (phrasesBuilder_ == null) {
if (!other.phrases_.isEmpty()) {
if (phrases_.isEmpty()) {
phrases_ = other.phrases_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensurePhrasesIsMutable();
phrases_.addAll(other.phrases_);
}
onChanged();
}
} else {
if (!other.phrases_.isEmpty()) {
if (phrasesBuilder_.isEmpty()) {
phrasesBuilder_.dispose();
phrasesBuilder_ = null;
phrases_ = other.phrases_;
bitField0_ = (bitField0_ & ~0x00000002);
phrasesBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
? getPhrasesFieldBuilder()
: null;
} else {
phrasesBuilder_.addAllMessages(other.phrases_);
}
}
}
if (other.getBoost() != 0F) {
setBoost(other.getBoost());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
name_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
case 18:
{
com.google.cloud.speech.v1.PhraseSet.Phrase m =
input.readMessage(
com.google.cloud.speech.v1.PhraseSet.Phrase.parser(), extensionRegistry);
if (phrasesBuilder_ == null) {
ensurePhrasesIsMutable();
phrases_.add(m);
} else {
phrasesBuilder_.addMessage(m);
}
break;
} // case 18
case 37:
{
boost_ = input.readFloat();
bitField0_ |= 0x00000004;
break;
} // case 37
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private java.lang.Object name_ = "";
/**
*
*
*
* The resource name of the phrase set.
*
*
* string name = 1;
*
* @return The name.
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
*
* The resource name of the phrase set.
*
*
* string name = 1;
*
* @return The bytes for name.
*/
public com.google.protobuf.ByteString getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
*
* The resource name of the phrase set.
*
*
* string name = 1;
*
* @param value The name to set.
* @return This builder for chaining.
*/
public Builder setName(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
*
*
* The resource name of the phrase set.
*
*
* string name = 1;
*
* @return This builder for chaining.
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
*
*
*
* The resource name of the phrase set.
*
*
* string name = 1;
*
* @param value The bytes for name to set.
* @return This builder for chaining.
*/
public Builder setNameBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
name_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
private java.util.List phrases_ =
java.util.Collections.emptyList();
private void ensurePhrasesIsMutable() {
if (!((bitField0_ & 0x00000002) != 0)) {
phrases_ = new java.util.ArrayList(phrases_);
bitField0_ |= 0x00000002;
}
}
private com.google.protobuf.RepeatedFieldBuilderV3<
com.google.cloud.speech.v1.PhraseSet.Phrase,
com.google.cloud.speech.v1.PhraseSet.Phrase.Builder,
com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder>
phrasesBuilder_;
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public java.util.List getPhrasesList() {
if (phrasesBuilder_ == null) {
return java.util.Collections.unmodifiableList(phrases_);
} else {
return phrasesBuilder_.getMessageList();
}
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public int getPhrasesCount() {
if (phrasesBuilder_ == null) {
return phrases_.size();
} else {
return phrasesBuilder_.getCount();
}
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public com.google.cloud.speech.v1.PhraseSet.Phrase getPhrases(int index) {
if (phrasesBuilder_ == null) {
return phrases_.get(index);
} else {
return phrasesBuilder_.getMessage(index);
}
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder setPhrases(int index, com.google.cloud.speech.v1.PhraseSet.Phrase value) {
if (phrasesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePhrasesIsMutable();
phrases_.set(index, value);
onChanged();
} else {
phrasesBuilder_.setMessage(index, value);
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder setPhrases(
int index, com.google.cloud.speech.v1.PhraseSet.Phrase.Builder builderForValue) {
if (phrasesBuilder_ == null) {
ensurePhrasesIsMutable();
phrases_.set(index, builderForValue.build());
onChanged();
} else {
phrasesBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder addPhrases(com.google.cloud.speech.v1.PhraseSet.Phrase value) {
if (phrasesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePhrasesIsMutable();
phrases_.add(value);
onChanged();
} else {
phrasesBuilder_.addMessage(value);
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder addPhrases(int index, com.google.cloud.speech.v1.PhraseSet.Phrase value) {
if (phrasesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePhrasesIsMutable();
phrases_.add(index, value);
onChanged();
} else {
phrasesBuilder_.addMessage(index, value);
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder addPhrases(com.google.cloud.speech.v1.PhraseSet.Phrase.Builder builderForValue) {
if (phrasesBuilder_ == null) {
ensurePhrasesIsMutable();
phrases_.add(builderForValue.build());
onChanged();
} else {
phrasesBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder addPhrases(
int index, com.google.cloud.speech.v1.PhraseSet.Phrase.Builder builderForValue) {
if (phrasesBuilder_ == null) {
ensurePhrasesIsMutable();
phrases_.add(index, builderForValue.build());
onChanged();
} else {
phrasesBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder addAllPhrases(
java.lang.Iterable extends com.google.cloud.speech.v1.PhraseSet.Phrase> values) {
if (phrasesBuilder_ == null) {
ensurePhrasesIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(values, phrases_);
onChanged();
} else {
phrasesBuilder_.addAllMessages(values);
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder clearPhrases() {
if (phrasesBuilder_ == null) {
phrases_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
phrasesBuilder_.clear();
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public Builder removePhrases(int index) {
if (phrasesBuilder_ == null) {
ensurePhrasesIsMutable();
phrases_.remove(index);
onChanged();
} else {
phrasesBuilder_.remove(index);
}
return this;
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public com.google.cloud.speech.v1.PhraseSet.Phrase.Builder getPhrasesBuilder(int index) {
return getPhrasesFieldBuilder().getBuilder(index);
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder getPhrasesOrBuilder(int index) {
if (phrasesBuilder_ == null) {
return phrases_.get(index);
} else {
return phrasesBuilder_.getMessageOrBuilder(index);
}
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public java.util.List extends com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder>
getPhrasesOrBuilderList() {
if (phrasesBuilder_ != null) {
return phrasesBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(phrases_);
}
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public com.google.cloud.speech.v1.PhraseSet.Phrase.Builder addPhrasesBuilder() {
return getPhrasesFieldBuilder()
.addBuilder(com.google.cloud.speech.v1.PhraseSet.Phrase.getDefaultInstance());
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public com.google.cloud.speech.v1.PhraseSet.Phrase.Builder addPhrasesBuilder(int index) {
return getPhrasesFieldBuilder()
.addBuilder(index, com.google.cloud.speech.v1.PhraseSet.Phrase.getDefaultInstance());
}
/**
*
*
*
* A list of word and phrases.
*
*
* repeated .google.cloud.speech.v1.PhraseSet.Phrase phrases = 2;
*/
public java.util.List
getPhrasesBuilderList() {
return getPhrasesFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilderV3<
com.google.cloud.speech.v1.PhraseSet.Phrase,
com.google.cloud.speech.v1.PhraseSet.Phrase.Builder,
com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder>
getPhrasesFieldBuilder() {
if (phrasesBuilder_ == null) {
phrasesBuilder_ =
new com.google.protobuf.RepeatedFieldBuilderV3<
com.google.cloud.speech.v1.PhraseSet.Phrase,
com.google.cloud.speech.v1.PhraseSet.Phrase.Builder,
com.google.cloud.speech.v1.PhraseSet.PhraseOrBuilder>(
phrases_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
phrases_ = null;
}
return phrasesBuilder_;
}
private float boost_;
/**
*
*
*
* Hint Boost. Positive value will increase the probability that a specific
* phrase will be recognized over other similar sounding phrases. The higher
* the boost, the higher the chance of false positive recognition as well.
* Negative boost values would correspond to anti-biasing. Anti-biasing is not
* enabled, so negative boost will simply be ignored. Though `boost` can
* accept a wide range of positive values, most use cases are best served with
* values between 0 (exclusive) and 20. We recommend using a binary search
* approach to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 4;
*
* @return The boost.
*/
@java.lang.Override
public float getBoost() {
return boost_;
}
/**
*
*
*
* Hint Boost. Positive value will increase the probability that a specific
* phrase will be recognized over other similar sounding phrases. The higher
* the boost, the higher the chance of false positive recognition as well.
* Negative boost values would correspond to anti-biasing. Anti-biasing is not
* enabled, so negative boost will simply be ignored. Though `boost` can
* accept a wide range of positive values, most use cases are best served with
* values between 0 (exclusive) and 20. We recommend using a binary search
* approach to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 4;
*
* @param value The boost to set.
* @return This builder for chaining.
*/
public Builder setBoost(float value) {
boost_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
*
*
* Hint Boost. Positive value will increase the probability that a specific
* phrase will be recognized over other similar sounding phrases. The higher
* the boost, the higher the chance of false positive recognition as well.
* Negative boost values would correspond to anti-biasing. Anti-biasing is not
* enabled, so negative boost will simply be ignored. Though `boost` can
* accept a wide range of positive values, most use cases are best served with
* values between 0 (exclusive) and 20. We recommend using a binary search
* approach to finding the optimal value for your use case as well as adding
* phrases both with and without boost to your requests.
*
*
* float boost = 4;
*
* @return This builder for chaining.
*/
public Builder clearBoost() {
bitField0_ = (bitField0_ & ~0x00000004);
boost_ = 0F;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.cloud.speech.v1.PhraseSet)
}
// @@protoc_insertion_point(class_scope:google.cloud.speech.v1.PhraseSet)
private static final com.google.cloud.speech.v1.PhraseSet DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.speech.v1.PhraseSet();
}
public static com.google.cloud.speech.v1.PhraseSet getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser PARSER =
new com.google.protobuf.AbstractParser() {
@java.lang.Override
public PhraseSet parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.cloud.speech.v1.PhraseSet getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy