blob: 6ef75f6c06ea179e7f409ee019c05fa1d5d6113c [file] [log] [blame]
/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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
*
* http://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.
*/
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_MODEL_LIBTEXTCLASSIFIER2_H_
#define FLATBUFFERS_GENERATED_MODEL_LIBTEXTCLASSIFIER2_H_
#include "flatbuffers/flatbuffers.h"
namespace libtextclassifier2 {
struct CompressedBuffer;
struct CompressedBufferT;
struct SelectionModelOptions;
struct SelectionModelOptionsT;
struct ClassificationModelOptions;
struct ClassificationModelOptionsT;
namespace RegexModel_ {
struct Pattern;
struct PatternT;
} // namespace RegexModel_
struct RegexModel;
struct RegexModelT;
namespace DatetimeModelPattern_ {
struct Regex;
struct RegexT;
} // namespace DatetimeModelPattern_
struct DatetimeModelPattern;
struct DatetimeModelPatternT;
struct DatetimeModelExtractor;
struct DatetimeModelExtractorT;
struct DatetimeModel;
struct DatetimeModelT;
namespace DatetimeModelLibrary_ {
struct Item;
struct ItemT;
} // namespace DatetimeModelLibrary_
struct DatetimeModelLibrary;
struct DatetimeModelLibraryT;
struct ModelTriggeringOptions;
struct ModelTriggeringOptionsT;
struct OutputOptions;
struct OutputOptionsT;
struct Model;
struct ModelT;
struct TokenizationCodepointRange;
struct TokenizationCodepointRangeT;
namespace FeatureProcessorOptions_ {
struct CodepointRange;
struct CodepointRangeT;
struct BoundsSensitiveFeatures;
struct BoundsSensitiveFeaturesT;
struct AlternativeCollectionMapEntry;
struct AlternativeCollectionMapEntryT;
} // namespace FeatureProcessorOptions_
struct FeatureProcessorOptions;
struct FeatureProcessorOptionsT;
enum ModeFlag {
ModeFlag_NONE = 0,
ModeFlag_ANNOTATION = 1,
ModeFlag_CLASSIFICATION = 2,
ModeFlag_ANNOTATION_AND_CLASSIFICATION = 3,
ModeFlag_SELECTION = 4,
ModeFlag_ANNOTATION_AND_SELECTION = 5,
ModeFlag_CLASSIFICATION_AND_SELECTION = 6,
ModeFlag_ALL = 7,
ModeFlag_MIN = ModeFlag_NONE,
ModeFlag_MAX = ModeFlag_ALL
};
inline ModeFlag (&EnumValuesModeFlag())[8] {
static ModeFlag values[] = {
ModeFlag_NONE,
ModeFlag_ANNOTATION,
ModeFlag_CLASSIFICATION,
ModeFlag_ANNOTATION_AND_CLASSIFICATION,
ModeFlag_SELECTION,
ModeFlag_ANNOTATION_AND_SELECTION,
ModeFlag_CLASSIFICATION_AND_SELECTION,
ModeFlag_ALL
};
return values;
}
inline const char **EnumNamesModeFlag() {
static const char *names[] = {
"NONE",
"ANNOTATION",
"CLASSIFICATION",
"ANNOTATION_AND_CLASSIFICATION",
"SELECTION",
"ANNOTATION_AND_SELECTION",
"CLASSIFICATION_AND_SELECTION",
"ALL",
nullptr
};
return names;
}
inline const char *EnumNameModeFlag(ModeFlag e) {
const size_t index = static_cast<int>(e);
return EnumNamesModeFlag()[index];
}
enum DatetimeExtractorType {
DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE = 0,
DatetimeExtractorType_AM = 1,
DatetimeExtractorType_PM = 2,
DatetimeExtractorType_JANUARY = 3,
DatetimeExtractorType_FEBRUARY = 4,
DatetimeExtractorType_MARCH = 5,
DatetimeExtractorType_APRIL = 6,
DatetimeExtractorType_MAY = 7,
DatetimeExtractorType_JUNE = 8,
DatetimeExtractorType_JULY = 9,
DatetimeExtractorType_AUGUST = 10,
DatetimeExtractorType_SEPTEMBER = 11,
DatetimeExtractorType_OCTOBER = 12,
DatetimeExtractorType_NOVEMBER = 13,
DatetimeExtractorType_DECEMBER = 14,
DatetimeExtractorType_NEXT = 15,
DatetimeExtractorType_NEXT_OR_SAME = 16,
DatetimeExtractorType_LAST = 17,
DatetimeExtractorType_NOW = 18,
DatetimeExtractorType_TOMORROW = 19,
DatetimeExtractorType_YESTERDAY = 20,
DatetimeExtractorType_PAST = 21,
DatetimeExtractorType_FUTURE = 22,
DatetimeExtractorType_DAY = 23,
DatetimeExtractorType_WEEK = 24,
DatetimeExtractorType_MONTH = 25,
DatetimeExtractorType_YEAR = 26,
DatetimeExtractorType_MONDAY = 27,
DatetimeExtractorType_TUESDAY = 28,
DatetimeExtractorType_WEDNESDAY = 29,
DatetimeExtractorType_THURSDAY = 30,
DatetimeExtractorType_FRIDAY = 31,
DatetimeExtractorType_SATURDAY = 32,
DatetimeExtractorType_SUNDAY = 33,
DatetimeExtractorType_DAYS = 34,
DatetimeExtractorType_WEEKS = 35,
DatetimeExtractorType_MONTHS = 36,
DatetimeExtractorType_HOURS = 37,
DatetimeExtractorType_MINUTES = 38,
DatetimeExtractorType_SECONDS = 39,
DatetimeExtractorType_YEARS = 40,
DatetimeExtractorType_DIGITS = 41,
DatetimeExtractorType_SIGNEDDIGITS = 42,
DatetimeExtractorType_ZERO = 43,
DatetimeExtractorType_ONE = 44,
DatetimeExtractorType_TWO = 45,
DatetimeExtractorType_THREE = 46,
DatetimeExtractorType_FOUR = 47,
DatetimeExtractorType_FIVE = 48,
DatetimeExtractorType_SIX = 49,
DatetimeExtractorType_SEVEN = 50,
DatetimeExtractorType_EIGHT = 51,
DatetimeExtractorType_NINE = 52,
DatetimeExtractorType_TEN = 53,
DatetimeExtractorType_ELEVEN = 54,
DatetimeExtractorType_TWELVE = 55,
DatetimeExtractorType_THIRTEEN = 56,
DatetimeExtractorType_FOURTEEN = 57,
DatetimeExtractorType_FIFTEEN = 58,
DatetimeExtractorType_SIXTEEN = 59,
DatetimeExtractorType_SEVENTEEN = 60,
DatetimeExtractorType_EIGHTEEN = 61,
DatetimeExtractorType_NINETEEN = 62,
DatetimeExtractorType_TWENTY = 63,
DatetimeExtractorType_THIRTY = 64,
DatetimeExtractorType_FORTY = 65,
DatetimeExtractorType_FIFTY = 66,
DatetimeExtractorType_SIXTY = 67,
DatetimeExtractorType_SEVENTY = 68,
DatetimeExtractorType_EIGHTY = 69,
DatetimeExtractorType_NINETY = 70,
DatetimeExtractorType_HUNDRED = 71,
DatetimeExtractorType_THOUSAND = 72,
DatetimeExtractorType_MIN = DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE,
DatetimeExtractorType_MAX = DatetimeExtractorType_THOUSAND
};
inline DatetimeExtractorType (&EnumValuesDatetimeExtractorType())[73] {
static DatetimeExtractorType values[] = {
DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE,
DatetimeExtractorType_AM,
DatetimeExtractorType_PM,
DatetimeExtractorType_JANUARY,
DatetimeExtractorType_FEBRUARY,
DatetimeExtractorType_MARCH,
DatetimeExtractorType_APRIL,
DatetimeExtractorType_MAY,
DatetimeExtractorType_JUNE,
DatetimeExtractorType_JULY,
DatetimeExtractorType_AUGUST,
DatetimeExtractorType_SEPTEMBER,
DatetimeExtractorType_OCTOBER,
DatetimeExtractorType_NOVEMBER,
DatetimeExtractorType_DECEMBER,
DatetimeExtractorType_NEXT,
DatetimeExtractorType_NEXT_OR_SAME,
DatetimeExtractorType_LAST,
DatetimeExtractorType_NOW,
DatetimeExtractorType_TOMORROW,
DatetimeExtractorType_YESTERDAY,
DatetimeExtractorType_PAST,
DatetimeExtractorType_FUTURE,
DatetimeExtractorType_DAY,
DatetimeExtractorType_WEEK,
DatetimeExtractorType_MONTH,
DatetimeExtractorType_YEAR,
DatetimeExtractorType_MONDAY,
DatetimeExtractorType_TUESDAY,
DatetimeExtractorType_WEDNESDAY,
DatetimeExtractorType_THURSDAY,
DatetimeExtractorType_FRIDAY,
DatetimeExtractorType_SATURDAY,
DatetimeExtractorType_SUNDAY,
DatetimeExtractorType_DAYS,
DatetimeExtractorType_WEEKS,
DatetimeExtractorType_MONTHS,
DatetimeExtractorType_HOURS,
DatetimeExtractorType_MINUTES,
DatetimeExtractorType_SECONDS,
DatetimeExtractorType_YEARS,
DatetimeExtractorType_DIGITS,
DatetimeExtractorType_SIGNEDDIGITS,
DatetimeExtractorType_ZERO,
DatetimeExtractorType_ONE,
DatetimeExtractorType_TWO,
DatetimeExtractorType_THREE,
DatetimeExtractorType_FOUR,
DatetimeExtractorType_FIVE,
DatetimeExtractorType_SIX,
DatetimeExtractorType_SEVEN,
DatetimeExtractorType_EIGHT,
DatetimeExtractorType_NINE,
DatetimeExtractorType_TEN,
DatetimeExtractorType_ELEVEN,
DatetimeExtractorType_TWELVE,
DatetimeExtractorType_THIRTEEN,
DatetimeExtractorType_FOURTEEN,
DatetimeExtractorType_FIFTEEN,
DatetimeExtractorType_SIXTEEN,
DatetimeExtractorType_SEVENTEEN,
DatetimeExtractorType_EIGHTEEN,
DatetimeExtractorType_NINETEEN,
DatetimeExtractorType_TWENTY,
DatetimeExtractorType_THIRTY,
DatetimeExtractorType_FORTY,
DatetimeExtractorType_FIFTY,
DatetimeExtractorType_SIXTY,
DatetimeExtractorType_SEVENTY,
DatetimeExtractorType_EIGHTY,
DatetimeExtractorType_NINETY,
DatetimeExtractorType_HUNDRED,
DatetimeExtractorType_THOUSAND
};
return values;
}
inline const char **EnumNamesDatetimeExtractorType() {
static const char *names[] = {
"UNKNOWN_DATETIME_EXTRACTOR_TYPE",
"AM",
"PM",
"JANUARY",
"FEBRUARY",
"MARCH",
"APRIL",
"MAY",
"JUNE",
"JULY",
"AUGUST",
"SEPTEMBER",
"OCTOBER",
"NOVEMBER",
"DECEMBER",
"NEXT",
"NEXT_OR_SAME",
"LAST",
"NOW",
"TOMORROW",
"YESTERDAY",
"PAST",
"FUTURE",
"DAY",
"WEEK",
"MONTH",
"YEAR",
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY",
"DAYS",
"WEEKS",
"MONTHS",
"HOURS",
"MINUTES",
"SECONDS",
"YEARS",
"DIGITS",
"SIGNEDDIGITS",
"ZERO",
"ONE",
"TWO",
"THREE",
"FOUR",
"FIVE",
"SIX",
"SEVEN",
"EIGHT",
"NINE",
"TEN",
"ELEVEN",
"TWELVE",
"THIRTEEN",
"FOURTEEN",
"FIFTEEN",
"SIXTEEN",
"SEVENTEEN",
"EIGHTEEN",
"NINETEEN",
"TWENTY",
"THIRTY",
"FORTY",
"FIFTY",
"SIXTY",
"SEVENTY",
"EIGHTY",
"NINETY",
"HUNDRED",
"THOUSAND",
nullptr
};
return names;
}
inline const char *EnumNameDatetimeExtractorType(DatetimeExtractorType e) {
const size_t index = static_cast<int>(e);
return EnumNamesDatetimeExtractorType()[index];
}
enum DatetimeGroupType {
DatetimeGroupType_GROUP_UNKNOWN = 0,
DatetimeGroupType_GROUP_UNUSED = 1,
DatetimeGroupType_GROUP_YEAR = 2,
DatetimeGroupType_GROUP_MONTH = 3,
DatetimeGroupType_GROUP_DAY = 4,
DatetimeGroupType_GROUP_HOUR = 5,
DatetimeGroupType_GROUP_MINUTE = 6,
DatetimeGroupType_GROUP_SECOND = 7,
DatetimeGroupType_GROUP_AMPM = 8,
DatetimeGroupType_GROUP_RELATIONDISTANCE = 9,
DatetimeGroupType_GROUP_RELATION = 10,
DatetimeGroupType_GROUP_RELATIONTYPE = 11,
DatetimeGroupType_GROUP_DUMMY1 = 12,
DatetimeGroupType_GROUP_DUMMY2 = 13,
DatetimeGroupType_MIN = DatetimeGroupType_GROUP_UNKNOWN,
DatetimeGroupType_MAX = DatetimeGroupType_GROUP_DUMMY2
};
inline DatetimeGroupType (&EnumValuesDatetimeGroupType())[14] {
static DatetimeGroupType values[] = {
DatetimeGroupType_GROUP_UNKNOWN,
DatetimeGroupType_GROUP_UNUSED,
DatetimeGroupType_GROUP_YEAR,
DatetimeGroupType_GROUP_MONTH,
DatetimeGroupType_GROUP_DAY,
DatetimeGroupType_GROUP_HOUR,
DatetimeGroupType_GROUP_MINUTE,
DatetimeGroupType_GROUP_SECOND,
DatetimeGroupType_GROUP_AMPM,
DatetimeGroupType_GROUP_RELATIONDISTANCE,
DatetimeGroupType_GROUP_RELATION,
DatetimeGroupType_GROUP_RELATIONTYPE,
DatetimeGroupType_GROUP_DUMMY1,
DatetimeGroupType_GROUP_DUMMY2
};
return values;
}
inline const char **EnumNamesDatetimeGroupType() {
static const char *names[] = {
"GROUP_UNKNOWN",
"GROUP_UNUSED",
"GROUP_YEAR",
"GROUP_MONTH",
"GROUP_DAY",
"GROUP_HOUR",
"GROUP_MINUTE",
"GROUP_SECOND",
"GROUP_AMPM",
"GROUP_RELATIONDISTANCE",
"GROUP_RELATION",
"GROUP_RELATIONTYPE",
"GROUP_DUMMY1",
"GROUP_DUMMY2",
nullptr
};
return names;
}
inline const char *EnumNameDatetimeGroupType(DatetimeGroupType e) {
const size_t index = static_cast<int>(e);
return EnumNamesDatetimeGroupType()[index];
}
namespace TokenizationCodepointRange_ {
enum Role {
Role_DEFAULT_ROLE = 0,
Role_SPLIT_BEFORE = 1,
Role_SPLIT_AFTER = 2,
Role_TOKEN_SEPARATOR = 3,
Role_DISCARD_CODEPOINT = 4,
Role_WHITESPACE_SEPARATOR = 7,
Role_MIN = Role_DEFAULT_ROLE,
Role_MAX = Role_WHITESPACE_SEPARATOR
};
inline Role (&EnumValuesRole())[6] {
static Role values[] = {
Role_DEFAULT_ROLE,
Role_SPLIT_BEFORE,
Role_SPLIT_AFTER,
Role_TOKEN_SEPARATOR,
Role_DISCARD_CODEPOINT,
Role_WHITESPACE_SEPARATOR
};
return values;
}
inline const char **EnumNamesRole() {
static const char *names[] = {
"DEFAULT_ROLE",
"SPLIT_BEFORE",
"SPLIT_AFTER",
"TOKEN_SEPARATOR",
"DISCARD_CODEPOINT",
"",
"",
"WHITESPACE_SEPARATOR",
nullptr
};
return names;
}
inline const char *EnumNameRole(Role e) {
const size_t index = static_cast<int>(e);
return EnumNamesRole()[index];
}
} // namespace TokenizationCodepointRange_
namespace FeatureProcessorOptions_ {
enum CenterTokenSelectionMethod {
CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD = 0,
CenterTokenSelectionMethod_CENTER_TOKEN_FROM_CLICK = 1,
CenterTokenSelectionMethod_CENTER_TOKEN_MIDDLE_OF_SELECTION = 2,
CenterTokenSelectionMethod_MIN = CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD,
CenterTokenSelectionMethod_MAX = CenterTokenSelectionMethod_CENTER_TOKEN_MIDDLE_OF_SELECTION
};
inline CenterTokenSelectionMethod (&EnumValuesCenterTokenSelectionMethod())[3] {
static CenterTokenSelectionMethod values[] = {
CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD,
CenterTokenSelectionMethod_CENTER_TOKEN_FROM_CLICK,
CenterTokenSelectionMethod_CENTER_TOKEN_MIDDLE_OF_SELECTION
};
return values;
}
inline const char **EnumNamesCenterTokenSelectionMethod() {
static const char *names[] = {
"DEFAULT_CENTER_TOKEN_METHOD",
"CENTER_TOKEN_FROM_CLICK",
"CENTER_TOKEN_MIDDLE_OF_SELECTION",
nullptr
};
return names;
}
inline const char *EnumNameCenterTokenSelectionMethod(CenterTokenSelectionMethod e) {
const size_t index = static_cast<int>(e);
return EnumNamesCenterTokenSelectionMethod()[index];
}
enum TokenizationType {
TokenizationType_INVALID_TOKENIZATION_TYPE = 0,
TokenizationType_INTERNAL_TOKENIZER = 1,
TokenizationType_ICU = 2,
TokenizationType_MIXED = 3,
TokenizationType_MIN = TokenizationType_INVALID_TOKENIZATION_TYPE,
TokenizationType_MAX = TokenizationType_MIXED
};
inline TokenizationType (&EnumValuesTokenizationType())[4] {
static TokenizationType values[] = {
TokenizationType_INVALID_TOKENIZATION_TYPE,
TokenizationType_INTERNAL_TOKENIZER,
TokenizationType_ICU,
TokenizationType_MIXED
};
return values;
}
inline const char **EnumNamesTokenizationType() {
static const char *names[] = {
"INVALID_TOKENIZATION_TYPE",
"INTERNAL_TOKENIZER",
"ICU",
"MIXED",
nullptr
};
return names;
}
inline const char *EnumNameTokenizationType(TokenizationType e) {
const size_t index = static_cast<int>(e);
return EnumNamesTokenizationType()[index];
}
} // namespace FeatureProcessorOptions_
struct CompressedBufferT : public flatbuffers::NativeTable {
typedef CompressedBuffer TableType;
std::vector<uint8_t> buffer;
int32_t uncompressed_size;
CompressedBufferT()
: uncompressed_size(0) {
}
};
struct CompressedBuffer FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef CompressedBufferT NativeTableType;
enum {
VT_BUFFER = 4,
VT_UNCOMPRESSED_SIZE = 6
};
const flatbuffers::Vector<uint8_t> *buffer() const {
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_BUFFER);
}
int32_t uncompressed_size() const {
return GetField<int32_t>(VT_UNCOMPRESSED_SIZE, 0);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_BUFFER) &&
verifier.Verify(buffer()) &&
VerifyField<int32_t>(verifier, VT_UNCOMPRESSED_SIZE) &&
verifier.EndTable();
}
CompressedBufferT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(CompressedBufferT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<CompressedBuffer> Pack(flatbuffers::FlatBufferBuilder &_fbb, const CompressedBufferT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct CompressedBufferBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_buffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> buffer) {
fbb_.AddOffset(CompressedBuffer::VT_BUFFER, buffer);
}
void add_uncompressed_size(int32_t uncompressed_size) {
fbb_.AddElement<int32_t>(CompressedBuffer::VT_UNCOMPRESSED_SIZE, uncompressed_size, 0);
}
explicit CompressedBufferBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
CompressedBufferBuilder &operator=(const CompressedBufferBuilder &);
flatbuffers::Offset<CompressedBuffer> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<CompressedBuffer>(end);
return o;
}
};
inline flatbuffers::Offset<CompressedBuffer> CreateCompressedBuffer(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> buffer = 0,
int32_t uncompressed_size = 0) {
CompressedBufferBuilder builder_(_fbb);
builder_.add_uncompressed_size(uncompressed_size);
builder_.add_buffer(buffer);
return builder_.Finish();
}
inline flatbuffers::Offset<CompressedBuffer> CreateCompressedBufferDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const std::vector<uint8_t> *buffer = nullptr,
int32_t uncompressed_size = 0) {
return libtextclassifier2::CreateCompressedBuffer(
_fbb,
buffer ? _fbb.CreateVector<uint8_t>(*buffer) : 0,
uncompressed_size);
}
flatbuffers::Offset<CompressedBuffer> CreateCompressedBuffer(flatbuffers::FlatBufferBuilder &_fbb, const CompressedBufferT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct SelectionModelOptionsT : public flatbuffers::NativeTable {
typedef SelectionModelOptions TableType;
bool strip_unpaired_brackets;
int32_t symmetry_context_size;
int32_t batch_size;
bool always_classify_suggested_selection;
SelectionModelOptionsT()
: strip_unpaired_brackets(true),
symmetry_context_size(0),
batch_size(1024),
always_classify_suggested_selection(false) {
}
};
struct SelectionModelOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef SelectionModelOptionsT NativeTableType;
enum {
VT_STRIP_UNPAIRED_BRACKETS = 4,
VT_SYMMETRY_CONTEXT_SIZE = 6,
VT_BATCH_SIZE = 8,
VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION = 10
};
bool strip_unpaired_brackets() const {
return GetField<uint8_t>(VT_STRIP_UNPAIRED_BRACKETS, 1) != 0;
}
int32_t symmetry_context_size() const {
return GetField<int32_t>(VT_SYMMETRY_CONTEXT_SIZE, 0);
}
int32_t batch_size() const {
return GetField<int32_t>(VT_BATCH_SIZE, 1024);
}
bool always_classify_suggested_selection() const {
return GetField<uint8_t>(VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION, 0) != 0;
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_STRIP_UNPAIRED_BRACKETS) &&
VerifyField<int32_t>(verifier, VT_SYMMETRY_CONTEXT_SIZE) &&
VerifyField<int32_t>(verifier, VT_BATCH_SIZE) &&
VerifyField<uint8_t>(verifier, VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION) &&
verifier.EndTable();
}
SelectionModelOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(SelectionModelOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<SelectionModelOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const SelectionModelOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct SelectionModelOptionsBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_strip_unpaired_brackets(bool strip_unpaired_brackets) {
fbb_.AddElement<uint8_t>(SelectionModelOptions::VT_STRIP_UNPAIRED_BRACKETS, static_cast<uint8_t>(strip_unpaired_brackets), 1);
}
void add_symmetry_context_size(int32_t symmetry_context_size) {
fbb_.AddElement<int32_t>(SelectionModelOptions::VT_SYMMETRY_CONTEXT_SIZE, symmetry_context_size, 0);
}
void add_batch_size(int32_t batch_size) {
fbb_.AddElement<int32_t>(SelectionModelOptions::VT_BATCH_SIZE, batch_size, 1024);
}
void add_always_classify_suggested_selection(bool always_classify_suggested_selection) {
fbb_.AddElement<uint8_t>(SelectionModelOptions::VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION, static_cast<uint8_t>(always_classify_suggested_selection), 0);
}
explicit SelectionModelOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
SelectionModelOptionsBuilder &operator=(const SelectionModelOptionsBuilder &);
flatbuffers::Offset<SelectionModelOptions> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<SelectionModelOptions>(end);
return o;
}
};
inline flatbuffers::Offset<SelectionModelOptions> CreateSelectionModelOptions(
flatbuffers::FlatBufferBuilder &_fbb,
bool strip_unpaired_brackets = true,
int32_t symmetry_context_size = 0,
int32_t batch_size = 1024,
bool always_classify_suggested_selection = false) {
SelectionModelOptionsBuilder builder_(_fbb);
builder_.add_batch_size(batch_size);
builder_.add_symmetry_context_size(symmetry_context_size);
builder_.add_always_classify_suggested_selection(always_classify_suggested_selection);
builder_.add_strip_unpaired_brackets(strip_unpaired_brackets);
return builder_.Finish();
}
flatbuffers::Offset<SelectionModelOptions> CreateSelectionModelOptions(flatbuffers::FlatBufferBuilder &_fbb, const SelectionModelOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct ClassificationModelOptionsT : public flatbuffers::NativeTable {
typedef ClassificationModelOptions TableType;
int32_t phone_min_num_digits;
int32_t phone_max_num_digits;
int32_t address_min_num_tokens;
int32_t max_num_tokens;
ClassificationModelOptionsT()
: phone_min_num_digits(7),
phone_max_num_digits(15),
address_min_num_tokens(0),
max_num_tokens(-1) {
}
};
struct ClassificationModelOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef ClassificationModelOptionsT NativeTableType;
enum {
VT_PHONE_MIN_NUM_DIGITS = 4,
VT_PHONE_MAX_NUM_DIGITS = 6,
VT_ADDRESS_MIN_NUM_TOKENS = 8,
VT_MAX_NUM_TOKENS = 10
};
int32_t phone_min_num_digits() const {
return GetField<int32_t>(VT_PHONE_MIN_NUM_DIGITS, 7);
}
int32_t phone_max_num_digits() const {
return GetField<int32_t>(VT_PHONE_MAX_NUM_DIGITS, 15);
}
int32_t address_min_num_tokens() const {
return GetField<int32_t>(VT_ADDRESS_MIN_NUM_TOKENS, 0);
}
int32_t max_num_tokens() const {
return GetField<int32_t>(VT_MAX_NUM_TOKENS, -1);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int32_t>(verifier, VT_PHONE_MIN_NUM_DIGITS) &&
VerifyField<int32_t>(verifier, VT_PHONE_MAX_NUM_DIGITS) &&
VerifyField<int32_t>(verifier, VT_ADDRESS_MIN_NUM_TOKENS) &&
VerifyField<int32_t>(verifier, VT_MAX_NUM_TOKENS) &&
verifier.EndTable();
}
ClassificationModelOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(ClassificationModelOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<ClassificationModelOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ClassificationModelOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct ClassificationModelOptionsBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_phone_min_num_digits(int32_t phone_min_num_digits) {
fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_PHONE_MIN_NUM_DIGITS, phone_min_num_digits, 7);
}
void add_phone_max_num_digits(int32_t phone_max_num_digits) {
fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_PHONE_MAX_NUM_DIGITS, phone_max_num_digits, 15);
}
void add_address_min_num_tokens(int32_t address_min_num_tokens) {
fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_ADDRESS_MIN_NUM_TOKENS, address_min_num_tokens, 0);
}
void add_max_num_tokens(int32_t max_num_tokens) {
fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_MAX_NUM_TOKENS, max_num_tokens, -1);
}
explicit ClassificationModelOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ClassificationModelOptionsBuilder &operator=(const ClassificationModelOptionsBuilder &);
flatbuffers::Offset<ClassificationModelOptions> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<ClassificationModelOptions>(end);
return o;
}
};
inline flatbuffers::Offset<ClassificationModelOptions> CreateClassificationModelOptions(
flatbuffers::FlatBufferBuilder &_fbb,
int32_t phone_min_num_digits = 7,
int32_t phone_max_num_digits = 15,
int32_t address_min_num_tokens = 0,
int32_t max_num_tokens = -1) {
ClassificationModelOptionsBuilder builder_(_fbb);
builder_.add_max_num_tokens(max_num_tokens);
builder_.add_address_min_num_tokens(address_min_num_tokens);
builder_.add_phone_max_num_digits(phone_max_num_digits);
builder_.add_phone_min_num_digits(phone_min_num_digits);
return builder_.Finish();
}
flatbuffers::Offset<ClassificationModelOptions> CreateClassificationModelOptions(flatbuffers::FlatBufferBuilder &_fbb, const ClassificationModelOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
namespace RegexModel_ {
struct PatternT : public flatbuffers::NativeTable {
typedef Pattern TableType;
std::string collection_name;
std::string pattern;
libtextclassifier2::ModeFlag enabled_modes;
float target_classification_score;
float priority_score;
bool use_approximate_matching;
std::unique_ptr<libtextclassifier2::CompressedBufferT> compressed_pattern;
PatternT()
: enabled_modes(libtextclassifier2::ModeFlag_ALL),
target_classification_score(1.0f),
priority_score(0.0f),
use_approximate_matching(false) {
}
};
struct Pattern FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef PatternT NativeTableType;
enum {
VT_COLLECTION_NAME = 4,
VT_PATTERN = 6,
VT_ENABLED_MODES = 8,
VT_TARGET_CLASSIFICATION_SCORE = 10,
VT_PRIORITY_SCORE = 12,
VT_USE_APPROXIMATE_MATCHING = 14,
VT_COMPRESSED_PATTERN = 16
};
const flatbuffers::String *collection_name() const {
return GetPointer<const flatbuffers::String *>(VT_COLLECTION_NAME);
}
const flatbuffers::String *pattern() const {
return GetPointer<const flatbuffers::String *>(VT_PATTERN);
}
libtextclassifier2::ModeFlag enabled_modes() const {
return static_cast<libtextclassifier2::ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7));
}
float target_classification_score() const {
return GetField<float>(VT_TARGET_CLASSIFICATION_SCORE, 1.0f);
}
float priority_score() const {
return GetField<float>(VT_PRIORITY_SCORE, 0.0f);
}
bool use_approximate_matching() const {
return GetField<uint8_t>(VT_USE_APPROXIMATE_MATCHING, 0) != 0;
}
const libtextclassifier2::CompressedBuffer *compressed_pattern() const {
return GetPointer<const libtextclassifier2::CompressedBuffer *>(VT_COMPRESSED_PATTERN);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_COLLECTION_NAME) &&
verifier.Verify(collection_name()) &&
VerifyOffset(verifier, VT_PATTERN) &&
verifier.Verify(pattern()) &&
VerifyField<int32_t>(verifier, VT_ENABLED_MODES) &&
VerifyField<float>(verifier, VT_TARGET_CLASSIFICATION_SCORE) &&
VerifyField<float>(verifier, VT_PRIORITY_SCORE) &&
VerifyField<uint8_t>(verifier, VT_USE_APPROXIMATE_MATCHING) &&
VerifyOffset(verifier, VT_COMPRESSED_PATTERN) &&
verifier.VerifyTable(compressed_pattern()) &&
verifier.EndTable();
}
PatternT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(PatternT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<Pattern> Pack(flatbuffers::FlatBufferBuilder &_fbb, const PatternT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct PatternBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_collection_name(flatbuffers::Offset<flatbuffers::String> collection_name) {
fbb_.AddOffset(Pattern::VT_COLLECTION_NAME, collection_name);
}
void add_pattern(flatbuffers::Offset<flatbuffers::String> pattern) {
fbb_.AddOffset(Pattern::VT_PATTERN, pattern);
}
void add_enabled_modes(libtextclassifier2::ModeFlag enabled_modes) {
fbb_.AddElement<int32_t>(Pattern::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7);
}
void add_target_classification_score(float target_classification_score) {
fbb_.AddElement<float>(Pattern::VT_TARGET_CLASSIFICATION_SCORE, target_classification_score, 1.0f);
}
void add_priority_score(float priority_score) {
fbb_.AddElement<float>(Pattern::VT_PRIORITY_SCORE, priority_score, 0.0f);
}
void add_use_approximate_matching(bool use_approximate_matching) {
fbb_.AddElement<uint8_t>(Pattern::VT_USE_APPROXIMATE_MATCHING, static_cast<uint8_t>(use_approximate_matching), 0);
}
void add_compressed_pattern(flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern) {
fbb_.AddOffset(Pattern::VT_COMPRESSED_PATTERN, compressed_pattern);
}
explicit PatternBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
PatternBuilder &operator=(const PatternBuilder &);
flatbuffers::Offset<Pattern> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Pattern>(end);
return o;
}
};
inline flatbuffers::Offset<Pattern> CreatePattern(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> collection_name = 0,
flatbuffers::Offset<flatbuffers::String> pattern = 0,
libtextclassifier2::ModeFlag enabled_modes = libtextclassifier2::ModeFlag_ALL,
float target_classification_score = 1.0f,
float priority_score = 0.0f,
bool use_approximate_matching = false,
flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) {
PatternBuilder builder_(_fbb);
builder_.add_compressed_pattern(compressed_pattern);
builder_.add_priority_score(priority_score);
builder_.add_target_classification_score(target_classification_score);
builder_.add_enabled_modes(enabled_modes);
builder_.add_pattern(pattern);
builder_.add_collection_name(collection_name);
builder_.add_use_approximate_matching(use_approximate_matching);
return builder_.Finish();
}
inline flatbuffers::Offset<Pattern> CreatePatternDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *collection_name = nullptr,
const char *pattern = nullptr,
libtextclassifier2::ModeFlag enabled_modes = libtextclassifier2::ModeFlag_ALL,
float target_classification_score = 1.0f,
float priority_score = 0.0f,
bool use_approximate_matching = false,
flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) {
return libtextclassifier2::RegexModel_::CreatePattern(
_fbb,
collection_name ? _fbb.CreateString(collection_name) : 0,
pattern ? _fbb.CreateString(pattern) : 0,
enabled_modes,
target_classification_score,
priority_score,
use_approximate_matching,
compressed_pattern);
}
flatbuffers::Offset<Pattern> CreatePattern(flatbuffers::FlatBufferBuilder &_fbb, const PatternT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
} // namespace RegexModel_
struct RegexModelT : public flatbuffers::NativeTable {
typedef RegexModel TableType;
std::vector<std::unique_ptr<libtextclassifier2::RegexModel_::PatternT>> patterns;
RegexModelT() {
}
};
struct RegexModel FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef RegexModelT NativeTableType;
enum {
VT_PATTERNS = 4
};
const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>> *patterns() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>> *>(VT_PATTERNS);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_PATTERNS) &&
verifier.Verify(patterns()) &&
verifier.VerifyVectorOfTables(patterns()) &&
verifier.EndTable();
}
RegexModelT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(RegexModelT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<RegexModel> Pack(flatbuffers::FlatBufferBuilder &_fbb, const RegexModelT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct RegexModelBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_patterns(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>>> patterns) {
fbb_.AddOffset(RegexModel::VT_PATTERNS, patterns);
}
explicit RegexModelBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
RegexModelBuilder &operator=(const RegexModelBuilder &);
flatbuffers::Offset<RegexModel> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<RegexModel>(end);
return o;
}
};
inline flatbuffers::Offset<RegexModel> CreateRegexModel(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>>> patterns = 0) {
RegexModelBuilder builder_(_fbb);
builder_.add_patterns(patterns);
return builder_.Finish();
}
inline flatbuffers::Offset<RegexModel> CreateRegexModelDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const std::vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>> *patterns = nullptr) {
return libtextclassifier2::CreateRegexModel(
_fbb,
patterns ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>>(*patterns) : 0);
}
flatbuffers::Offset<RegexModel> CreateRegexModel(flatbuffers::FlatBufferBuilder &_fbb, const RegexModelT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
namespace DatetimeModelPattern_ {
struct RegexT : public flatbuffers::NativeTable {
typedef Regex TableType;
std::string pattern;
std::vector<libtextclassifier2::DatetimeGroupType> groups;
std::unique_ptr<libtextclassifier2::CompressedBufferT> compressed_pattern;
RegexT() {
}
};
struct Regex FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef RegexT NativeTableType;
enum {
VT_PATTERN = 4,
VT_GROUPS = 6,
VT_COMPRESSED_PATTERN = 8
};
const flatbuffers::String *pattern() const {
return GetPointer<const flatbuffers::String *>(VT_PATTERN);
}
const flatbuffers::Vector<int32_t> *groups() const {
return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_GROUPS);
}
const libtextclassifier2::CompressedBuffer *compressed_pattern() const {
return GetPointer<const libtextclassifier2::CompressedBuffer *>(VT_COMPRESSED_PATTERN);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_PATTERN) &&
verifier.Verify(pattern()) &&
VerifyOffset(verifier, VT_GROUPS) &&
verifier.Verify(groups()) &&
VerifyOffset(verifier, VT_COMPRESSED_PATTERN) &&
verifier.VerifyTable(compressed_pattern()) &&
verifier.EndTable();
}
RegexT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(RegexT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<Regex> Pack(flatbuffers::FlatBufferBuilder &_fbb, const RegexT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct RegexBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_pattern(flatbuffers::Offset<flatbuffers::String> pattern) {
fbb_.AddOffset(Regex::VT_PATTERN, pattern);
}
void add_groups(flatbuffers::Offset<flatbuffers::Vector<int32_t>> groups) {
fbb_.AddOffset(Regex::VT_GROUPS, groups);
}
void add_compressed_pattern(flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern) {
fbb_.AddOffset(Regex::VT_COMPRESSED_PATTERN, compressed_pattern);
}
explicit RegexBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
RegexBuilder &operator=(const RegexBuilder &);
flatbuffers::Offset<Regex> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Regex>(end);
return o;
}
};
inline flatbuffers::Offset<Regex> CreateRegex(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> pattern = 0,
flatbuffers::Offset<flatbuffers::Vector<int32_t>> groups = 0,
flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) {
RegexBuilder builder_(_fbb);
builder_.add_compressed_pattern(compressed_pattern);
builder_.add_groups(groups);
builder_.add_pattern(pattern);
return builder_.Finish();
}
inline flatbuffers::Offset<Regex> CreateRegexDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *pattern = nullptr,
const std::vector<int32_t> *groups = nullptr,
flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) {
return libtextclassifier2::DatetimeModelPattern_::CreateRegex(
_fbb,
pattern ? _fbb.CreateString(pattern) : 0,
groups ? _fbb.CreateVector<int32_t>(*groups) : 0,
compressed_pattern);
}
flatbuffers::Offset<Regex> CreateRegex(flatbuffers::FlatBufferBuilder &_fbb, const RegexT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
} // namespace DatetimeModelPattern_
struct DatetimeModelPatternT : public flatbuffers::NativeTable {
typedef DatetimeModelPattern TableType;
std::vector<std::unique_ptr<libtextclassifier2::DatetimeModelPattern_::RegexT>> regexes;
std::vector<int32_t> locales;
float target_classification_score;
float priority_score;
ModeFlag enabled_modes;
DatetimeModelPatternT()
: target_classification_score(1.0f),
priority_score(0.0f),
enabled_modes(ModeFlag_ALL) {
}
};
struct DatetimeModelPattern FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef DatetimeModelPatternT NativeTableType;
enum {
VT_REGEXES = 4,
VT_LOCALES = 6,
VT_TARGET_CLASSIFICATION_SCORE = 8,
VT_PRIORITY_SCORE = 10,
VT_ENABLED_MODES = 12
};
const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>> *regexes() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>> *>(VT_REGEXES);
}
const flatbuffers::Vector<int32_t> *locales() const {
return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_LOCALES);
}
float target_classification_score() const {
return GetField<float>(VT_TARGET_CLASSIFICATION_SCORE, 1.0f);
}
float priority_score() const {
return GetField<float>(VT_PRIORITY_SCORE, 0.0f);
}
ModeFlag enabled_modes() const {
return static_cast<ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7));
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_REGEXES) &&
verifier.Verify(regexes()) &&
verifier.VerifyVectorOfTables(regexes()) &&
VerifyOffset(verifier, VT_LOCALES) &&
verifier.Verify(locales()) &&
VerifyField<float>(verifier, VT_TARGET_CLASSIFICATION_SCORE) &&
VerifyField<float>(verifier, VT_PRIORITY_SCORE) &&
VerifyField<int32_t>(verifier, VT_ENABLED_MODES) &&
verifier.EndTable();
}
DatetimeModelPatternT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(DatetimeModelPatternT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<DatetimeModelPattern> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelPatternT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct DatetimeModelPatternBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_regexes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>>> regexes) {
fbb_.AddOffset(DatetimeModelPattern::VT_REGEXES, regexes);
}
void add_locales(flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales) {
fbb_.AddOffset(DatetimeModelPattern::VT_LOCALES, locales);
}
void add_target_classification_score(float target_classification_score) {
fbb_.AddElement<float>(DatetimeModelPattern::VT_TARGET_CLASSIFICATION_SCORE, target_classification_score, 1.0f);
}
void add_priority_score(float priority_score) {
fbb_.AddElement<float>(DatetimeModelPattern::VT_PRIORITY_SCORE, priority_score, 0.0f);
}
void add_enabled_modes(ModeFlag enabled_modes) {
fbb_.AddElement<int32_t>(DatetimeModelPattern::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7);
}
explicit DatetimeModelPatternBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
DatetimeModelPatternBuilder &operator=(const DatetimeModelPatternBuilder &);
flatbuffers::Offset<DatetimeModelPattern> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<DatetimeModelPattern>(end);
return o;
}
};
inline flatbuffers::Offset<DatetimeModelPattern> CreateDatetimeModelPattern(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>>> regexes = 0,
flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales = 0,
float target_classification_score = 1.0f,
float priority_score = 0.0f,
ModeFlag enabled_modes = ModeFlag_ALL) {
DatetimeModelPatternBuilder builder_(_fbb);
builder_.add_enabled_modes(enabled_modes);
builder_.add_priority_score(priority_score);
builder_.add_target_classification_score(target_classification_score);
builder_.add_locales(locales);
builder_.add_regexes(regexes);
return builder_.Finish();
}
inline flatbuffers::Offset<DatetimeModelPattern> CreateDatetimeModelPatternDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const std::vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>> *regexes = nullptr,
const std::vector<int32_t> *locales = nullptr,
float target_classification_score = 1.0f,
float priority_score = 0.0f,
ModeFlag enabled_modes = ModeFlag_ALL) {
return libtextclassifier2::CreateDatetimeModelPattern(
_fbb,
regexes ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>>(*regexes) : 0,
locales ? _fbb.CreateVector<int32_t>(*locales) : 0,
target_classification_score,
priority_score,
enabled_modes);
}
flatbuffers::Offset<DatetimeModelPattern> CreateDatetimeModelPattern(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelPatternT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct DatetimeModelExtractorT : public flatbuffers::NativeTable {
typedef DatetimeModelExtractor TableType;
DatetimeExtractorType extractor;
std::string pattern;
std::vector<int32_t> locales;
std::unique_ptr<CompressedBufferT> compressed_pattern;
DatetimeModelExtractorT()
: extractor(DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE) {
}
};
struct DatetimeModelExtractor FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef DatetimeModelExtractorT NativeTableType;
enum {
VT_EXTRACTOR = 4,
VT_PATTERN = 6,
VT_LOCALES = 8,
VT_COMPRESSED_PATTERN = 10
};
DatetimeExtractorType extractor() const {
return static_cast<DatetimeExtractorType>(GetField<int32_t>(VT_EXTRACTOR, 0));
}
const flatbuffers::String *pattern() const {
return GetPointer<const flatbuffers::String *>(VT_PATTERN);
}
const flatbuffers::Vector<int32_t> *locales() const {
return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_LOCALES);
}
const CompressedBuffer *compressed_pattern() const {
return GetPointer<const CompressedBuffer *>(VT_COMPRESSED_PATTERN);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int32_t>(verifier, VT_EXTRACTOR) &&
VerifyOffset(verifier, VT_PATTERN) &&
verifier.Verify(pattern()) &&
VerifyOffset(verifier, VT_LOCALES) &&
verifier.Verify(locales()) &&
VerifyOffset(verifier, VT_COMPRESSED_PATTERN) &&
verifier.VerifyTable(compressed_pattern()) &&
verifier.EndTable();
}
DatetimeModelExtractorT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(DatetimeModelExtractorT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<DatetimeModelExtractor> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelExtractorT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct DatetimeModelExtractorBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_extractor(DatetimeExtractorType extractor) {
fbb_.AddElement<int32_t>(DatetimeModelExtractor::VT_EXTRACTOR, static_cast<int32_t>(extractor), 0);
}
void add_pattern(flatbuffers::Offset<flatbuffers::String> pattern) {
fbb_.AddOffset(DatetimeModelExtractor::VT_PATTERN, pattern);
}
void add_locales(flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales) {
fbb_.AddOffset(DatetimeModelExtractor::VT_LOCALES, locales);
}
void add_compressed_pattern(flatbuffers::Offset<CompressedBuffer> compressed_pattern) {
fbb_.AddOffset(DatetimeModelExtractor::VT_COMPRESSED_PATTERN, compressed_pattern);
}
explicit DatetimeModelExtractorBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
DatetimeModelExtractorBuilder &operator=(const DatetimeModelExtractorBuilder &);
flatbuffers::Offset<DatetimeModelExtractor> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<DatetimeModelExtractor>(end);
return o;
}
};
inline flatbuffers::Offset<DatetimeModelExtractor> CreateDatetimeModelExtractor(
flatbuffers::FlatBufferBuilder &_fbb,
DatetimeExtractorType extractor = DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE,
flatbuffers::Offset<flatbuffers::String> pattern = 0,
flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales = 0,
flatbuffers::Offset<CompressedBuffer> compressed_pattern = 0) {
DatetimeModelExtractorBuilder builder_(_fbb);
builder_.add_compressed_pattern(compressed_pattern);
builder_.add_locales(locales);
builder_.add_pattern(pattern);
builder_.add_extractor(extractor);
return builder_.Finish();
}
inline flatbuffers::Offset<DatetimeModelExtractor> CreateDatetimeModelExtractorDirect(
flatbuffers::FlatBufferBuilder &_fbb,
DatetimeExtractorType extractor = DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE,
const char *pattern = nullptr,
const std::vector<int32_t> *locales = nullptr,
flatbuffers::Offset<CompressedBuffer> compressed_pattern = 0) {
return libtextclassifier2::CreateDatetimeModelExtractor(
_fbb,
extractor,
pattern ? _fbb.CreateString(pattern) : 0,
locales ? _fbb.CreateVector<int32_t>(*locales) : 0,
compressed_pattern);
}
flatbuffers::Offset<DatetimeModelExtractor> CreateDatetimeModelExtractor(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelExtractorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct DatetimeModelT : public flatbuffers::NativeTable {
typedef DatetimeModel TableType;
std::vector<std::string> locales;
std::vector<std::unique_ptr<DatetimeModelPatternT>> patterns;
std::vector<std::unique_ptr<DatetimeModelExtractorT>> extractors;
bool use_extractors_for_locating;
std::vector<int32_t> default_locales;
DatetimeModelT()
: use_extractors_for_locating(true) {
}
};
struct DatetimeModel FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef DatetimeModelT NativeTableType;
enum {
VT_LOCALES = 4,
VT_PATTERNS = 6,
VT_EXTRACTORS = 8,
VT_USE_EXTRACTORS_FOR_LOCATING = 10,
VT_DEFAULT_LOCALES = 12
};
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *locales() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_LOCALES);
}
const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>> *patterns() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>> *>(VT_PATTERNS);
}
const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>> *extractors() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>> *>(VT_EXTRACTORS);
}
bool use_extractors_for_locating() const {
return GetField<uint8_t>(VT_USE_EXTRACTORS_FOR_LOCATING, 1) != 0;
}
const flatbuffers::Vector<int32_t> *default_locales() const {
return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_DEFAULT_LOCALES);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_LOCALES) &&
verifier.Verify(locales()) &&
verifier.VerifyVectorOfStrings(locales()) &&
VerifyOffset(verifier, VT_PATTERNS) &&
verifier.Verify(patterns()) &&
verifier.VerifyVectorOfTables(patterns()) &&
VerifyOffset(verifier, VT_EXTRACTORS) &&
verifier.Verify(extractors()) &&
verifier.VerifyVectorOfTables(extractors()) &&
VerifyField<uint8_t>(verifier, VT_USE_EXTRACTORS_FOR_LOCATING) &&
VerifyOffset(verifier, VT_DEFAULT_LOCALES) &&
verifier.Verify(default_locales()) &&
verifier.EndTable();
}
DatetimeModelT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(DatetimeModelT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<DatetimeModel> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct DatetimeModelBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_locales(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> locales) {
fbb_.AddOffset(DatetimeModel::VT_LOCALES, locales);
}
void add_patterns(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>>> patterns) {
fbb_.AddOffset(DatetimeModel::VT_PATTERNS, patterns);
}
void add_extractors(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>>> extractors) {
fbb_.AddOffset(DatetimeModel::VT_EXTRACTORS, extractors);
}
void add_use_extractors_for_locating(bool use_extractors_for_locating) {
fbb_.AddElement<uint8_t>(DatetimeModel::VT_USE_EXTRACTORS_FOR_LOCATING, static_cast<uint8_t>(use_extractors_for_locating), 1);
}
void add_default_locales(flatbuffers::Offset<flatbuffers::Vector<int32_t>> default_locales) {
fbb_.AddOffset(DatetimeModel::VT_DEFAULT_LOCALES, default_locales);
}
explicit DatetimeModelBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
DatetimeModelBuilder &operator=(const DatetimeModelBuilder &);
flatbuffers::Offset<DatetimeModel> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<DatetimeModel>(end);
return o;
}
};
inline flatbuffers::Offset<DatetimeModel> CreateDatetimeModel(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> locales = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>>> patterns = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>>> extractors = 0,
bool use_extractors_for_locating = true,
flatbuffers::Offset<flatbuffers::Vector<int32_t>> default_locales = 0) {
DatetimeModelBuilder builder_(_fbb);
builder_.add_default_locales(default_locales);
builder_.add_extractors(extractors);
builder_.add_patterns(patterns);
builder_.add_locales(locales);
builder_.add_use_extractors_for_locating(use_extractors_for_locating);
return builder_.Finish();
}
inline flatbuffers::Offset<DatetimeModel> CreateDatetimeModelDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *locales = nullptr,
const std::vector<flatbuffers::Offset<DatetimeModelPattern>> *patterns = nullptr,
const std::vector<flatbuffers::Offset<DatetimeModelExtractor>> *extractors = nullptr,
bool use_extractors_for_locating = true,
const std::vector<int32_t> *default_locales = nullptr) {
return libtextclassifier2::CreateDatetimeModel(
_fbb,
locales ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*locales) : 0,
patterns ? _fbb.CreateVector<flatbuffers::Offset<DatetimeModelPattern>>(*patterns) : 0,
extractors ? _fbb.CreateVector<flatbuffers::Offset<DatetimeModelExtractor>>(*extractors) : 0,
use_extractors_for_locating,
default_locales ? _fbb.CreateVector<int32_t>(*default_locales) : 0);
}
flatbuffers::Offset<DatetimeModel> CreateDatetimeModel(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
namespace DatetimeModelLibrary_ {
struct ItemT : public flatbuffers::NativeTable {
typedef Item TableType;
std::string key;
std::unique_ptr<libtextclassifier2::DatetimeModelT> value;
ItemT() {
}
};
struct Item FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef ItemT NativeTableType;
enum {
VT_KEY = 4,
VT_VALUE = 6
};
const flatbuffers::String *key() const {
return GetPointer<const flatbuffers::String *>(VT_KEY);
}
const libtextclassifier2::DatetimeModel *value() const {
return GetPointer<const libtextclassifier2::DatetimeModel *>(VT_VALUE);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_KEY) &&
verifier.Verify(key()) &&
VerifyOffset(verifier, VT_VALUE) &&
verifier.VerifyTable(value()) &&
verifier.EndTable();
}
ItemT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(ItemT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<Item> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ItemT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct ItemBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_key(flatbuffers::Offset<flatbuffers::String> key) {
fbb_.AddOffset(Item::VT_KEY, key);
}
void add_value(flatbuffers::Offset<libtextclassifier2::DatetimeModel> value) {
fbb_.AddOffset(Item::VT_VALUE, value);
}
explicit ItemBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ItemBuilder &operator=(const ItemBuilder &);
flatbuffers::Offset<Item> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Item>(end);
return o;
}
};
inline flatbuffers::Offset<Item> CreateItem(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> key = 0,
flatbuffers::Offset<libtextclassifier2::DatetimeModel> value = 0) {
ItemBuilder builder_(_fbb);
builder_.add_value(value);
builder_.add_key(key);
return builder_.Finish();
}
inline flatbuffers::Offset<Item> CreateItemDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *key = nullptr,
flatbuffers::Offset<libtextclassifier2::DatetimeModel> value = 0) {
return libtextclassifier2::DatetimeModelLibrary_::CreateItem(
_fbb,
key ? _fbb.CreateString(key) : 0,
value);
}
flatbuffers::Offset<Item> CreateItem(flatbuffers::FlatBufferBuilder &_fbb, const ItemT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
} // namespace DatetimeModelLibrary_
struct DatetimeModelLibraryT : public flatbuffers::NativeTable {
typedef DatetimeModelLibrary TableType;
std::vector<std::unique_ptr<libtextclassifier2::DatetimeModelLibrary_::ItemT>> models;
DatetimeModelLibraryT() {
}
};
struct DatetimeModelLibrary FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef DatetimeModelLibraryT NativeTableType;
enum {
VT_MODELS = 4
};
const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>> *models() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>> *>(VT_MODELS);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_MODELS) &&
verifier.Verify(models()) &&
verifier.VerifyVectorOfTables(models()) &&
verifier.EndTable();
}
DatetimeModelLibraryT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(DatetimeModelLibraryT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<DatetimeModelLibrary> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelLibraryT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct DatetimeModelLibraryBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_models(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>>> models) {
fbb_.AddOffset(DatetimeModelLibrary::VT_MODELS, models);
}
explicit DatetimeModelLibraryBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
DatetimeModelLibraryBuilder &operator=(const DatetimeModelLibraryBuilder &);
flatbuffers::Offset<DatetimeModelLibrary> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<DatetimeModelLibrary>(end);
return o;
}
};
inline flatbuffers::Offset<DatetimeModelLibrary> CreateDatetimeModelLibrary(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>>> models = 0) {
DatetimeModelLibraryBuilder builder_(_fbb);
builder_.add_models(models);
return builder_.Finish();
}
inline flatbuffers::Offset<DatetimeModelLibrary> CreateDatetimeModelLibraryDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const std::vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>> *models = nullptr) {
return libtextclassifier2::CreateDatetimeModelLibrary(
_fbb,
models ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>>(*models) : 0);
}
flatbuffers::Offset<DatetimeModelLibrary> CreateDatetimeModelLibrary(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelLibraryT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct ModelTriggeringOptionsT : public flatbuffers::NativeTable {
typedef ModelTriggeringOptions TableType;
float min_annotate_confidence;
ModeFlag enabled_modes;
ModelTriggeringOptionsT()
: min_annotate_confidence(0.0f),
enabled_modes(ModeFlag_ALL) {
}
};
struct ModelTriggeringOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef ModelTriggeringOptionsT NativeTableType;
enum {
VT_MIN_ANNOTATE_CONFIDENCE = 4,
VT_ENABLED_MODES = 6
};
float min_annotate_confidence() const {
return GetField<float>(VT_MIN_ANNOTATE_CONFIDENCE, 0.0f);
}
ModeFlag enabled_modes() const {
return static_cast<ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7));
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<float>(verifier, VT_MIN_ANNOTATE_CONFIDENCE) &&
VerifyField<int32_t>(verifier, VT_ENABLED_MODES) &&
verifier.EndTable();
}
ModelTriggeringOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(ModelTriggeringOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<ModelTriggeringOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelTriggeringOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct ModelTriggeringOptionsBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_min_annotate_confidence(float min_annotate_confidence) {
fbb_.AddElement<float>(ModelTriggeringOptions::VT_MIN_ANNOTATE_CONFIDENCE, min_annotate_confidence, 0.0f);
}
void add_enabled_modes(ModeFlag enabled_modes) {
fbb_.AddElement<int32_t>(ModelTriggeringOptions::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7);
}
explicit ModelTriggeringOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ModelTriggeringOptionsBuilder &operator=(const ModelTriggeringOptionsBuilder &);
flatbuffers::Offset<ModelTriggeringOptions> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<ModelTriggeringOptions>(end);
return o;
}
};
inline flatbuffers::Offset<ModelTriggeringOptions> CreateModelTriggeringOptions(
flatbuffers::FlatBufferBuilder &_fbb,
float min_annotate_confidence = 0.0f,
ModeFlag enabled_modes = ModeFlag_ALL) {
ModelTriggeringOptionsBuilder builder_(_fbb);
builder_.add_enabled_modes(enabled_modes);
builder_.add_min_annotate_confidence(min_annotate_confidence);
return builder_.Finish();
}
flatbuffers::Offset<ModelTriggeringOptions> CreateModelTriggeringOptions(flatbuffers::FlatBufferBuilder &_fbb, const ModelTriggeringOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct OutputOptionsT : public flatbuffers::NativeTable {
typedef OutputOptions TableType;
std::vector<std::string> filtered_collections_annotation;
std::vector<std::string> filtered_collections_classification;
std::vector<std::string> filtered_collections_selection;
OutputOptionsT() {
}
};
struct OutputOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef OutputOptionsT NativeTableType;
enum {
VT_FILTERED_COLLECTIONS_ANNOTATION = 4,
VT_FILTERED_COLLECTIONS_CLASSIFICATION = 6,
VT_FILTERED_COLLECTIONS_SELECTION = 8
};
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_annotation() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_FILTERED_COLLECTIONS_ANNOTATION);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_classification() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_FILTERED_COLLECTIONS_CLASSIFICATION);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_selection() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_FILTERED_COLLECTIONS_SELECTION);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_FILTERED_COLLECTIONS_ANNOTATION) &&
verifier.Verify(filtered_collections_annotation()) &&
verifier.VerifyVectorOfStrings(filtered_collections_annotation()) &&
VerifyOffset(verifier, VT_FILTERED_COLLECTIONS_CLASSIFICATION) &&
verifier.Verify(filtered_collections_classification()) &&
verifier.VerifyVectorOfStrings(filtered_collections_classification()) &&
VerifyOffset(verifier, VT_FILTERED_COLLECTIONS_SELECTION) &&
verifier.Verify(filtered_collections_selection()) &&
verifier.VerifyVectorOfStrings(filtered_collections_selection()) &&
verifier.EndTable();
}
OutputOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(OutputOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<OutputOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const OutputOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct OutputOptionsBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_filtered_collections_annotation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_annotation) {
fbb_.AddOffset(OutputOptions::VT_FILTERED_COLLECTIONS_ANNOTATION, filtered_collections_annotation);
}
void add_filtered_collections_classification(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_classification) {
fbb_.AddOffset(OutputOptions::VT_FILTERED_COLLECTIONS_CLASSIFICATION, filtered_collections_classification);
}
void add_filtered_collections_selection(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_selection) {
fbb_.AddOffset(OutputOptions::VT_FILTERED_COLLECTIONS_SELECTION, filtered_collections_selection);
}
explicit OutputOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
OutputOptionsBuilder &operator=(const OutputOptionsBuilder &);
flatbuffers::Offset<OutputOptions> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<OutputOptions>(end);
return o;
}
};
inline flatbuffers::Offset<OutputOptions> CreateOutputOptions(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_annotation = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_classification = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_selection = 0) {
OutputOptionsBuilder builder_(_fbb);
builder_.add_filtered_collections_selection(filtered_collections_selection);
builder_.add_filtered_collections_classification(filtered_collections_classification);
builder_.add_filtered_collections_annotation(filtered_collections_annotation);
return builder_.Finish();
}
inline flatbuffers::Offset<OutputOptions> CreateOutputOptionsDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_annotation = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_classification = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_selection = nullptr) {
return libtextclassifier2::CreateOutputOptions(
_fbb,
filtered_collections_annotation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*filtered_collections_annotation) : 0,
filtered_collections_classification ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*filtered_collections_classification) : 0,
filtered_collections_selection ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*filtered_collections_selection) : 0);
}
flatbuffers::Offset<OutputOptions> CreateOutputOptions(flatbuffers::FlatBufferBuilder &_fbb, const OutputOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct ModelT : public flatbuffers::NativeTable {
typedef Model TableType;
std::string locales;
int32_t version;
std::string name;
std::unique_ptr<FeatureProcessorOptionsT> selection_feature_options;
std::unique_ptr<FeatureProcessorOptionsT> classification_feature_options;
std::vector<uint8_t> selection_model;
std::vector<uint8_t> classification_model;
std::vector<uint8_t> embedding_model;
std::unique_ptr<SelectionModelOptionsT> selection_options;
std::unique_ptr<ClassificationModelOptionsT> classification_options;
std::unique_ptr<RegexModelT> regex_model;
std::unique_ptr<DatetimeModelT> datetime_model;
std::unique_ptr<ModelTriggeringOptionsT> triggering_options;
ModeFlag enabled_modes;
bool snap_whitespace_selections;
std::unique_ptr<OutputOptionsT> output_options;
ModelT()
: version(0),
enabled_modes(ModeFlag_ALL),
snap_whitespace_selections(true) {
}
};
struct Model FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef ModelT NativeTableType;
enum {
VT_LOCALES = 4,
VT_VERSION = 6,
VT_NAME = 8,
VT_SELECTION_FEATURE_OPTIONS = 10,
VT_CLASSIFICATION_FEATURE_OPTIONS = 12,
VT_SELECTION_MODEL = 14,
VT_CLASSIFICATION_MODEL = 16,
VT_EMBEDDING_MODEL = 18,
VT_SELECTION_OPTIONS = 20,
VT_CLASSIFICATION_OPTIONS = 22,
VT_REGEX_MODEL = 24,
VT_DATETIME_MODEL = 26,
VT_TRIGGERING_OPTIONS = 28,
VT_ENABLED_MODES = 30,
VT_SNAP_WHITESPACE_SELECTIONS = 32,
VT_OUTPUT_OPTIONS = 34
};
const flatbuffers::String *locales() const {
return GetPointer<const flatbuffers::String *>(VT_LOCALES);
}
int32_t version() const {
return GetField<int32_t>(VT_VERSION, 0);
}
const flatbuffers::String *name() const {
return GetPointer<const flatbuffers::String *>(VT_NAME);
}
const FeatureProcessorOptions *selection_feature_options() const {
return GetPointer<const FeatureProcessorOptions *>(VT_SELECTION_FEATURE_OPTIONS);
}
const FeatureProcessorOptions *classification_feature_options() const {
return GetPointer<const FeatureProcessorOptions *>(VT_CLASSIFICATION_FEATURE_OPTIONS);
}
const flatbuffers::Vector<uint8_t> *selection_model() const {
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_SELECTION_MODEL);
}
const flatbuffers::Vector<uint8_t> *classification_model() const {
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_CLASSIFICATION_MODEL);
}
const flatbuffers::Vector<uint8_t> *embedding_model() const {
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_EMBEDDING_MODEL);
}
const SelectionModelOptions *selection_options() const {
return GetPointer<const SelectionModelOptions *>(VT_SELECTION_OPTIONS);
}
const ClassificationModelOptions *classification_options() const {
return GetPointer<const ClassificationModelOptions *>(VT_CLASSIFICATION_OPTIONS);
}
const RegexModel *regex_model() const {
return GetPointer<const RegexModel *>(VT_REGEX_MODEL);
}
const DatetimeModel *datetime_model() const {
return GetPointer<const DatetimeModel *>(VT_DATETIME_MODEL);
}
const ModelTriggeringOptions *triggering_options() const {
return GetPointer<const ModelTriggeringOptions *>(VT_TRIGGERING_OPTIONS);
}
ModeFlag enabled_modes() const {
return static_cast<ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7));
}
bool snap_whitespace_selections() const {
return GetField<uint8_t>(VT_SNAP_WHITESPACE_SELECTIONS, 1) != 0;
}
const OutputOptions *output_options() const {
return GetPointer<const OutputOptions *>(VT_OUTPUT_OPTIONS);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_LOCALES) &&
verifier.Verify(locales()) &&
VerifyField<int32_t>(verifier, VT_VERSION) &&
VerifyOffset(verifier, VT_NAME) &&
verifier.Verify(name()) &&
VerifyOffset(verifier, VT_SELECTION_FEATURE_OPTIONS) &&
verifier.VerifyTable(selection_feature_options()) &&
VerifyOffset(verifier, VT_CLASSIFICATION_FEATURE_OPTIONS) &&
verifier.VerifyTable(classification_feature_options()) &&
VerifyOffset(verifier, VT_SELECTION_MODEL) &&
verifier.Verify(selection_model()) &&
VerifyOffset(verifier, VT_CLASSIFICATION_MODEL) &&
verifier.Verify(classification_model()) &&
VerifyOffset(verifier, VT_EMBEDDING_MODEL) &&
verifier.Verify(embedding_model()) &&
VerifyOffset(verifier, VT_SELECTION_OPTIONS) &&
verifier.VerifyTable(selection_options()) &&
VerifyOffset(verifier, VT_CLASSIFICATION_OPTIONS) &&
verifier.VerifyTable(classification_options()) &&
VerifyOffset(verifier, VT_REGEX_MODEL) &&
verifier.VerifyTable(regex_model()) &&
VerifyOffset(verifier, VT_DATETIME_MODEL) &&
verifier.VerifyTable(datetime_model()) &&
VerifyOffset(verifier, VT_TRIGGERING_OPTIONS) &&
verifier.VerifyTable(triggering_options()) &&
VerifyField<int32_t>(verifier, VT_ENABLED_MODES) &&
VerifyField<uint8_t>(verifier, VT_SNAP_WHITESPACE_SELECTIONS) &&
VerifyOffset(verifier, VT_OUTPUT_OPTIONS) &&
verifier.VerifyTable(output_options()) &&
verifier.EndTable();
}
ModelT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(ModelT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<Model> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct ModelBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_locales(flatbuffers::Offset<flatbuffers::String> locales) {
fbb_.AddOffset(Model::VT_LOCALES, locales);
}
void add_version(int32_t version) {
fbb_.AddElement<int32_t>(Model::VT_VERSION, version, 0);
}
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(Model::VT_NAME, name);
}
void add_selection_feature_options(flatbuffers::Offset<FeatureProcessorOptions> selection_feature_options) {
fbb_.AddOffset(Model::VT_SELECTION_FEATURE_OPTIONS, selection_feature_options);
}
void add_classification_feature_options(flatbuffers::Offset<FeatureProcessorOptions> classification_feature_options) {
fbb_.AddOffset(Model::VT_CLASSIFICATION_FEATURE_OPTIONS, classification_feature_options);
}
void add_selection_model(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> selection_model) {
fbb_.AddOffset(Model::VT_SELECTION_MODEL, selection_model);
}
void add_classification_model(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> classification_model) {
fbb_.AddOffset(Model::VT_CLASSIFICATION_MODEL, classification_model);
}
void add_embedding_model(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> embedding_model) {
fbb_.AddOffset(Model::VT_EMBEDDING_MODEL, embedding_model);
}
void add_selection_options(flatbuffers::Offset<SelectionModelOptions> selection_options) {
fbb_.AddOffset(Model::VT_SELECTION_OPTIONS, selection_options);
}
void add_classification_options(flatbuffers::Offset<ClassificationModelOptions> classification_options) {
fbb_.AddOffset(Model::VT_CLASSIFICATION_OPTIONS, classification_options);
}
void add_regex_model(flatbuffers::Offset<RegexModel> regex_model) {
fbb_.AddOffset(Model::VT_REGEX_MODEL, regex_model);
}
void add_datetime_model(flatbuffers::Offset<DatetimeModel> datetime_model) {
fbb_.AddOffset(Model::VT_DATETIME_MODEL, datetime_model);
}
void add_triggering_options(flatbuffers::Offset<ModelTriggeringOptions> triggering_options) {
fbb_.AddOffset(Model::VT_TRIGGERING_OPTIONS, triggering_options);
}
void add_enabled_modes(ModeFlag enabled_modes) {
fbb_.AddElement<int32_t>(Model::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7);
}
void add_snap_whitespace_selections(bool snap_whitespace_selections) {
fbb_.AddElement<uint8_t>(Model::VT_SNAP_WHITESPACE_SELECTIONS, static_cast<uint8_t>(snap_whitespace_selections), 1);
}
void add_output_options(flatbuffers::Offset<OutputOptions> output_options) {
fbb_.AddOffset(Model::VT_OUTPUT_OPTIONS, output_options);
}
explicit ModelBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ModelBuilder &operator=(const ModelBuilder &);
flatbuffers::Offset<Model> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Model>(end);
return o;
}
};
inline flatbuffers::Offset<Model> CreateModel(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> locales = 0,
int32_t version = 0,
flatbuffers::Offset<flatbuffers::String> name = 0,
flatbuffers::Offset<FeatureProcessorOptions> selection_feature_options = 0,
flatbuffers::Offset<FeatureProcessorOptions> classification_feature_options = 0,
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> selection_model = 0,
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> classification_model = 0,
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> embedding_model = 0,
flatbuffers::Offset<SelectionModelOptions> selection_options = 0,
flatbuffers::Offset<ClassificationModelOptions> classification_options = 0,
flatbuffers::Offset<RegexModel> regex_model = 0,
flatbuffers::Offset<DatetimeModel> datetime_model = 0,
flatbuffers::Offset<ModelTriggeringOptions> triggering_options = 0,
ModeFlag enabled_modes = ModeFlag_ALL,
bool snap_whitespace_selections = true,
flatbuffers::Offset<OutputOptions> output_options = 0) {
ModelBuilder builder_(_fbb);
builder_.add_output_options(output_options);
builder_.add_enabled_modes(enabled_modes);
builder_.add_triggering_options(triggering_options);
builder_.add_datetime_model(datetime_model);
builder_.add_regex_model(regex_model);
builder_.add_classification_options(classification_options);
builder_.add_selection_options(selection_options);
builder_.add_embedding_model(embedding_model);
builder_.add_classification_model(classification_model);
builder_.add_selection_model(selection_model);
builder_.add_classification_feature_options(classification_feature_options);
builder_.add_selection_feature_options(selection_feature_options);
builder_.add_name(name);
builder_.add_version(version);
builder_.add_locales(locales);
builder_.add_snap_whitespace_selections(snap_whitespace_selections);
return builder_.Finish();
}
inline flatbuffers::Offset<Model> CreateModelDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *locales = nullptr,
int32_t version = 0,
const char *name = nullptr,
flatbuffers::Offset<FeatureProcessorOptions> selection_feature_options = 0,
flatbuffers::Offset<FeatureProcessorOptions> classification_feature_options = 0,
const std::vector<uint8_t> *selection_model = nullptr,
const std::vector<uint8_t> *classification_model = nullptr,
const std::vector<uint8_t> *embedding_model = nullptr,
flatbuffers::Offset<SelectionModelOptions> selection_options = 0,
flatbuffers::Offset<ClassificationModelOptions> classification_options = 0,
flatbuffers::Offset<RegexModel> regex_model = 0,
flatbuffers::Offset<DatetimeModel> datetime_model = 0,
flatbuffers::Offset<ModelTriggeringOptions> triggering_options = 0,
ModeFlag enabled_modes = ModeFlag_ALL,
bool snap_whitespace_selections = true,
flatbuffers::Offset<OutputOptions> output_options = 0) {
return libtextclassifier2::CreateModel(
_fbb,
locales ? _fbb.CreateString(locales) : 0,
version,
name ? _fbb.CreateString(name) : 0,
selection_feature_options,
classification_feature_options,
selection_model ? _fbb.CreateVector<uint8_t>(*selection_model) : 0,
classification_model ? _fbb.CreateVector<uint8_t>(*classification_model) : 0,
embedding_model ? _fbb.CreateVector<uint8_t>(*embedding_model) : 0,
selection_options,
classification_options,
regex_model,
datetime_model,
triggering_options,
enabled_modes,
snap_whitespace_selections,
output_options);
}
flatbuffers::Offset<Model> CreateModel(flatbuffers::FlatBufferBuilder &_fbb, const ModelT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct TokenizationCodepointRangeT : public flatbuffers::NativeTable {
typedef TokenizationCodepointRange TableType;
int32_t start;
int32_t end;
libtextclassifier2::TokenizationCodepointRange_::Role role;
int32_t script_id;
TokenizationCodepointRangeT()
: start(0),
end(0),
role(libtextclassifier2::TokenizationCodepointRange_::Role_DEFAULT_ROLE),
script_id(0) {
}
};
struct TokenizationCodepointRange FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef TokenizationCodepointRangeT NativeTableType;
enum {
VT_START = 4,
VT_END = 6,
VT_ROLE = 8,
VT_SCRIPT_ID = 10
};
int32_t start() const {
return GetField<int32_t>(VT_START, 0);
}
int32_t end() const {
return GetField<int32_t>(VT_END, 0);
}
libtextclassifier2::TokenizationCodepointRange_::Role role() const {
return static_cast<libtextclassifier2::TokenizationCodepointRange_::Role>(GetField<int32_t>(VT_ROLE, 0));
}
int32_t script_id() const {
return GetField<int32_t>(VT_SCRIPT_ID, 0);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int32_t>(verifier, VT_START) &&
VerifyField<int32_t>(verifier, VT_END) &&
VerifyField<int32_t>(verifier, VT_ROLE) &&
VerifyField<int32_t>(verifier, VT_SCRIPT_ID) &&
verifier.EndTable();
}
TokenizationCodepointRangeT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(TokenizationCodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<TokenizationCodepointRange> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct TokenizationCodepointRangeBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_start(int32_t start) {
fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_START, start, 0);
}
void add_end(int32_t end) {
fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_END, end, 0);
}
void add_role(libtextclassifier2::TokenizationCodepointRange_::Role role) {
fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_ROLE, static_cast<int32_t>(role), 0);
}
void add_script_id(int32_t script_id) {
fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_SCRIPT_ID, script_id, 0);
}
explicit TokenizationCodepointRangeBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
TokenizationCodepointRangeBuilder &operator=(const TokenizationCodepointRangeBuilder &);
flatbuffers::Offset<TokenizationCodepointRange> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TokenizationCodepointRange>(end);
return o;
}
};
inline flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange(
flatbuffers::FlatBufferBuilder &_fbb,
int32_t start = 0,
int32_t end = 0,
libtextclassifier2::TokenizationCodepointRange_::Role role = libtextclassifier2::TokenizationCodepointRange_::Role_DEFAULT_ROLE,
int32_t script_id = 0) {
TokenizationCodepointRangeBuilder builder_(_fbb);
builder_.add_script_id(script_id);
builder_.add_role(role);
builder_.add_end(end);
builder_.add_start(start);
return builder_.Finish();
}
flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
namespace FeatureProcessorOptions_ {
struct CodepointRangeT : public flatbuffers::NativeTable {
typedef CodepointRange TableType;
int32_t start;
int32_t end;
CodepointRangeT()
: start(0),
end(0) {
}
};
struct CodepointRange FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef CodepointRangeT NativeTableType;
enum {
VT_START = 4,
VT_END = 6
};
int32_t start() const {
return GetField<int32_t>(VT_START, 0);
}
int32_t end() const {
return GetField<int32_t>(VT_END, 0);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int32_t>(verifier, VT_START) &&
VerifyField<int32_t>(verifier, VT_END) &&
verifier.EndTable();
}
CodepointRangeT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(CodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<CodepointRange> Pack(flatbuffers::FlatBufferBuilder &_fbb, const CodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct CodepointRangeBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_start(int32_t start) {
fbb_.AddElement<int32_t>(CodepointRange::VT_START, start, 0);
}
void add_end(int32_t end) {
fbb_.AddElement<int32_t>(CodepointRange::VT_END, end, 0);
}
explicit CodepointRangeBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
CodepointRangeBuilder &operator=(const CodepointRangeBuilder &);
flatbuffers::Offset<CodepointRange> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<CodepointRange>(end);
return o;
}
};
inline flatbuffers::Offset<CodepointRange> CreateCodepointRange(
flatbuffers::FlatBufferBuilder &_fbb,
int32_t start = 0,
int32_t end = 0) {
CodepointRangeBuilder builder_(_fbb);
builder_.add_end(end);
builder_.add_start(start);
return builder_.Finish();
}
flatbuffers::Offset<CodepointRange> CreateCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const CodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
struct BoundsSensitiveFeaturesT : public flatbuffers::NativeTable {
typedef BoundsSensitiveFeatures TableType;
bool enabled;
int32_t num_tokens_before;
int32_t num_tokens_inside_left;
int32_t num_tokens_inside_right;
int32_t num_tokens_after;
bool include_inside_bag;
bool include_inside_length;
bool score_single_token_spans_as_zero;
BoundsSensitiveFeaturesT()
: enabled(false),
num_tokens_before(0),
num_tokens_inside_left(0),
num_tokens_inside_right(0),
num_tokens_after(0),
include_inside_bag(false),
include_inside_length(false),
score_single_token_spans_as_zero(false) {
}
};
struct BoundsSensitiveFeatures FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef BoundsSensitiveFeaturesT NativeTableType;
enum {
VT_ENABLED = 4,
VT_NUM_TOKENS_BEFORE = 6,
VT_NUM_TOKENS_INSIDE_LEFT = 8,
VT_NUM_TOKENS_INSIDE_RIGHT = 10,
VT_NUM_TOKENS_AFTER = 12,
VT_INCLUDE_INSIDE_BAG = 14,
VT_INCLUDE_INSIDE_LENGTH = 16,
VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO = 18
};
bool enabled() const {
return GetField<uint8_t>(VT_ENABLED, 0) != 0;
}
int32_t num_tokens_before() const {
return GetField<int32_t>(VT_NUM_TOKENS_BEFORE, 0);
}
int32_t num_tokens_inside_left() const {
return GetField<int32_t>(VT_NUM_TOKENS_INSIDE_LEFT, 0);
}
int32_t num_tokens_inside_right() const {
return GetField<int32_t>(VT_NUM_TOKENS_INSIDE_RIGHT, 0);
}
int32_t num_tokens_after() const {
return GetField<int32_t>(VT_NUM_TOKENS_AFTER, 0);
}
bool include_inside_bag() const {
return GetField<uint8_t>(VT_INCLUDE_INSIDE_BAG, 0) != 0;
}
bool include_inside_length() const {
return GetField<uint8_t>(VT_INCLUDE_INSIDE_LENGTH, 0) != 0;
}
bool score_single_token_spans_as_zero() const {
return GetField<uint8_t>(VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO, 0) != 0;
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_ENABLED) &&
VerifyField<int32_t>(verifier, VT_NUM_TOKENS_BEFORE) &&
VerifyField<int32_t>(verifier, VT_NUM_TOKENS_INSIDE_LEFT) &&
VerifyField<int32_t>(verifier, VT_NUM_TOKENS_INSIDE_RIGHT) &&
VerifyField<int32_t>(verifier, VT_NUM_TOKENS_AFTER) &&
VerifyField<uint8_t>(verifier, VT_INCLUDE_INSIDE_BAG) &&
VerifyField<uint8_t>(verifier, VT_INCLUDE_INSIDE_LENGTH) &&
VerifyField<uint8_t>(verifier, VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO) &&
verifier.EndTable();
}
BoundsSensitiveFeaturesT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(BoundsSensitiveFeaturesT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<BoundsSensitiveFeatures> Pack(flatbuffers::FlatBufferBuilder &_fbb, const BoundsSensitiveFeaturesT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};
struct BoundsSensitiveFeaturesBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_enabled(bool enabled) {
fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_ENABLED, static_cast<uint8_t>(enabled), 0);
}
void add_num_tokens_before(int32_t num_tokens_before) {
fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_BEFORE, num_tokens_before, 0);
}
void add_num_tokens_inside_left(int32_t num_tokens_inside_left) {
fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_INSIDE_LEFT, num_tokens_inside_left, 0);
}
void add_num_tokens_inside_right(int32_t num_tokens_inside_right) {
fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_INSIDE_RIGHT, num_tokens_inside_right, 0);
}
void add_num_tokens_after(int32_t num_tokens_after) {
fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_AFTER, num_tokens_after, 0);
}
void add_include_inside_bag(bool include_inside_bag) {
fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_INCLUDE_INSIDE_BAG, static_cast<uint8_t>(include_inside_bag), 0);
}
void add_include_inside_length(bool include_inside_length) {
fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_INCLUDE_INSIDE_LENGTH, static_cast<uint8_t>(include_inside_length), 0);
}
void add_score_single_token_spans_as_zero(bool score_single_token_spans_as_zero) {
fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO, static_cast<uint8_t>(score_single_token_spans_as_zero), 0);
}
explicit BoundsSensitiveFeaturesBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
BoundsSensitiveFeaturesBuilder &operator=(const BoundsSensitiveFeaturesBuilder &);
flatbuffers::Offset<BoundsSensitiveFeatures> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<BoundsSensitiveFeatures>(end);
return o;
}
};
inline flatbuffers::Offset<BoundsSensitiveFeatures> CreateBoundsSensitiveFeatures(
flatbuffers::FlatBufferBuilder &_fbb,
bool enabled = false,
int32_t num_tokens_before = 0,
int32_t num_tokens_inside_left = 0,
int32_t num_tokens_inside_right = 0,
int32_t num_tokens_after = 0,
bool include_inside_bag = false,
bool include_inside_length = false,
bool score_single_token_spans_as_zero = false) {
BoundsSensitiveFeaturesBuilder builder_(_fbb);
builder_.add_num_tokens_after(num_tokens_after);
builder_.add_num_tokens_inside_right(num_tokens_inside_right);
builder_.add_num_tokens_inside_left(num_tokens_inside_left);
builder_.add_num_tokens_before(num_tokens_before);
builder_.add_score_single_token_spans_as_zero(score_single_token_spans_as_zero);
builder_.add_include_inside_length(include_inside_length);
builder_.add_include_inside_bag(include_inside_bag);
builder_.