1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 // automatically generated by the FlatBuffers compiler, do not modify 18 19 20 #ifndef FLATBUFFERS_GENERATED_MODEL_LIBTEXTCLASSIFIER2_H_ 21 #define FLATBUFFERS_GENERATED_MODEL_LIBTEXTCLASSIFIER2_H_ 22 23 #include "flatbuffers/flatbuffers.h" 24 25 namespace libtextclassifier2 { 26 27 struct CompressedBuffer; 28 struct CompressedBufferT; 29 30 struct SelectionModelOptions; 31 struct SelectionModelOptionsT; 32 33 struct ClassificationModelOptions; 34 struct ClassificationModelOptionsT; 35 36 namespace RegexModel_ { 37 38 struct Pattern; 39 struct PatternT; 40 41 } // namespace RegexModel_ 42 43 struct RegexModel; 44 struct RegexModelT; 45 46 namespace DatetimeModelPattern_ { 47 48 struct Regex; 49 struct RegexT; 50 51 } // namespace DatetimeModelPattern_ 52 53 struct DatetimeModelPattern; 54 struct DatetimeModelPatternT; 55 56 struct DatetimeModelExtractor; 57 struct DatetimeModelExtractorT; 58 59 struct DatetimeModel; 60 struct DatetimeModelT; 61 62 namespace DatetimeModelLibrary_ { 63 64 struct Item; 65 struct ItemT; 66 67 } // namespace DatetimeModelLibrary_ 68 69 struct DatetimeModelLibrary; 70 struct DatetimeModelLibraryT; 71 72 struct ModelTriggeringOptions; 73 struct ModelTriggeringOptionsT; 74 75 struct OutputOptions; 76 struct OutputOptionsT; 77 78 struct Model; 79 struct ModelT; 80 81 struct TokenizationCodepointRange; 82 struct TokenizationCodepointRangeT; 83 84 namespace FeatureProcessorOptions_ { 85 86 struct CodepointRange; 87 struct CodepointRangeT; 88 89 struct BoundsSensitiveFeatures; 90 struct BoundsSensitiveFeaturesT; 91 92 struct AlternativeCollectionMapEntry; 93 struct AlternativeCollectionMapEntryT; 94 95 } // namespace FeatureProcessorOptions_ 96 97 struct FeatureProcessorOptions; 98 struct FeatureProcessorOptionsT; 99 100 enum ModeFlag { 101 ModeFlag_NONE = 0, 102 ModeFlag_ANNOTATION = 1, 103 ModeFlag_CLASSIFICATION = 2, 104 ModeFlag_ANNOTATION_AND_CLASSIFICATION = 3, 105 ModeFlag_SELECTION = 4, 106 ModeFlag_ANNOTATION_AND_SELECTION = 5, 107 ModeFlag_CLASSIFICATION_AND_SELECTION = 6, 108 ModeFlag_ALL = 7, 109 ModeFlag_MIN = ModeFlag_NONE, 110 ModeFlag_MAX = ModeFlag_ALL 111 }; 112 113 inline ModeFlag (&EnumValuesModeFlag())[8] { 114 static ModeFlag values[] = { 115 ModeFlag_NONE, 116 ModeFlag_ANNOTATION, 117 ModeFlag_CLASSIFICATION, 118 ModeFlag_ANNOTATION_AND_CLASSIFICATION, 119 ModeFlag_SELECTION, 120 ModeFlag_ANNOTATION_AND_SELECTION, 121 ModeFlag_CLASSIFICATION_AND_SELECTION, 122 ModeFlag_ALL 123 }; 124 return values; 125 } 126 127 inline const char **EnumNamesModeFlag() { 128 static const char *names[] = { 129 "NONE", 130 "ANNOTATION", 131 "CLASSIFICATION", 132 "ANNOTATION_AND_CLASSIFICATION", 133 "SELECTION", 134 "ANNOTATION_AND_SELECTION", 135 "CLASSIFICATION_AND_SELECTION", 136 "ALL", 137 nullptr 138 }; 139 return names; 140 } 141 142 inline const char *EnumNameModeFlag(ModeFlag e) { 143 const size_t index = static_cast<int>(e); 144 return EnumNamesModeFlag()[index]; 145 } 146 147 enum DatetimeExtractorType { 148 DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE = 0, 149 DatetimeExtractorType_AM = 1, 150 DatetimeExtractorType_PM = 2, 151 DatetimeExtractorType_JANUARY = 3, 152 DatetimeExtractorType_FEBRUARY = 4, 153 DatetimeExtractorType_MARCH = 5, 154 DatetimeExtractorType_APRIL = 6, 155 DatetimeExtractorType_MAY = 7, 156 DatetimeExtractorType_JUNE = 8, 157 DatetimeExtractorType_JULY = 9, 158 DatetimeExtractorType_AUGUST = 10, 159 DatetimeExtractorType_SEPTEMBER = 11, 160 DatetimeExtractorType_OCTOBER = 12, 161 DatetimeExtractorType_NOVEMBER = 13, 162 DatetimeExtractorType_DECEMBER = 14, 163 DatetimeExtractorType_NEXT = 15, 164 DatetimeExtractorType_NEXT_OR_SAME = 16, 165 DatetimeExtractorType_LAST = 17, 166 DatetimeExtractorType_NOW = 18, 167 DatetimeExtractorType_TOMORROW = 19, 168 DatetimeExtractorType_YESTERDAY = 20, 169 DatetimeExtractorType_PAST = 21, 170 DatetimeExtractorType_FUTURE = 22, 171 DatetimeExtractorType_DAY = 23, 172 DatetimeExtractorType_WEEK = 24, 173 DatetimeExtractorType_MONTH = 25, 174 DatetimeExtractorType_YEAR = 26, 175 DatetimeExtractorType_MONDAY = 27, 176 DatetimeExtractorType_TUESDAY = 28, 177 DatetimeExtractorType_WEDNESDAY = 29, 178 DatetimeExtractorType_THURSDAY = 30, 179 DatetimeExtractorType_FRIDAY = 31, 180 DatetimeExtractorType_SATURDAY = 32, 181 DatetimeExtractorType_SUNDAY = 33, 182 DatetimeExtractorType_DAYS = 34, 183 DatetimeExtractorType_WEEKS = 35, 184 DatetimeExtractorType_MONTHS = 36, 185 DatetimeExtractorType_HOURS = 37, 186 DatetimeExtractorType_MINUTES = 38, 187 DatetimeExtractorType_SECONDS = 39, 188 DatetimeExtractorType_YEARS = 40, 189 DatetimeExtractorType_DIGITS = 41, 190 DatetimeExtractorType_SIGNEDDIGITS = 42, 191 DatetimeExtractorType_ZERO = 43, 192 DatetimeExtractorType_ONE = 44, 193 DatetimeExtractorType_TWO = 45, 194 DatetimeExtractorType_THREE = 46, 195 DatetimeExtractorType_FOUR = 47, 196 DatetimeExtractorType_FIVE = 48, 197 DatetimeExtractorType_SIX = 49, 198 DatetimeExtractorType_SEVEN = 50, 199 DatetimeExtractorType_EIGHT = 51, 200 DatetimeExtractorType_NINE = 52, 201 DatetimeExtractorType_TEN = 53, 202 DatetimeExtractorType_ELEVEN = 54, 203 DatetimeExtractorType_TWELVE = 55, 204 DatetimeExtractorType_THIRTEEN = 56, 205 DatetimeExtractorType_FOURTEEN = 57, 206 DatetimeExtractorType_FIFTEEN = 58, 207 DatetimeExtractorType_SIXTEEN = 59, 208 DatetimeExtractorType_SEVENTEEN = 60, 209 DatetimeExtractorType_EIGHTEEN = 61, 210 DatetimeExtractorType_NINETEEN = 62, 211 DatetimeExtractorType_TWENTY = 63, 212 DatetimeExtractorType_THIRTY = 64, 213 DatetimeExtractorType_FORTY = 65, 214 DatetimeExtractorType_FIFTY = 66, 215 DatetimeExtractorType_SIXTY = 67, 216 DatetimeExtractorType_SEVENTY = 68, 217 DatetimeExtractorType_EIGHTY = 69, 218 DatetimeExtractorType_NINETY = 70, 219 DatetimeExtractorType_HUNDRED = 71, 220 DatetimeExtractorType_THOUSAND = 72, 221 DatetimeExtractorType_MIN = DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE, 222 DatetimeExtractorType_MAX = DatetimeExtractorType_THOUSAND 223 }; 224 225 inline DatetimeExtractorType (&EnumValuesDatetimeExtractorType())[73] { 226 static DatetimeExtractorType values[] = { 227 DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE, 228 DatetimeExtractorType_AM, 229 DatetimeExtractorType_PM, 230 DatetimeExtractorType_JANUARY, 231 DatetimeExtractorType_FEBRUARY, 232 DatetimeExtractorType_MARCH, 233 DatetimeExtractorType_APRIL, 234 DatetimeExtractorType_MAY, 235 DatetimeExtractorType_JUNE, 236 DatetimeExtractorType_JULY, 237 DatetimeExtractorType_AUGUST, 238 DatetimeExtractorType_SEPTEMBER, 239 DatetimeExtractorType_OCTOBER, 240 DatetimeExtractorType_NOVEMBER, 241 DatetimeExtractorType_DECEMBER, 242 DatetimeExtractorType_NEXT, 243 DatetimeExtractorType_NEXT_OR_SAME, 244 DatetimeExtractorType_LAST, 245 DatetimeExtractorType_NOW, 246 DatetimeExtractorType_TOMORROW, 247 DatetimeExtractorType_YESTERDAY, 248 DatetimeExtractorType_PAST, 249 DatetimeExtractorType_FUTURE, 250 DatetimeExtractorType_DAY, 251 DatetimeExtractorType_WEEK, 252 DatetimeExtractorType_MONTH, 253 DatetimeExtractorType_YEAR, 254 DatetimeExtractorType_MONDAY, 255 DatetimeExtractorType_TUESDAY, 256 DatetimeExtractorType_WEDNESDAY, 257 DatetimeExtractorType_THURSDAY, 258 DatetimeExtractorType_FRIDAY, 259 DatetimeExtractorType_SATURDAY, 260 DatetimeExtractorType_SUNDAY, 261 DatetimeExtractorType_DAYS, 262 DatetimeExtractorType_WEEKS, 263 DatetimeExtractorType_MONTHS, 264 DatetimeExtractorType_HOURS, 265 DatetimeExtractorType_MINUTES, 266 DatetimeExtractorType_SECONDS, 267 DatetimeExtractorType_YEARS, 268 DatetimeExtractorType_DIGITS, 269 DatetimeExtractorType_SIGNEDDIGITS, 270 DatetimeExtractorType_ZERO, 271 DatetimeExtractorType_ONE, 272 DatetimeExtractorType_TWO, 273 DatetimeExtractorType_THREE, 274 DatetimeExtractorType_FOUR, 275 DatetimeExtractorType_FIVE, 276 DatetimeExtractorType_SIX, 277 DatetimeExtractorType_SEVEN, 278 DatetimeExtractorType_EIGHT, 279 DatetimeExtractorType_NINE, 280 DatetimeExtractorType_TEN, 281 DatetimeExtractorType_ELEVEN, 282 DatetimeExtractorType_TWELVE, 283 DatetimeExtractorType_THIRTEEN, 284 DatetimeExtractorType_FOURTEEN, 285 DatetimeExtractorType_FIFTEEN, 286 DatetimeExtractorType_SIXTEEN, 287 DatetimeExtractorType_SEVENTEEN, 288 DatetimeExtractorType_EIGHTEEN, 289 DatetimeExtractorType_NINETEEN, 290 DatetimeExtractorType_TWENTY, 291 DatetimeExtractorType_THIRTY, 292 DatetimeExtractorType_FORTY, 293 DatetimeExtractorType_FIFTY, 294 DatetimeExtractorType_SIXTY, 295 DatetimeExtractorType_SEVENTY, 296 DatetimeExtractorType_EIGHTY, 297 DatetimeExtractorType_NINETY, 298 DatetimeExtractorType_HUNDRED, 299 DatetimeExtractorType_THOUSAND 300 }; 301 return values; 302 } 303 304 inline const char **EnumNamesDatetimeExtractorType() { 305 static const char *names[] = { 306 "UNKNOWN_DATETIME_EXTRACTOR_TYPE", 307 "AM", 308 "PM", 309 "JANUARY", 310 "FEBRUARY", 311 "MARCH", 312 "APRIL", 313 "MAY", 314 "JUNE", 315 "JULY", 316 "AUGUST", 317 "SEPTEMBER", 318 "OCTOBER", 319 "NOVEMBER", 320 "DECEMBER", 321 "NEXT", 322 "NEXT_OR_SAME", 323 "LAST", 324 "NOW", 325 "TOMORROW", 326 "YESTERDAY", 327 "PAST", 328 "FUTURE", 329 "DAY", 330 "WEEK", 331 "MONTH", 332 "YEAR", 333 "MONDAY", 334 "TUESDAY", 335 "WEDNESDAY", 336 "THURSDAY", 337 "FRIDAY", 338 "SATURDAY", 339 "SUNDAY", 340 "DAYS", 341 "WEEKS", 342 "MONTHS", 343 "HOURS", 344 "MINUTES", 345 "SECONDS", 346 "YEARS", 347 "DIGITS", 348 "SIGNEDDIGITS", 349 "ZERO", 350 "ONE", 351 "TWO", 352 "THREE", 353 "FOUR", 354 "FIVE", 355 "SIX", 356 "SEVEN", 357 "EIGHT", 358 "NINE", 359 "TEN", 360 "ELEVEN", 361 "TWELVE", 362 "THIRTEEN", 363 "FOURTEEN", 364 "FIFTEEN", 365 "SIXTEEN", 366 "SEVENTEEN", 367 "EIGHTEEN", 368 "NINETEEN", 369 "TWENTY", 370 "THIRTY", 371 "FORTY", 372 "FIFTY", 373 "SIXTY", 374 "SEVENTY", 375 "EIGHTY", 376 "NINETY", 377 "HUNDRED", 378 "THOUSAND", 379 nullptr 380 }; 381 return names; 382 } 383 384 inline const char *EnumNameDatetimeExtractorType(DatetimeExtractorType e) { 385 const size_t index = static_cast<int>(e); 386 return EnumNamesDatetimeExtractorType()[index]; 387 } 388 389 enum DatetimeGroupType { 390 DatetimeGroupType_GROUP_UNKNOWN = 0, 391 DatetimeGroupType_GROUP_UNUSED = 1, 392 DatetimeGroupType_GROUP_YEAR = 2, 393 DatetimeGroupType_GROUP_MONTH = 3, 394 DatetimeGroupType_GROUP_DAY = 4, 395 DatetimeGroupType_GROUP_HOUR = 5, 396 DatetimeGroupType_GROUP_MINUTE = 6, 397 DatetimeGroupType_GROUP_SECOND = 7, 398 DatetimeGroupType_GROUP_AMPM = 8, 399 DatetimeGroupType_GROUP_RELATIONDISTANCE = 9, 400 DatetimeGroupType_GROUP_RELATION = 10, 401 DatetimeGroupType_GROUP_RELATIONTYPE = 11, 402 DatetimeGroupType_GROUP_DUMMY1 = 12, 403 DatetimeGroupType_GROUP_DUMMY2 = 13, 404 DatetimeGroupType_MIN = DatetimeGroupType_GROUP_UNKNOWN, 405 DatetimeGroupType_MAX = DatetimeGroupType_GROUP_DUMMY2 406 }; 407 408 inline DatetimeGroupType (&EnumValuesDatetimeGroupType())[14] { 409 static DatetimeGroupType values[] = { 410 DatetimeGroupType_GROUP_UNKNOWN, 411 DatetimeGroupType_GROUP_UNUSED, 412 DatetimeGroupType_GROUP_YEAR, 413 DatetimeGroupType_GROUP_MONTH, 414 DatetimeGroupType_GROUP_DAY, 415 DatetimeGroupType_GROUP_HOUR, 416 DatetimeGroupType_GROUP_MINUTE, 417 DatetimeGroupType_GROUP_SECOND, 418 DatetimeGroupType_GROUP_AMPM, 419 DatetimeGroupType_GROUP_RELATIONDISTANCE, 420 DatetimeGroupType_GROUP_RELATION, 421 DatetimeGroupType_GROUP_RELATIONTYPE, 422 DatetimeGroupType_GROUP_DUMMY1, 423 DatetimeGroupType_GROUP_DUMMY2 424 }; 425 return values; 426 } 427 428 inline const char **EnumNamesDatetimeGroupType() { 429 static const char *names[] = { 430 "GROUP_UNKNOWN", 431 "GROUP_UNUSED", 432 "GROUP_YEAR", 433 "GROUP_MONTH", 434 "GROUP_DAY", 435 "GROUP_HOUR", 436 "GROUP_MINUTE", 437 "GROUP_SECOND", 438 "GROUP_AMPM", 439 "GROUP_RELATIONDISTANCE", 440 "GROUP_RELATION", 441 "GROUP_RELATIONTYPE", 442 "GROUP_DUMMY1", 443 "GROUP_DUMMY2", 444 nullptr 445 }; 446 return names; 447 } 448 449 inline const char *EnumNameDatetimeGroupType(DatetimeGroupType e) { 450 const size_t index = static_cast<int>(e); 451 return EnumNamesDatetimeGroupType()[index]; 452 } 453 454 namespace TokenizationCodepointRange_ { 455 456 enum Role { 457 Role_DEFAULT_ROLE = 0, 458 Role_SPLIT_BEFORE = 1, 459 Role_SPLIT_AFTER = 2, 460 Role_TOKEN_SEPARATOR = 3, 461 Role_DISCARD_CODEPOINT = 4, 462 Role_WHITESPACE_SEPARATOR = 7, 463 Role_MIN = Role_DEFAULT_ROLE, 464 Role_MAX = Role_WHITESPACE_SEPARATOR 465 }; 466 467 inline Role (&EnumValuesRole())[6] { 468 static Role values[] = { 469 Role_DEFAULT_ROLE, 470 Role_SPLIT_BEFORE, 471 Role_SPLIT_AFTER, 472 Role_TOKEN_SEPARATOR, 473 Role_DISCARD_CODEPOINT, 474 Role_WHITESPACE_SEPARATOR 475 }; 476 return values; 477 } 478 479 inline const char **EnumNamesRole() { 480 static const char *names[] = { 481 "DEFAULT_ROLE", 482 "SPLIT_BEFORE", 483 "SPLIT_AFTER", 484 "TOKEN_SEPARATOR", 485 "DISCARD_CODEPOINT", 486 "", 487 "", 488 "WHITESPACE_SEPARATOR", 489 nullptr 490 }; 491 return names; 492 } 493 494 inline const char *EnumNameRole(Role e) { 495 const size_t index = static_cast<int>(e); 496 return EnumNamesRole()[index]; 497 } 498 499 } // namespace TokenizationCodepointRange_ 500 501 namespace FeatureProcessorOptions_ { 502 503 enum CenterTokenSelectionMethod { 504 CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD = 0, 505 CenterTokenSelectionMethod_CENTER_TOKEN_FROM_CLICK = 1, 506 CenterTokenSelectionMethod_CENTER_TOKEN_MIDDLE_OF_SELECTION = 2, 507 CenterTokenSelectionMethod_MIN = CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD, 508 CenterTokenSelectionMethod_MAX = CenterTokenSelectionMethod_CENTER_TOKEN_MIDDLE_OF_SELECTION 509 }; 510 511 inline CenterTokenSelectionMethod (&EnumValuesCenterTokenSelectionMethod())[3] { 512 static CenterTokenSelectionMethod values[] = { 513 CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD, 514 CenterTokenSelectionMethod_CENTER_TOKEN_FROM_CLICK, 515 CenterTokenSelectionMethod_CENTER_TOKEN_MIDDLE_OF_SELECTION 516 }; 517 return values; 518 } 519 520 inline const char **EnumNamesCenterTokenSelectionMethod() { 521 static const char *names[] = { 522 "DEFAULT_CENTER_TOKEN_METHOD", 523 "CENTER_TOKEN_FROM_CLICK", 524 "CENTER_TOKEN_MIDDLE_OF_SELECTION", 525 nullptr 526 }; 527 return names; 528 } 529 530 inline const char *EnumNameCenterTokenSelectionMethod(CenterTokenSelectionMethod e) { 531 const size_t index = static_cast<int>(e); 532 return EnumNamesCenterTokenSelectionMethod()[index]; 533 } 534 535 enum TokenizationType { 536 TokenizationType_INVALID_TOKENIZATION_TYPE = 0, 537 TokenizationType_INTERNAL_TOKENIZER = 1, 538 TokenizationType_ICU = 2, 539 TokenizationType_MIXED = 3, 540 TokenizationType_MIN = TokenizationType_INVALID_TOKENIZATION_TYPE, 541 TokenizationType_MAX = TokenizationType_MIXED 542 }; 543 544 inline TokenizationType (&EnumValuesTokenizationType())[4] { 545 static TokenizationType values[] = { 546 TokenizationType_INVALID_TOKENIZATION_TYPE, 547 TokenizationType_INTERNAL_TOKENIZER, 548 TokenizationType_ICU, 549 TokenizationType_MIXED 550 }; 551 return values; 552 } 553 554 inline const char **EnumNamesTokenizationType() { 555 static const char *names[] = { 556 "INVALID_TOKENIZATION_TYPE", 557 "INTERNAL_TOKENIZER", 558 "ICU", 559 "MIXED", 560 nullptr 561 }; 562 return names; 563 } 564 565 inline const char *EnumNameTokenizationType(TokenizationType e) { 566 const size_t index = static_cast<int>(e); 567 return EnumNamesTokenizationType()[index]; 568 } 569 570 } // namespace FeatureProcessorOptions_ 571 572 struct CompressedBufferT : public flatbuffers::NativeTable { 573 typedef CompressedBuffer TableType; 574 std::vector<uint8_t> buffer; 575 int32_t uncompressed_size; 576 CompressedBufferT() 577 : uncompressed_size(0) { 578 } 579 }; 580 581 struct CompressedBuffer FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 582 typedef CompressedBufferT NativeTableType; 583 enum { 584 VT_BUFFER = 4, 585 VT_UNCOMPRESSED_SIZE = 6 586 }; 587 const flatbuffers::Vector<uint8_t> *buffer() const { 588 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_BUFFER); 589 } 590 int32_t uncompressed_size() const { 591 return GetField<int32_t>(VT_UNCOMPRESSED_SIZE, 0); 592 } 593 bool Verify(flatbuffers::Verifier &verifier) const { 594 return VerifyTableStart(verifier) && 595 VerifyOffset(verifier, VT_BUFFER) && 596 verifier.Verify(buffer()) && 597 VerifyField<int32_t>(verifier, VT_UNCOMPRESSED_SIZE) && 598 verifier.EndTable(); 599 } 600 CompressedBufferT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 601 void UnPackTo(CompressedBufferT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 602 static flatbuffers::Offset<CompressedBuffer> Pack(flatbuffers::FlatBufferBuilder &_fbb, const CompressedBufferT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 603 }; 604 605 struct CompressedBufferBuilder { 606 flatbuffers::FlatBufferBuilder &fbb_; 607 flatbuffers::uoffset_t start_; 608 void add_buffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> buffer) { 609 fbb_.AddOffset(CompressedBuffer::VT_BUFFER, buffer); 610 } 611 void add_uncompressed_size(int32_t uncompressed_size) { 612 fbb_.AddElement<int32_t>(CompressedBuffer::VT_UNCOMPRESSED_SIZE, uncompressed_size, 0); 613 } 614 explicit CompressedBufferBuilder(flatbuffers::FlatBufferBuilder &_fbb) 615 : fbb_(_fbb) { 616 start_ = fbb_.StartTable(); 617 } 618 CompressedBufferBuilder &operator=(const CompressedBufferBuilder &); 619 flatbuffers::Offset<CompressedBuffer> Finish() { 620 const auto end = fbb_.EndTable(start_); 621 auto o = flatbuffers::Offset<CompressedBuffer>(end); 622 return o; 623 } 624 }; 625 626 inline flatbuffers::Offset<CompressedBuffer> CreateCompressedBuffer( 627 flatbuffers::FlatBufferBuilder &_fbb, 628 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> buffer = 0, 629 int32_t uncompressed_size = 0) { 630 CompressedBufferBuilder builder_(_fbb); 631 builder_.add_uncompressed_size(uncompressed_size); 632 builder_.add_buffer(buffer); 633 return builder_.Finish(); 634 } 635 636 inline flatbuffers::Offset<CompressedBuffer> CreateCompressedBufferDirect( 637 flatbuffers::FlatBufferBuilder &_fbb, 638 const std::vector<uint8_t> *buffer = nullptr, 639 int32_t uncompressed_size = 0) { 640 return libtextclassifier2::CreateCompressedBuffer( 641 _fbb, 642 buffer ? _fbb.CreateVector<uint8_t>(*buffer) : 0, 643 uncompressed_size); 644 } 645 646 flatbuffers::Offset<CompressedBuffer> CreateCompressedBuffer(flatbuffers::FlatBufferBuilder &_fbb, const CompressedBufferT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 647 648 struct SelectionModelOptionsT : public flatbuffers::NativeTable { 649 typedef SelectionModelOptions TableType; 650 bool strip_unpaired_brackets; 651 int32_t symmetry_context_size; 652 int32_t batch_size; 653 bool always_classify_suggested_selection; 654 SelectionModelOptionsT() 655 : strip_unpaired_brackets(true), 656 symmetry_context_size(0), 657 batch_size(1024), 658 always_classify_suggested_selection(false) { 659 } 660 }; 661 662 struct SelectionModelOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 663 typedef SelectionModelOptionsT NativeTableType; 664 enum { 665 VT_STRIP_UNPAIRED_BRACKETS = 4, 666 VT_SYMMETRY_CONTEXT_SIZE = 6, 667 VT_BATCH_SIZE = 8, 668 VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION = 10 669 }; 670 bool strip_unpaired_brackets() const { 671 return GetField<uint8_t>(VT_STRIP_UNPAIRED_BRACKETS, 1) != 0; 672 } 673 int32_t symmetry_context_size() const { 674 return GetField<int32_t>(VT_SYMMETRY_CONTEXT_SIZE, 0); 675 } 676 int32_t batch_size() const { 677 return GetField<int32_t>(VT_BATCH_SIZE, 1024); 678 } 679 bool always_classify_suggested_selection() const { 680 return GetField<uint8_t>(VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION, 0) != 0; 681 } 682 bool Verify(flatbuffers::Verifier &verifier) const { 683 return VerifyTableStart(verifier) && 684 VerifyField<uint8_t>(verifier, VT_STRIP_UNPAIRED_BRACKETS) && 685 VerifyField<int32_t>(verifier, VT_SYMMETRY_CONTEXT_SIZE) && 686 VerifyField<int32_t>(verifier, VT_BATCH_SIZE) && 687 VerifyField<uint8_t>(verifier, VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION) && 688 verifier.EndTable(); 689 } 690 SelectionModelOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 691 void UnPackTo(SelectionModelOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 692 static flatbuffers::Offset<SelectionModelOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const SelectionModelOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 693 }; 694 695 struct SelectionModelOptionsBuilder { 696 flatbuffers::FlatBufferBuilder &fbb_; 697 flatbuffers::uoffset_t start_; 698 void add_strip_unpaired_brackets(bool strip_unpaired_brackets) { 699 fbb_.AddElement<uint8_t>(SelectionModelOptions::VT_STRIP_UNPAIRED_BRACKETS, static_cast<uint8_t>(strip_unpaired_brackets), 1); 700 } 701 void add_symmetry_context_size(int32_t symmetry_context_size) { 702 fbb_.AddElement<int32_t>(SelectionModelOptions::VT_SYMMETRY_CONTEXT_SIZE, symmetry_context_size, 0); 703 } 704 void add_batch_size(int32_t batch_size) { 705 fbb_.AddElement<int32_t>(SelectionModelOptions::VT_BATCH_SIZE, batch_size, 1024); 706 } 707 void add_always_classify_suggested_selection(bool always_classify_suggested_selection) { 708 fbb_.AddElement<uint8_t>(SelectionModelOptions::VT_ALWAYS_CLASSIFY_SUGGESTED_SELECTION, static_cast<uint8_t>(always_classify_suggested_selection), 0); 709 } 710 explicit SelectionModelOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) 711 : fbb_(_fbb) { 712 start_ = fbb_.StartTable(); 713 } 714 SelectionModelOptionsBuilder &operator=(const SelectionModelOptionsBuilder &); 715 flatbuffers::Offset<SelectionModelOptions> Finish() { 716 const auto end = fbb_.EndTable(start_); 717 auto o = flatbuffers::Offset<SelectionModelOptions>(end); 718 return o; 719 } 720 }; 721 722 inline flatbuffers::Offset<SelectionModelOptions> CreateSelectionModelOptions( 723 flatbuffers::FlatBufferBuilder &_fbb, 724 bool strip_unpaired_brackets = true, 725 int32_t symmetry_context_size = 0, 726 int32_t batch_size = 1024, 727 bool always_classify_suggested_selection = false) { 728 SelectionModelOptionsBuilder builder_(_fbb); 729 builder_.add_batch_size(batch_size); 730 builder_.add_symmetry_context_size(symmetry_context_size); 731 builder_.add_always_classify_suggested_selection(always_classify_suggested_selection); 732 builder_.add_strip_unpaired_brackets(strip_unpaired_brackets); 733 return builder_.Finish(); 734 } 735 736 flatbuffers::Offset<SelectionModelOptions> CreateSelectionModelOptions(flatbuffers::FlatBufferBuilder &_fbb, const SelectionModelOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 737 738 struct ClassificationModelOptionsT : public flatbuffers::NativeTable { 739 typedef ClassificationModelOptions TableType; 740 int32_t phone_min_num_digits; 741 int32_t phone_max_num_digits; 742 int32_t address_min_num_tokens; 743 int32_t max_num_tokens; 744 ClassificationModelOptionsT() 745 : phone_min_num_digits(7), 746 phone_max_num_digits(15), 747 address_min_num_tokens(0), 748 max_num_tokens(-1) { 749 } 750 }; 751 752 struct ClassificationModelOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 753 typedef ClassificationModelOptionsT NativeTableType; 754 enum { 755 VT_PHONE_MIN_NUM_DIGITS = 4, 756 VT_PHONE_MAX_NUM_DIGITS = 6, 757 VT_ADDRESS_MIN_NUM_TOKENS = 8, 758 VT_MAX_NUM_TOKENS = 10 759 }; 760 int32_t phone_min_num_digits() const { 761 return GetField<int32_t>(VT_PHONE_MIN_NUM_DIGITS, 7); 762 } 763 int32_t phone_max_num_digits() const { 764 return GetField<int32_t>(VT_PHONE_MAX_NUM_DIGITS, 15); 765 } 766 int32_t address_min_num_tokens() const { 767 return GetField<int32_t>(VT_ADDRESS_MIN_NUM_TOKENS, 0); 768 } 769 int32_t max_num_tokens() const { 770 return GetField<int32_t>(VT_MAX_NUM_TOKENS, -1); 771 } 772 bool Verify(flatbuffers::Verifier &verifier) const { 773 return VerifyTableStart(verifier) && 774 VerifyField<int32_t>(verifier, VT_PHONE_MIN_NUM_DIGITS) && 775 VerifyField<int32_t>(verifier, VT_PHONE_MAX_NUM_DIGITS) && 776 VerifyField<int32_t>(verifier, VT_ADDRESS_MIN_NUM_TOKENS) && 777 VerifyField<int32_t>(verifier, VT_MAX_NUM_TOKENS) && 778 verifier.EndTable(); 779 } 780 ClassificationModelOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 781 void UnPackTo(ClassificationModelOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 782 static flatbuffers::Offset<ClassificationModelOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ClassificationModelOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 783 }; 784 785 struct ClassificationModelOptionsBuilder { 786 flatbuffers::FlatBufferBuilder &fbb_; 787 flatbuffers::uoffset_t start_; 788 void add_phone_min_num_digits(int32_t phone_min_num_digits) { 789 fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_PHONE_MIN_NUM_DIGITS, phone_min_num_digits, 7); 790 } 791 void add_phone_max_num_digits(int32_t phone_max_num_digits) { 792 fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_PHONE_MAX_NUM_DIGITS, phone_max_num_digits, 15); 793 } 794 void add_address_min_num_tokens(int32_t address_min_num_tokens) { 795 fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_ADDRESS_MIN_NUM_TOKENS, address_min_num_tokens, 0); 796 } 797 void add_max_num_tokens(int32_t max_num_tokens) { 798 fbb_.AddElement<int32_t>(ClassificationModelOptions::VT_MAX_NUM_TOKENS, max_num_tokens, -1); 799 } 800 explicit ClassificationModelOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) 801 : fbb_(_fbb) { 802 start_ = fbb_.StartTable(); 803 } 804 ClassificationModelOptionsBuilder &operator=(const ClassificationModelOptionsBuilder &); 805 flatbuffers::Offset<ClassificationModelOptions> Finish() { 806 const auto end = fbb_.EndTable(start_); 807 auto o = flatbuffers::Offset<ClassificationModelOptions>(end); 808 return o; 809 } 810 }; 811 812 inline flatbuffers::Offset<ClassificationModelOptions> CreateClassificationModelOptions( 813 flatbuffers::FlatBufferBuilder &_fbb, 814 int32_t phone_min_num_digits = 7, 815 int32_t phone_max_num_digits = 15, 816 int32_t address_min_num_tokens = 0, 817 int32_t max_num_tokens = -1) { 818 ClassificationModelOptionsBuilder builder_(_fbb); 819 builder_.add_max_num_tokens(max_num_tokens); 820 builder_.add_address_min_num_tokens(address_min_num_tokens); 821 builder_.add_phone_max_num_digits(phone_max_num_digits); 822 builder_.add_phone_min_num_digits(phone_min_num_digits); 823 return builder_.Finish(); 824 } 825 826 flatbuffers::Offset<ClassificationModelOptions> CreateClassificationModelOptions(flatbuffers::FlatBufferBuilder &_fbb, const ClassificationModelOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 827 828 namespace RegexModel_ { 829 830 struct PatternT : public flatbuffers::NativeTable { 831 typedef Pattern TableType; 832 std::string collection_name; 833 std::string pattern; 834 libtextclassifier2::ModeFlag enabled_modes; 835 float target_classification_score; 836 float priority_score; 837 bool use_approximate_matching; 838 std::unique_ptr<libtextclassifier2::CompressedBufferT> compressed_pattern; 839 PatternT() 840 : enabled_modes(libtextclassifier2::ModeFlag_ALL), 841 target_classification_score(1.0f), 842 priority_score(0.0f), 843 use_approximate_matching(false) { 844 } 845 }; 846 847 struct Pattern FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 848 typedef PatternT NativeTableType; 849 enum { 850 VT_COLLECTION_NAME = 4, 851 VT_PATTERN = 6, 852 VT_ENABLED_MODES = 8, 853 VT_TARGET_CLASSIFICATION_SCORE = 10, 854 VT_PRIORITY_SCORE = 12, 855 VT_USE_APPROXIMATE_MATCHING = 14, 856 VT_COMPRESSED_PATTERN = 16 857 }; 858 const flatbuffers::String *collection_name() const { 859 return GetPointer<const flatbuffers::String *>(VT_COLLECTION_NAME); 860 } 861 const flatbuffers::String *pattern() const { 862 return GetPointer<const flatbuffers::String *>(VT_PATTERN); 863 } 864 libtextclassifier2::ModeFlag enabled_modes() const { 865 return static_cast<libtextclassifier2::ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7)); 866 } 867 float target_classification_score() const { 868 return GetField<float>(VT_TARGET_CLASSIFICATION_SCORE, 1.0f); 869 } 870 float priority_score() const { 871 return GetField<float>(VT_PRIORITY_SCORE, 0.0f); 872 } 873 bool use_approximate_matching() const { 874 return GetField<uint8_t>(VT_USE_APPROXIMATE_MATCHING, 0) != 0; 875 } 876 const libtextclassifier2::CompressedBuffer *compressed_pattern() const { 877 return GetPointer<const libtextclassifier2::CompressedBuffer *>(VT_COMPRESSED_PATTERN); 878 } 879 bool Verify(flatbuffers::Verifier &verifier) const { 880 return VerifyTableStart(verifier) && 881 VerifyOffset(verifier, VT_COLLECTION_NAME) && 882 verifier.Verify(collection_name()) && 883 VerifyOffset(verifier, VT_PATTERN) && 884 verifier.Verify(pattern()) && 885 VerifyField<int32_t>(verifier, VT_ENABLED_MODES) && 886 VerifyField<float>(verifier, VT_TARGET_CLASSIFICATION_SCORE) && 887 VerifyField<float>(verifier, VT_PRIORITY_SCORE) && 888 VerifyField<uint8_t>(verifier, VT_USE_APPROXIMATE_MATCHING) && 889 VerifyOffset(verifier, VT_COMPRESSED_PATTERN) && 890 verifier.VerifyTable(compressed_pattern()) && 891 verifier.EndTable(); 892 } 893 PatternT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 894 void UnPackTo(PatternT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 895 static flatbuffers::Offset<Pattern> Pack(flatbuffers::FlatBufferBuilder &_fbb, const PatternT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 896 }; 897 898 struct PatternBuilder { 899 flatbuffers::FlatBufferBuilder &fbb_; 900 flatbuffers::uoffset_t start_; 901 void add_collection_name(flatbuffers::Offset<flatbuffers::String> collection_name) { 902 fbb_.AddOffset(Pattern::VT_COLLECTION_NAME, collection_name); 903 } 904 void add_pattern(flatbuffers::Offset<flatbuffers::String> pattern) { 905 fbb_.AddOffset(Pattern::VT_PATTERN, pattern); 906 } 907 void add_enabled_modes(libtextclassifier2::ModeFlag enabled_modes) { 908 fbb_.AddElement<int32_t>(Pattern::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7); 909 } 910 void add_target_classification_score(float target_classification_score) { 911 fbb_.AddElement<float>(Pattern::VT_TARGET_CLASSIFICATION_SCORE, target_classification_score, 1.0f); 912 } 913 void add_priority_score(float priority_score) { 914 fbb_.AddElement<float>(Pattern::VT_PRIORITY_SCORE, priority_score, 0.0f); 915 } 916 void add_use_approximate_matching(bool use_approximate_matching) { 917 fbb_.AddElement<uint8_t>(Pattern::VT_USE_APPROXIMATE_MATCHING, static_cast<uint8_t>(use_approximate_matching), 0); 918 } 919 void add_compressed_pattern(flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern) { 920 fbb_.AddOffset(Pattern::VT_COMPRESSED_PATTERN, compressed_pattern); 921 } 922 explicit PatternBuilder(flatbuffers::FlatBufferBuilder &_fbb) 923 : fbb_(_fbb) { 924 start_ = fbb_.StartTable(); 925 } 926 PatternBuilder &operator=(const PatternBuilder &); 927 flatbuffers::Offset<Pattern> Finish() { 928 const auto end = fbb_.EndTable(start_); 929 auto o = flatbuffers::Offset<Pattern>(end); 930 return o; 931 } 932 }; 933 934 inline flatbuffers::Offset<Pattern> CreatePattern( 935 flatbuffers::FlatBufferBuilder &_fbb, 936 flatbuffers::Offset<flatbuffers::String> collection_name = 0, 937 flatbuffers::Offset<flatbuffers::String> pattern = 0, 938 libtextclassifier2::ModeFlag enabled_modes = libtextclassifier2::ModeFlag_ALL, 939 float target_classification_score = 1.0f, 940 float priority_score = 0.0f, 941 bool use_approximate_matching = false, 942 flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) { 943 PatternBuilder builder_(_fbb); 944 builder_.add_compressed_pattern(compressed_pattern); 945 builder_.add_priority_score(priority_score); 946 builder_.add_target_classification_score(target_classification_score); 947 builder_.add_enabled_modes(enabled_modes); 948 builder_.add_pattern(pattern); 949 builder_.add_collection_name(collection_name); 950 builder_.add_use_approximate_matching(use_approximate_matching); 951 return builder_.Finish(); 952 } 953 954 inline flatbuffers::Offset<Pattern> CreatePatternDirect( 955 flatbuffers::FlatBufferBuilder &_fbb, 956 const char *collection_name = nullptr, 957 const char *pattern = nullptr, 958 libtextclassifier2::ModeFlag enabled_modes = libtextclassifier2::ModeFlag_ALL, 959 float target_classification_score = 1.0f, 960 float priority_score = 0.0f, 961 bool use_approximate_matching = false, 962 flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) { 963 return libtextclassifier2::RegexModel_::CreatePattern( 964 _fbb, 965 collection_name ? _fbb.CreateString(collection_name) : 0, 966 pattern ? _fbb.CreateString(pattern) : 0, 967 enabled_modes, 968 target_classification_score, 969 priority_score, 970 use_approximate_matching, 971 compressed_pattern); 972 } 973 974 flatbuffers::Offset<Pattern> CreatePattern(flatbuffers::FlatBufferBuilder &_fbb, const PatternT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 975 976 } // namespace RegexModel_ 977 978 struct RegexModelT : public flatbuffers::NativeTable { 979 typedef RegexModel TableType; 980 std::vector<std::unique_ptr<libtextclassifier2::RegexModel_::PatternT>> patterns; 981 RegexModelT() { 982 } 983 }; 984 985 struct RegexModel FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 986 typedef RegexModelT NativeTableType; 987 enum { 988 VT_PATTERNS = 4 989 }; 990 const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>> *patterns() const { 991 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>> *>(VT_PATTERNS); 992 } 993 bool Verify(flatbuffers::Verifier &verifier) const { 994 return VerifyTableStart(verifier) && 995 VerifyOffset(verifier, VT_PATTERNS) && 996 verifier.Verify(patterns()) && 997 verifier.VerifyVectorOfTables(patterns()) && 998 verifier.EndTable(); 999 } 1000 RegexModelT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1001 void UnPackTo(RegexModelT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1002 static flatbuffers::Offset<RegexModel> Pack(flatbuffers::FlatBufferBuilder &_fbb, const RegexModelT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1003 }; 1004 1005 struct RegexModelBuilder { 1006 flatbuffers::FlatBufferBuilder &fbb_; 1007 flatbuffers::uoffset_t start_; 1008 void add_patterns(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>>> patterns) { 1009 fbb_.AddOffset(RegexModel::VT_PATTERNS, patterns); 1010 } 1011 explicit RegexModelBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1012 : fbb_(_fbb) { 1013 start_ = fbb_.StartTable(); 1014 } 1015 RegexModelBuilder &operator=(const RegexModelBuilder &); 1016 flatbuffers::Offset<RegexModel> Finish() { 1017 const auto end = fbb_.EndTable(start_); 1018 auto o = flatbuffers::Offset<RegexModel>(end); 1019 return o; 1020 } 1021 }; 1022 1023 inline flatbuffers::Offset<RegexModel> CreateRegexModel( 1024 flatbuffers::FlatBufferBuilder &_fbb, 1025 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>>> patterns = 0) { 1026 RegexModelBuilder builder_(_fbb); 1027 builder_.add_patterns(patterns); 1028 return builder_.Finish(); 1029 } 1030 1031 inline flatbuffers::Offset<RegexModel> CreateRegexModelDirect( 1032 flatbuffers::FlatBufferBuilder &_fbb, 1033 const std::vector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>> *patterns = nullptr) { 1034 return libtextclassifier2::CreateRegexModel( 1035 _fbb, 1036 patterns ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>>(*patterns) : 0); 1037 } 1038 1039 flatbuffers::Offset<RegexModel> CreateRegexModel(flatbuffers::FlatBufferBuilder &_fbb, const RegexModelT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1040 1041 namespace DatetimeModelPattern_ { 1042 1043 struct RegexT : public flatbuffers::NativeTable { 1044 typedef Regex TableType; 1045 std::string pattern; 1046 std::vector<libtextclassifier2::DatetimeGroupType> groups; 1047 std::unique_ptr<libtextclassifier2::CompressedBufferT> compressed_pattern; 1048 RegexT() { 1049 } 1050 }; 1051 1052 struct Regex FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1053 typedef RegexT NativeTableType; 1054 enum { 1055 VT_PATTERN = 4, 1056 VT_GROUPS = 6, 1057 VT_COMPRESSED_PATTERN = 8 1058 }; 1059 const flatbuffers::String *pattern() const { 1060 return GetPointer<const flatbuffers::String *>(VT_PATTERN); 1061 } 1062 const flatbuffers::Vector<int32_t> *groups() const { 1063 return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_GROUPS); 1064 } 1065 const libtextclassifier2::CompressedBuffer *compressed_pattern() const { 1066 return GetPointer<const libtextclassifier2::CompressedBuffer *>(VT_COMPRESSED_PATTERN); 1067 } 1068 bool Verify(flatbuffers::Verifier &verifier) const { 1069 return VerifyTableStart(verifier) && 1070 VerifyOffset(verifier, VT_PATTERN) && 1071 verifier.Verify(pattern()) && 1072 VerifyOffset(verifier, VT_GROUPS) && 1073 verifier.Verify(groups()) && 1074 VerifyOffset(verifier, VT_COMPRESSED_PATTERN) && 1075 verifier.VerifyTable(compressed_pattern()) && 1076 verifier.EndTable(); 1077 } 1078 RegexT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1079 void UnPackTo(RegexT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1080 static flatbuffers::Offset<Regex> Pack(flatbuffers::FlatBufferBuilder &_fbb, const RegexT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1081 }; 1082 1083 struct RegexBuilder { 1084 flatbuffers::FlatBufferBuilder &fbb_; 1085 flatbuffers::uoffset_t start_; 1086 void add_pattern(flatbuffers::Offset<flatbuffers::String> pattern) { 1087 fbb_.AddOffset(Regex::VT_PATTERN, pattern); 1088 } 1089 void add_groups(flatbuffers::Offset<flatbuffers::Vector<int32_t>> groups) { 1090 fbb_.AddOffset(Regex::VT_GROUPS, groups); 1091 } 1092 void add_compressed_pattern(flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern) { 1093 fbb_.AddOffset(Regex::VT_COMPRESSED_PATTERN, compressed_pattern); 1094 } 1095 explicit RegexBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1096 : fbb_(_fbb) { 1097 start_ = fbb_.StartTable(); 1098 } 1099 RegexBuilder &operator=(const RegexBuilder &); 1100 flatbuffers::Offset<Regex> Finish() { 1101 const auto end = fbb_.EndTable(start_); 1102 auto o = flatbuffers::Offset<Regex>(end); 1103 return o; 1104 } 1105 }; 1106 1107 inline flatbuffers::Offset<Regex> CreateRegex( 1108 flatbuffers::FlatBufferBuilder &_fbb, 1109 flatbuffers::Offset<flatbuffers::String> pattern = 0, 1110 flatbuffers::Offset<flatbuffers::Vector<int32_t>> groups = 0, 1111 flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) { 1112 RegexBuilder builder_(_fbb); 1113 builder_.add_compressed_pattern(compressed_pattern); 1114 builder_.add_groups(groups); 1115 builder_.add_pattern(pattern); 1116 return builder_.Finish(); 1117 } 1118 1119 inline flatbuffers::Offset<Regex> CreateRegexDirect( 1120 flatbuffers::FlatBufferBuilder &_fbb, 1121 const char *pattern = nullptr, 1122 const std::vector<int32_t> *groups = nullptr, 1123 flatbuffers::Offset<libtextclassifier2::CompressedBuffer> compressed_pattern = 0) { 1124 return libtextclassifier2::DatetimeModelPattern_::CreateRegex( 1125 _fbb, 1126 pattern ? _fbb.CreateString(pattern) : 0, 1127 groups ? _fbb.CreateVector<int32_t>(*groups) : 0, 1128 compressed_pattern); 1129 } 1130 1131 flatbuffers::Offset<Regex> CreateRegex(flatbuffers::FlatBufferBuilder &_fbb, const RegexT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1132 1133 } // namespace DatetimeModelPattern_ 1134 1135 struct DatetimeModelPatternT : public flatbuffers::NativeTable { 1136 typedef DatetimeModelPattern TableType; 1137 std::vector<std::unique_ptr<libtextclassifier2::DatetimeModelPattern_::RegexT>> regexes; 1138 std::vector<int32_t> locales; 1139 float target_classification_score; 1140 float priority_score; 1141 ModeFlag enabled_modes; 1142 DatetimeModelPatternT() 1143 : target_classification_score(1.0f), 1144 priority_score(0.0f), 1145 enabled_modes(ModeFlag_ALL) { 1146 } 1147 }; 1148 1149 struct DatetimeModelPattern FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1150 typedef DatetimeModelPatternT NativeTableType; 1151 enum { 1152 VT_REGEXES = 4, 1153 VT_LOCALES = 6, 1154 VT_TARGET_CLASSIFICATION_SCORE = 8, 1155 VT_PRIORITY_SCORE = 10, 1156 VT_ENABLED_MODES = 12 1157 }; 1158 const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>> *regexes() const { 1159 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>> *>(VT_REGEXES); 1160 } 1161 const flatbuffers::Vector<int32_t> *locales() const { 1162 return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_LOCALES); 1163 } 1164 float target_classification_score() const { 1165 return GetField<float>(VT_TARGET_CLASSIFICATION_SCORE, 1.0f); 1166 } 1167 float priority_score() const { 1168 return GetField<float>(VT_PRIORITY_SCORE, 0.0f); 1169 } 1170 ModeFlag enabled_modes() const { 1171 return static_cast<ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7)); 1172 } 1173 bool Verify(flatbuffers::Verifier &verifier) const { 1174 return VerifyTableStart(verifier) && 1175 VerifyOffset(verifier, VT_REGEXES) && 1176 verifier.Verify(regexes()) && 1177 verifier.VerifyVectorOfTables(regexes()) && 1178 VerifyOffset(verifier, VT_LOCALES) && 1179 verifier.Verify(locales()) && 1180 VerifyField<float>(verifier, VT_TARGET_CLASSIFICATION_SCORE) && 1181 VerifyField<float>(verifier, VT_PRIORITY_SCORE) && 1182 VerifyField<int32_t>(verifier, VT_ENABLED_MODES) && 1183 verifier.EndTable(); 1184 } 1185 DatetimeModelPatternT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1186 void UnPackTo(DatetimeModelPatternT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1187 static flatbuffers::Offset<DatetimeModelPattern> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelPatternT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1188 }; 1189 1190 struct DatetimeModelPatternBuilder { 1191 flatbuffers::FlatBufferBuilder &fbb_; 1192 flatbuffers::uoffset_t start_; 1193 void add_regexes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>>> regexes) { 1194 fbb_.AddOffset(DatetimeModelPattern::VT_REGEXES, regexes); 1195 } 1196 void add_locales(flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales) { 1197 fbb_.AddOffset(DatetimeModelPattern::VT_LOCALES, locales); 1198 } 1199 void add_target_classification_score(float target_classification_score) { 1200 fbb_.AddElement<float>(DatetimeModelPattern::VT_TARGET_CLASSIFICATION_SCORE, target_classification_score, 1.0f); 1201 } 1202 void add_priority_score(float priority_score) { 1203 fbb_.AddElement<float>(DatetimeModelPattern::VT_PRIORITY_SCORE, priority_score, 0.0f); 1204 } 1205 void add_enabled_modes(ModeFlag enabled_modes) { 1206 fbb_.AddElement<int32_t>(DatetimeModelPattern::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7); 1207 } 1208 explicit DatetimeModelPatternBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1209 : fbb_(_fbb) { 1210 start_ = fbb_.StartTable(); 1211 } 1212 DatetimeModelPatternBuilder &operator=(const DatetimeModelPatternBuilder &); 1213 flatbuffers::Offset<DatetimeModelPattern> Finish() { 1214 const auto end = fbb_.EndTable(start_); 1215 auto o = flatbuffers::Offset<DatetimeModelPattern>(end); 1216 return o; 1217 } 1218 }; 1219 1220 inline flatbuffers::Offset<DatetimeModelPattern> CreateDatetimeModelPattern( 1221 flatbuffers::FlatBufferBuilder &_fbb, 1222 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>>> regexes = 0, 1223 flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales = 0, 1224 float target_classification_score = 1.0f, 1225 float priority_score = 0.0f, 1226 ModeFlag enabled_modes = ModeFlag_ALL) { 1227 DatetimeModelPatternBuilder builder_(_fbb); 1228 builder_.add_enabled_modes(enabled_modes); 1229 builder_.add_priority_score(priority_score); 1230 builder_.add_target_classification_score(target_classification_score); 1231 builder_.add_locales(locales); 1232 builder_.add_regexes(regexes); 1233 return builder_.Finish(); 1234 } 1235 1236 inline flatbuffers::Offset<DatetimeModelPattern> CreateDatetimeModelPatternDirect( 1237 flatbuffers::FlatBufferBuilder &_fbb, 1238 const std::vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>> *regexes = nullptr, 1239 const std::vector<int32_t> *locales = nullptr, 1240 float target_classification_score = 1.0f, 1241 float priority_score = 0.0f, 1242 ModeFlag enabled_modes = ModeFlag_ALL) { 1243 return libtextclassifier2::CreateDatetimeModelPattern( 1244 _fbb, 1245 regexes ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>>(*regexes) : 0, 1246 locales ? _fbb.CreateVector<int32_t>(*locales) : 0, 1247 target_classification_score, 1248 priority_score, 1249 enabled_modes); 1250 } 1251 1252 flatbuffers::Offset<DatetimeModelPattern> CreateDatetimeModelPattern(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelPatternT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1253 1254 struct DatetimeModelExtractorT : public flatbuffers::NativeTable { 1255 typedef DatetimeModelExtractor TableType; 1256 DatetimeExtractorType extractor; 1257 std::string pattern; 1258 std::vector<int32_t> locales; 1259 std::unique_ptr<CompressedBufferT> compressed_pattern; 1260 DatetimeModelExtractorT() 1261 : extractor(DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE) { 1262 } 1263 }; 1264 1265 struct DatetimeModelExtractor FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1266 typedef DatetimeModelExtractorT NativeTableType; 1267 enum { 1268 VT_EXTRACTOR = 4, 1269 VT_PATTERN = 6, 1270 VT_LOCALES = 8, 1271 VT_COMPRESSED_PATTERN = 10 1272 }; 1273 DatetimeExtractorType extractor() const { 1274 return static_cast<DatetimeExtractorType>(GetField<int32_t>(VT_EXTRACTOR, 0)); 1275 } 1276 const flatbuffers::String *pattern() const { 1277 return GetPointer<const flatbuffers::String *>(VT_PATTERN); 1278 } 1279 const flatbuffers::Vector<int32_t> *locales() const { 1280 return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_LOCALES); 1281 } 1282 const CompressedBuffer *compressed_pattern() const { 1283 return GetPointer<const CompressedBuffer *>(VT_COMPRESSED_PATTERN); 1284 } 1285 bool Verify(flatbuffers::Verifier &verifier) const { 1286 return VerifyTableStart(verifier) && 1287 VerifyField<int32_t>(verifier, VT_EXTRACTOR) && 1288 VerifyOffset(verifier, VT_PATTERN) && 1289 verifier.Verify(pattern()) && 1290 VerifyOffset(verifier, VT_LOCALES) && 1291 verifier.Verify(locales()) && 1292 VerifyOffset(verifier, VT_COMPRESSED_PATTERN) && 1293 verifier.VerifyTable(compressed_pattern()) && 1294 verifier.EndTable(); 1295 } 1296 DatetimeModelExtractorT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1297 void UnPackTo(DatetimeModelExtractorT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1298 static flatbuffers::Offset<DatetimeModelExtractor> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelExtractorT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1299 }; 1300 1301 struct DatetimeModelExtractorBuilder { 1302 flatbuffers::FlatBufferBuilder &fbb_; 1303 flatbuffers::uoffset_t start_; 1304 void add_extractor(DatetimeExtractorType extractor) { 1305 fbb_.AddElement<int32_t>(DatetimeModelExtractor::VT_EXTRACTOR, static_cast<int32_t>(extractor), 0); 1306 } 1307 void add_pattern(flatbuffers::Offset<flatbuffers::String> pattern) { 1308 fbb_.AddOffset(DatetimeModelExtractor::VT_PATTERN, pattern); 1309 } 1310 void add_locales(flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales) { 1311 fbb_.AddOffset(DatetimeModelExtractor::VT_LOCALES, locales); 1312 } 1313 void add_compressed_pattern(flatbuffers::Offset<CompressedBuffer> compressed_pattern) { 1314 fbb_.AddOffset(DatetimeModelExtractor::VT_COMPRESSED_PATTERN, compressed_pattern); 1315 } 1316 explicit DatetimeModelExtractorBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1317 : fbb_(_fbb) { 1318 start_ = fbb_.StartTable(); 1319 } 1320 DatetimeModelExtractorBuilder &operator=(const DatetimeModelExtractorBuilder &); 1321 flatbuffers::Offset<DatetimeModelExtractor> Finish() { 1322 const auto end = fbb_.EndTable(start_); 1323 auto o = flatbuffers::Offset<DatetimeModelExtractor>(end); 1324 return o; 1325 } 1326 }; 1327 1328 inline flatbuffers::Offset<DatetimeModelExtractor> CreateDatetimeModelExtractor( 1329 flatbuffers::FlatBufferBuilder &_fbb, 1330 DatetimeExtractorType extractor = DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE, 1331 flatbuffers::Offset<flatbuffers::String> pattern = 0, 1332 flatbuffers::Offset<flatbuffers::Vector<int32_t>> locales = 0, 1333 flatbuffers::Offset<CompressedBuffer> compressed_pattern = 0) { 1334 DatetimeModelExtractorBuilder builder_(_fbb); 1335 builder_.add_compressed_pattern(compressed_pattern); 1336 builder_.add_locales(locales); 1337 builder_.add_pattern(pattern); 1338 builder_.add_extractor(extractor); 1339 return builder_.Finish(); 1340 } 1341 1342 inline flatbuffers::Offset<DatetimeModelExtractor> CreateDatetimeModelExtractorDirect( 1343 flatbuffers::FlatBufferBuilder &_fbb, 1344 DatetimeExtractorType extractor = DatetimeExtractorType_UNKNOWN_DATETIME_EXTRACTOR_TYPE, 1345 const char *pattern = nullptr, 1346 const std::vector<int32_t> *locales = nullptr, 1347 flatbuffers::Offset<CompressedBuffer> compressed_pattern = 0) { 1348 return libtextclassifier2::CreateDatetimeModelExtractor( 1349 _fbb, 1350 extractor, 1351 pattern ? _fbb.CreateString(pattern) : 0, 1352 locales ? _fbb.CreateVector<int32_t>(*locales) : 0, 1353 compressed_pattern); 1354 } 1355 1356 flatbuffers::Offset<DatetimeModelExtractor> CreateDatetimeModelExtractor(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelExtractorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1357 1358 struct DatetimeModelT : public flatbuffers::NativeTable { 1359 typedef DatetimeModel TableType; 1360 std::vector<std::string> locales; 1361 std::vector<std::unique_ptr<DatetimeModelPatternT>> patterns; 1362 std::vector<std::unique_ptr<DatetimeModelExtractorT>> extractors; 1363 bool use_extractors_for_locating; 1364 std::vector<int32_t> default_locales; 1365 DatetimeModelT() 1366 : use_extractors_for_locating(true) { 1367 } 1368 }; 1369 1370 struct DatetimeModel FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1371 typedef DatetimeModelT NativeTableType; 1372 enum { 1373 VT_LOCALES = 4, 1374 VT_PATTERNS = 6, 1375 VT_EXTRACTORS = 8, 1376 VT_USE_EXTRACTORS_FOR_LOCATING = 10, 1377 VT_DEFAULT_LOCALES = 12 1378 }; 1379 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *locales() const { 1380 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_LOCALES); 1381 } 1382 const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>> *patterns() const { 1383 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>> *>(VT_PATTERNS); 1384 } 1385 const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>> *extractors() const { 1386 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>> *>(VT_EXTRACTORS); 1387 } 1388 bool use_extractors_for_locating() const { 1389 return GetField<uint8_t>(VT_USE_EXTRACTORS_FOR_LOCATING, 1) != 0; 1390 } 1391 const flatbuffers::Vector<int32_t> *default_locales() const { 1392 return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_DEFAULT_LOCALES); 1393 } 1394 bool Verify(flatbuffers::Verifier &verifier) const { 1395 return VerifyTableStart(verifier) && 1396 VerifyOffset(verifier, VT_LOCALES) && 1397 verifier.Verify(locales()) && 1398 verifier.VerifyVectorOfStrings(locales()) && 1399 VerifyOffset(verifier, VT_PATTERNS) && 1400 verifier.Verify(patterns()) && 1401 verifier.VerifyVectorOfTables(patterns()) && 1402 VerifyOffset(verifier, VT_EXTRACTORS) && 1403 verifier.Verify(extractors()) && 1404 verifier.VerifyVectorOfTables(extractors()) && 1405 VerifyField<uint8_t>(verifier, VT_USE_EXTRACTORS_FOR_LOCATING) && 1406 VerifyOffset(verifier, VT_DEFAULT_LOCALES) && 1407 verifier.Verify(default_locales()) && 1408 verifier.EndTable(); 1409 } 1410 DatetimeModelT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1411 void UnPackTo(DatetimeModelT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1412 static flatbuffers::Offset<DatetimeModel> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1413 }; 1414 1415 struct DatetimeModelBuilder { 1416 flatbuffers::FlatBufferBuilder &fbb_; 1417 flatbuffers::uoffset_t start_; 1418 void add_locales(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> locales) { 1419 fbb_.AddOffset(DatetimeModel::VT_LOCALES, locales); 1420 } 1421 void add_patterns(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>>> patterns) { 1422 fbb_.AddOffset(DatetimeModel::VT_PATTERNS, patterns); 1423 } 1424 void add_extractors(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>>> extractors) { 1425 fbb_.AddOffset(DatetimeModel::VT_EXTRACTORS, extractors); 1426 } 1427 void add_use_extractors_for_locating(bool use_extractors_for_locating) { 1428 fbb_.AddElement<uint8_t>(DatetimeModel::VT_USE_EXTRACTORS_FOR_LOCATING, static_cast<uint8_t>(use_extractors_for_locating), 1); 1429 } 1430 void add_default_locales(flatbuffers::Offset<flatbuffers::Vector<int32_t>> default_locales) { 1431 fbb_.AddOffset(DatetimeModel::VT_DEFAULT_LOCALES, default_locales); 1432 } 1433 explicit DatetimeModelBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1434 : fbb_(_fbb) { 1435 start_ = fbb_.StartTable(); 1436 } 1437 DatetimeModelBuilder &operator=(const DatetimeModelBuilder &); 1438 flatbuffers::Offset<DatetimeModel> Finish() { 1439 const auto end = fbb_.EndTable(start_); 1440 auto o = flatbuffers::Offset<DatetimeModel>(end); 1441 return o; 1442 } 1443 }; 1444 1445 inline flatbuffers::Offset<DatetimeModel> CreateDatetimeModel( 1446 flatbuffers::FlatBufferBuilder &_fbb, 1447 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> locales = 0, 1448 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelPattern>>> patterns = 0, 1449 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<DatetimeModelExtractor>>> extractors = 0, 1450 bool use_extractors_for_locating = true, 1451 flatbuffers::Offset<flatbuffers::Vector<int32_t>> default_locales = 0) { 1452 DatetimeModelBuilder builder_(_fbb); 1453 builder_.add_default_locales(default_locales); 1454 builder_.add_extractors(extractors); 1455 builder_.add_patterns(patterns); 1456 builder_.add_locales(locales); 1457 builder_.add_use_extractors_for_locating(use_extractors_for_locating); 1458 return builder_.Finish(); 1459 } 1460 1461 inline flatbuffers::Offset<DatetimeModel> CreateDatetimeModelDirect( 1462 flatbuffers::FlatBufferBuilder &_fbb, 1463 const std::vector<flatbuffers::Offset<flatbuffers::String>> *locales = nullptr, 1464 const std::vector<flatbuffers::Offset<DatetimeModelPattern>> *patterns = nullptr, 1465 const std::vector<flatbuffers::Offset<DatetimeModelExtractor>> *extractors = nullptr, 1466 bool use_extractors_for_locating = true, 1467 const std::vector<int32_t> *default_locales = nullptr) { 1468 return libtextclassifier2::CreateDatetimeModel( 1469 _fbb, 1470 locales ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*locales) : 0, 1471 patterns ? _fbb.CreateVector<flatbuffers::Offset<DatetimeModelPattern>>(*patterns) : 0, 1472 extractors ? _fbb.CreateVector<flatbuffers::Offset<DatetimeModelExtractor>>(*extractors) : 0, 1473 use_extractors_for_locating, 1474 default_locales ? _fbb.CreateVector<int32_t>(*default_locales) : 0); 1475 } 1476 1477 flatbuffers::Offset<DatetimeModel> CreateDatetimeModel(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1478 1479 namespace DatetimeModelLibrary_ { 1480 1481 struct ItemT : public flatbuffers::NativeTable { 1482 typedef Item TableType; 1483 std::string key; 1484 std::unique_ptr<libtextclassifier2::DatetimeModelT> value; 1485 ItemT() { 1486 } 1487 }; 1488 1489 struct Item FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1490 typedef ItemT NativeTableType; 1491 enum { 1492 VT_KEY = 4, 1493 VT_VALUE = 6 1494 }; 1495 const flatbuffers::String *key() const { 1496 return GetPointer<const flatbuffers::String *>(VT_KEY); 1497 } 1498 const libtextclassifier2::DatetimeModel *value() const { 1499 return GetPointer<const libtextclassifier2::DatetimeModel *>(VT_VALUE); 1500 } 1501 bool Verify(flatbuffers::Verifier &verifier) const { 1502 return VerifyTableStart(verifier) && 1503 VerifyOffset(verifier, VT_KEY) && 1504 verifier.Verify(key()) && 1505 VerifyOffset(verifier, VT_VALUE) && 1506 verifier.VerifyTable(value()) && 1507 verifier.EndTable(); 1508 } 1509 ItemT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1510 void UnPackTo(ItemT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1511 static flatbuffers::Offset<Item> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ItemT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1512 }; 1513 1514 struct ItemBuilder { 1515 flatbuffers::FlatBufferBuilder &fbb_; 1516 flatbuffers::uoffset_t start_; 1517 void add_key(flatbuffers::Offset<flatbuffers::String> key) { 1518 fbb_.AddOffset(Item::VT_KEY, key); 1519 } 1520 void add_value(flatbuffers::Offset<libtextclassifier2::DatetimeModel> value) { 1521 fbb_.AddOffset(Item::VT_VALUE, value); 1522 } 1523 explicit ItemBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1524 : fbb_(_fbb) { 1525 start_ = fbb_.StartTable(); 1526 } 1527 ItemBuilder &operator=(const ItemBuilder &); 1528 flatbuffers::Offset<Item> Finish() { 1529 const auto end = fbb_.EndTable(start_); 1530 auto o = flatbuffers::Offset<Item>(end); 1531 return o; 1532 } 1533 }; 1534 1535 inline flatbuffers::Offset<Item> CreateItem( 1536 flatbuffers::FlatBufferBuilder &_fbb, 1537 flatbuffers::Offset<flatbuffers::String> key = 0, 1538 flatbuffers::Offset<libtextclassifier2::DatetimeModel> value = 0) { 1539 ItemBuilder builder_(_fbb); 1540 builder_.add_value(value); 1541 builder_.add_key(key); 1542 return builder_.Finish(); 1543 } 1544 1545 inline flatbuffers::Offset<Item> CreateItemDirect( 1546 flatbuffers::FlatBufferBuilder &_fbb, 1547 const char *key = nullptr, 1548 flatbuffers::Offset<libtextclassifier2::DatetimeModel> value = 0) { 1549 return libtextclassifier2::DatetimeModelLibrary_::CreateItem( 1550 _fbb, 1551 key ? _fbb.CreateString(key) : 0, 1552 value); 1553 } 1554 1555 flatbuffers::Offset<Item> CreateItem(flatbuffers::FlatBufferBuilder &_fbb, const ItemT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1556 1557 } // namespace DatetimeModelLibrary_ 1558 1559 struct DatetimeModelLibraryT : public flatbuffers::NativeTable { 1560 typedef DatetimeModelLibrary TableType; 1561 std::vector<std::unique_ptr<libtextclassifier2::DatetimeModelLibrary_::ItemT>> models; 1562 DatetimeModelLibraryT() { 1563 } 1564 }; 1565 1566 struct DatetimeModelLibrary FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1567 typedef DatetimeModelLibraryT NativeTableType; 1568 enum { 1569 VT_MODELS = 4 1570 }; 1571 const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>> *models() const { 1572 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>> *>(VT_MODELS); 1573 } 1574 bool Verify(flatbuffers::Verifier &verifier) const { 1575 return VerifyTableStart(verifier) && 1576 VerifyOffset(verifier, VT_MODELS) && 1577 verifier.Verify(models()) && 1578 verifier.VerifyVectorOfTables(models()) && 1579 verifier.EndTable(); 1580 } 1581 DatetimeModelLibraryT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1582 void UnPackTo(DatetimeModelLibraryT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1583 static flatbuffers::Offset<DatetimeModelLibrary> Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelLibraryT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1584 }; 1585 1586 struct DatetimeModelLibraryBuilder { 1587 flatbuffers::FlatBufferBuilder &fbb_; 1588 flatbuffers::uoffset_t start_; 1589 void add_models(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>>> models) { 1590 fbb_.AddOffset(DatetimeModelLibrary::VT_MODELS, models); 1591 } 1592 explicit DatetimeModelLibraryBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1593 : fbb_(_fbb) { 1594 start_ = fbb_.StartTable(); 1595 } 1596 DatetimeModelLibraryBuilder &operator=(const DatetimeModelLibraryBuilder &); 1597 flatbuffers::Offset<DatetimeModelLibrary> Finish() { 1598 const auto end = fbb_.EndTable(start_); 1599 auto o = flatbuffers::Offset<DatetimeModelLibrary>(end); 1600 return o; 1601 } 1602 }; 1603 1604 inline flatbuffers::Offset<DatetimeModelLibrary> CreateDatetimeModelLibrary( 1605 flatbuffers::FlatBufferBuilder &_fbb, 1606 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>>> models = 0) { 1607 DatetimeModelLibraryBuilder builder_(_fbb); 1608 builder_.add_models(models); 1609 return builder_.Finish(); 1610 } 1611 1612 inline flatbuffers::Offset<DatetimeModelLibrary> CreateDatetimeModelLibraryDirect( 1613 flatbuffers::FlatBufferBuilder &_fbb, 1614 const std::vector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>> *models = nullptr) { 1615 return libtextclassifier2::CreateDatetimeModelLibrary( 1616 _fbb, 1617 models ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>>(*models) : 0); 1618 } 1619 1620 flatbuffers::Offset<DatetimeModelLibrary> CreateDatetimeModelLibrary(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelLibraryT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1621 1622 struct ModelTriggeringOptionsT : public flatbuffers::NativeTable { 1623 typedef ModelTriggeringOptions TableType; 1624 float min_annotate_confidence; 1625 ModeFlag enabled_modes; 1626 ModelTriggeringOptionsT() 1627 : min_annotate_confidence(0.0f), 1628 enabled_modes(ModeFlag_ALL) { 1629 } 1630 }; 1631 1632 struct ModelTriggeringOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1633 typedef ModelTriggeringOptionsT NativeTableType; 1634 enum { 1635 VT_MIN_ANNOTATE_CONFIDENCE = 4, 1636 VT_ENABLED_MODES = 6 1637 }; 1638 float min_annotate_confidence() const { 1639 return GetField<float>(VT_MIN_ANNOTATE_CONFIDENCE, 0.0f); 1640 } 1641 ModeFlag enabled_modes() const { 1642 return static_cast<ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7)); 1643 } 1644 bool Verify(flatbuffers::Verifier &verifier) const { 1645 return VerifyTableStart(verifier) && 1646 VerifyField<float>(verifier, VT_MIN_ANNOTATE_CONFIDENCE) && 1647 VerifyField<int32_t>(verifier, VT_ENABLED_MODES) && 1648 verifier.EndTable(); 1649 } 1650 ModelTriggeringOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1651 void UnPackTo(ModelTriggeringOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1652 static flatbuffers::Offset<ModelTriggeringOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelTriggeringOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1653 }; 1654 1655 struct ModelTriggeringOptionsBuilder { 1656 flatbuffers::FlatBufferBuilder &fbb_; 1657 flatbuffers::uoffset_t start_; 1658 void add_min_annotate_confidence(float min_annotate_confidence) { 1659 fbb_.AddElement<float>(ModelTriggeringOptions::VT_MIN_ANNOTATE_CONFIDENCE, min_annotate_confidence, 0.0f); 1660 } 1661 void add_enabled_modes(ModeFlag enabled_modes) { 1662 fbb_.AddElement<int32_t>(ModelTriggeringOptions::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7); 1663 } 1664 explicit ModelTriggeringOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1665 : fbb_(_fbb) { 1666 start_ = fbb_.StartTable(); 1667 } 1668 ModelTriggeringOptionsBuilder &operator=(const ModelTriggeringOptionsBuilder &); 1669 flatbuffers::Offset<ModelTriggeringOptions> Finish() { 1670 const auto end = fbb_.EndTable(start_); 1671 auto o = flatbuffers::Offset<ModelTriggeringOptions>(end); 1672 return o; 1673 } 1674 }; 1675 1676 inline flatbuffers::Offset<ModelTriggeringOptions> CreateModelTriggeringOptions( 1677 flatbuffers::FlatBufferBuilder &_fbb, 1678 float min_annotate_confidence = 0.0f, 1679 ModeFlag enabled_modes = ModeFlag_ALL) { 1680 ModelTriggeringOptionsBuilder builder_(_fbb); 1681 builder_.add_enabled_modes(enabled_modes); 1682 builder_.add_min_annotate_confidence(min_annotate_confidence); 1683 return builder_.Finish(); 1684 } 1685 1686 flatbuffers::Offset<ModelTriggeringOptions> CreateModelTriggeringOptions(flatbuffers::FlatBufferBuilder &_fbb, const ModelTriggeringOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1687 1688 struct OutputOptionsT : public flatbuffers::NativeTable { 1689 typedef OutputOptions TableType; 1690 std::vector<std::string> filtered_collections_annotation; 1691 std::vector<std::string> filtered_collections_classification; 1692 std::vector<std::string> filtered_collections_selection; 1693 OutputOptionsT() { 1694 } 1695 }; 1696 1697 struct OutputOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1698 typedef OutputOptionsT NativeTableType; 1699 enum { 1700 VT_FILTERED_COLLECTIONS_ANNOTATION = 4, 1701 VT_FILTERED_COLLECTIONS_CLASSIFICATION = 6, 1702 VT_FILTERED_COLLECTIONS_SELECTION = 8 1703 }; 1704 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_annotation() const { 1705 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_FILTERED_COLLECTIONS_ANNOTATION); 1706 } 1707 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_classification() const { 1708 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_FILTERED_COLLECTIONS_CLASSIFICATION); 1709 } 1710 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_selection() const { 1711 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_FILTERED_COLLECTIONS_SELECTION); 1712 } 1713 bool Verify(flatbuffers::Verifier &verifier) const { 1714 return VerifyTableStart(verifier) && 1715 VerifyOffset(verifier, VT_FILTERED_COLLECTIONS_ANNOTATION) && 1716 verifier.Verify(filtered_collections_annotation()) && 1717 verifier.VerifyVectorOfStrings(filtered_collections_annotation()) && 1718 VerifyOffset(verifier, VT_FILTERED_COLLECTIONS_CLASSIFICATION) && 1719 verifier.Verify(filtered_collections_classification()) && 1720 verifier.VerifyVectorOfStrings(filtered_collections_classification()) && 1721 VerifyOffset(verifier, VT_FILTERED_COLLECTIONS_SELECTION) && 1722 verifier.Verify(filtered_collections_selection()) && 1723 verifier.VerifyVectorOfStrings(filtered_collections_selection()) && 1724 verifier.EndTable(); 1725 } 1726 OutputOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1727 void UnPackTo(OutputOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1728 static flatbuffers::Offset<OutputOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const OutputOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1729 }; 1730 1731 struct OutputOptionsBuilder { 1732 flatbuffers::FlatBufferBuilder &fbb_; 1733 flatbuffers::uoffset_t start_; 1734 void add_filtered_collections_annotation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_annotation) { 1735 fbb_.AddOffset(OutputOptions::VT_FILTERED_COLLECTIONS_ANNOTATION, filtered_collections_annotation); 1736 } 1737 void add_filtered_collections_classification(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_classification) { 1738 fbb_.AddOffset(OutputOptions::VT_FILTERED_COLLECTIONS_CLASSIFICATION, filtered_collections_classification); 1739 } 1740 void add_filtered_collections_selection(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_selection) { 1741 fbb_.AddOffset(OutputOptions::VT_FILTERED_COLLECTIONS_SELECTION, filtered_collections_selection); 1742 } 1743 explicit OutputOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1744 : fbb_(_fbb) { 1745 start_ = fbb_.StartTable(); 1746 } 1747 OutputOptionsBuilder &operator=(const OutputOptionsBuilder &); 1748 flatbuffers::Offset<OutputOptions> Finish() { 1749 const auto end = fbb_.EndTable(start_); 1750 auto o = flatbuffers::Offset<OutputOptions>(end); 1751 return o; 1752 } 1753 }; 1754 1755 inline flatbuffers::Offset<OutputOptions> CreateOutputOptions( 1756 flatbuffers::FlatBufferBuilder &_fbb, 1757 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_annotation = 0, 1758 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_classification = 0, 1759 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> filtered_collections_selection = 0) { 1760 OutputOptionsBuilder builder_(_fbb); 1761 builder_.add_filtered_collections_selection(filtered_collections_selection); 1762 builder_.add_filtered_collections_classification(filtered_collections_classification); 1763 builder_.add_filtered_collections_annotation(filtered_collections_annotation); 1764 return builder_.Finish(); 1765 } 1766 1767 inline flatbuffers::Offset<OutputOptions> CreateOutputOptionsDirect( 1768 flatbuffers::FlatBufferBuilder &_fbb, 1769 const std::vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_annotation = nullptr, 1770 const std::vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_classification = nullptr, 1771 const std::vector<flatbuffers::Offset<flatbuffers::String>> *filtered_collections_selection = nullptr) { 1772 return libtextclassifier2::CreateOutputOptions( 1773 _fbb, 1774 filtered_collections_annotation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*filtered_collections_annotation) : 0, 1775 filtered_collections_classification ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*filtered_collections_classification) : 0, 1776 filtered_collections_selection ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*filtered_collections_selection) : 0); 1777 } 1778 1779 flatbuffers::Offset<OutputOptions> CreateOutputOptions(flatbuffers::FlatBufferBuilder &_fbb, const OutputOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1780 1781 struct ModelT : public flatbuffers::NativeTable { 1782 typedef Model TableType; 1783 std::string locales; 1784 int32_t version; 1785 std::string name; 1786 std::unique_ptr<FeatureProcessorOptionsT> selection_feature_options; 1787 std::unique_ptr<FeatureProcessorOptionsT> classification_feature_options; 1788 std::vector<uint8_t> selection_model; 1789 std::vector<uint8_t> classification_model; 1790 std::vector<uint8_t> embedding_model; 1791 std::unique_ptr<SelectionModelOptionsT> selection_options; 1792 std::unique_ptr<ClassificationModelOptionsT> classification_options; 1793 std::unique_ptr<RegexModelT> regex_model; 1794 std::unique_ptr<DatetimeModelT> datetime_model; 1795 std::unique_ptr<ModelTriggeringOptionsT> triggering_options; 1796 ModeFlag enabled_modes; 1797 bool snap_whitespace_selections; 1798 std::unique_ptr<OutputOptionsT> output_options; 1799 ModelT() 1800 : version(0), 1801 enabled_modes(ModeFlag_ALL), 1802 snap_whitespace_selections(true) { 1803 } 1804 }; 1805 1806 struct Model FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1807 typedef ModelT NativeTableType; 1808 enum { 1809 VT_LOCALES = 4, 1810 VT_VERSION = 6, 1811 VT_NAME = 8, 1812 VT_SELECTION_FEATURE_OPTIONS = 10, 1813 VT_CLASSIFICATION_FEATURE_OPTIONS = 12, 1814 VT_SELECTION_MODEL = 14, 1815 VT_CLASSIFICATION_MODEL = 16, 1816 VT_EMBEDDING_MODEL = 18, 1817 VT_SELECTION_OPTIONS = 20, 1818 VT_CLASSIFICATION_OPTIONS = 22, 1819 VT_REGEX_MODEL = 24, 1820 VT_DATETIME_MODEL = 26, 1821 VT_TRIGGERING_OPTIONS = 28, 1822 VT_ENABLED_MODES = 30, 1823 VT_SNAP_WHITESPACE_SELECTIONS = 32, 1824 VT_OUTPUT_OPTIONS = 34 1825 }; 1826 const flatbuffers::String *locales() const { 1827 return GetPointer<const flatbuffers::String *>(VT_LOCALES); 1828 } 1829 int32_t version() const { 1830 return GetField<int32_t>(VT_VERSION, 0); 1831 } 1832 const flatbuffers::String *name() const { 1833 return GetPointer<const flatbuffers::String *>(VT_NAME); 1834 } 1835 const FeatureProcessorOptions *selection_feature_options() const { 1836 return GetPointer<const FeatureProcessorOptions *>(VT_SELECTION_FEATURE_OPTIONS); 1837 } 1838 const FeatureProcessorOptions *classification_feature_options() const { 1839 return GetPointer<const FeatureProcessorOptions *>(VT_CLASSIFICATION_FEATURE_OPTIONS); 1840 } 1841 const flatbuffers::Vector<uint8_t> *selection_model() const { 1842 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_SELECTION_MODEL); 1843 } 1844 const flatbuffers::Vector<uint8_t> *classification_model() const { 1845 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_CLASSIFICATION_MODEL); 1846 } 1847 const flatbuffers::Vector<uint8_t> *embedding_model() const { 1848 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_EMBEDDING_MODEL); 1849 } 1850 const SelectionModelOptions *selection_options() const { 1851 return GetPointer<const SelectionModelOptions *>(VT_SELECTION_OPTIONS); 1852 } 1853 const ClassificationModelOptions *classification_options() const { 1854 return GetPointer<const ClassificationModelOptions *>(VT_CLASSIFICATION_OPTIONS); 1855 } 1856 const RegexModel *regex_model() const { 1857 return GetPointer<const RegexModel *>(VT_REGEX_MODEL); 1858 } 1859 const DatetimeModel *datetime_model() const { 1860 return GetPointer<const DatetimeModel *>(VT_DATETIME_MODEL); 1861 } 1862 const ModelTriggeringOptions *triggering_options() const { 1863 return GetPointer<const ModelTriggeringOptions *>(VT_TRIGGERING_OPTIONS); 1864 } 1865 ModeFlag enabled_modes() const { 1866 return static_cast<ModeFlag>(GetField<int32_t>(VT_ENABLED_MODES, 7)); 1867 } 1868 bool snap_whitespace_selections() const { 1869 return GetField<uint8_t>(VT_SNAP_WHITESPACE_SELECTIONS, 1) != 0; 1870 } 1871 const OutputOptions *output_options() const { 1872 return GetPointer<const OutputOptions *>(VT_OUTPUT_OPTIONS); 1873 } 1874 bool Verify(flatbuffers::Verifier &verifier) const { 1875 return VerifyTableStart(verifier) && 1876 VerifyOffset(verifier, VT_LOCALES) && 1877 verifier.Verify(locales()) && 1878 VerifyField<int32_t>(verifier, VT_VERSION) && 1879 VerifyOffset(verifier, VT_NAME) && 1880 verifier.Verify(name()) && 1881 VerifyOffset(verifier, VT_SELECTION_FEATURE_OPTIONS) && 1882 verifier.VerifyTable(selection_feature_options()) && 1883 VerifyOffset(verifier, VT_CLASSIFICATION_FEATURE_OPTIONS) && 1884 verifier.VerifyTable(classification_feature_options()) && 1885 VerifyOffset(verifier, VT_SELECTION_MODEL) && 1886 verifier.Verify(selection_model()) && 1887 VerifyOffset(verifier, VT_CLASSIFICATION_MODEL) && 1888 verifier.Verify(classification_model()) && 1889 VerifyOffset(verifier, VT_EMBEDDING_MODEL) && 1890 verifier.Verify(embedding_model()) && 1891 VerifyOffset(verifier, VT_SELECTION_OPTIONS) && 1892 verifier.VerifyTable(selection_options()) && 1893 VerifyOffset(verifier, VT_CLASSIFICATION_OPTIONS) && 1894 verifier.VerifyTable(classification_options()) && 1895 VerifyOffset(verifier, VT_REGEX_MODEL) && 1896 verifier.VerifyTable(regex_model()) && 1897 VerifyOffset(verifier, VT_DATETIME_MODEL) && 1898 verifier.VerifyTable(datetime_model()) && 1899 VerifyOffset(verifier, VT_TRIGGERING_OPTIONS) && 1900 verifier.VerifyTable(triggering_options()) && 1901 VerifyField<int32_t>(verifier, VT_ENABLED_MODES) && 1902 VerifyField<uint8_t>(verifier, VT_SNAP_WHITESPACE_SELECTIONS) && 1903 VerifyOffset(verifier, VT_OUTPUT_OPTIONS) && 1904 verifier.VerifyTable(output_options()) && 1905 verifier.EndTable(); 1906 } 1907 ModelT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1908 void UnPackTo(ModelT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1909 static flatbuffers::Offset<Model> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1910 }; 1911 1912 struct ModelBuilder { 1913 flatbuffers::FlatBufferBuilder &fbb_; 1914 flatbuffers::uoffset_t start_; 1915 void add_locales(flatbuffers::Offset<flatbuffers::String> locales) { 1916 fbb_.AddOffset(Model::VT_LOCALES, locales); 1917 } 1918 void add_version(int32_t version) { 1919 fbb_.AddElement<int32_t>(Model::VT_VERSION, version, 0); 1920 } 1921 void add_name(flatbuffers::Offset<flatbuffers::String> name) { 1922 fbb_.AddOffset(Model::VT_NAME, name); 1923 } 1924 void add_selection_feature_options(flatbuffers::Offset<FeatureProcessorOptions> selection_feature_options) { 1925 fbb_.AddOffset(Model::VT_SELECTION_FEATURE_OPTIONS, selection_feature_options); 1926 } 1927 void add_classification_feature_options(flatbuffers::Offset<FeatureProcessorOptions> classification_feature_options) { 1928 fbb_.AddOffset(Model::VT_CLASSIFICATION_FEATURE_OPTIONS, classification_feature_options); 1929 } 1930 void add_selection_model(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> selection_model) { 1931 fbb_.AddOffset(Model::VT_SELECTION_MODEL, selection_model); 1932 } 1933 void add_classification_model(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> classification_model) { 1934 fbb_.AddOffset(Model::VT_CLASSIFICATION_MODEL, classification_model); 1935 } 1936 void add_embedding_model(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> embedding_model) { 1937 fbb_.AddOffset(Model::VT_EMBEDDING_MODEL, embedding_model); 1938 } 1939 void add_selection_options(flatbuffers::Offset<SelectionModelOptions> selection_options) { 1940 fbb_.AddOffset(Model::VT_SELECTION_OPTIONS, selection_options); 1941 } 1942 void add_classification_options(flatbuffers::Offset<ClassificationModelOptions> classification_options) { 1943 fbb_.AddOffset(Model::VT_CLASSIFICATION_OPTIONS, classification_options); 1944 } 1945 void add_regex_model(flatbuffers::Offset<RegexModel> regex_model) { 1946 fbb_.AddOffset(Model::VT_REGEX_MODEL, regex_model); 1947 } 1948 void add_datetime_model(flatbuffers::Offset<DatetimeModel> datetime_model) { 1949 fbb_.AddOffset(Model::VT_DATETIME_MODEL, datetime_model); 1950 } 1951 void add_triggering_options(flatbuffers::Offset<ModelTriggeringOptions> triggering_options) { 1952 fbb_.AddOffset(Model::VT_TRIGGERING_OPTIONS, triggering_options); 1953 } 1954 void add_enabled_modes(ModeFlag enabled_modes) { 1955 fbb_.AddElement<int32_t>(Model::VT_ENABLED_MODES, static_cast<int32_t>(enabled_modes), 7); 1956 } 1957 void add_snap_whitespace_selections(bool snap_whitespace_selections) { 1958 fbb_.AddElement<uint8_t>(Model::VT_SNAP_WHITESPACE_SELECTIONS, static_cast<uint8_t>(snap_whitespace_selections), 1); 1959 } 1960 void add_output_options(flatbuffers::Offset<OutputOptions> output_options) { 1961 fbb_.AddOffset(Model::VT_OUTPUT_OPTIONS, output_options); 1962 } 1963 explicit ModelBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1964 : fbb_(_fbb) { 1965 start_ = fbb_.StartTable(); 1966 } 1967 ModelBuilder &operator=(const ModelBuilder &); 1968 flatbuffers::Offset<Model> Finish() { 1969 const auto end = fbb_.EndTable(start_); 1970 auto o = flatbuffers::Offset<Model>(end); 1971 return o; 1972 } 1973 }; 1974 1975 inline flatbuffers::Offset<Model> CreateModel( 1976 flatbuffers::FlatBufferBuilder &_fbb, 1977 flatbuffers::Offset<flatbuffers::String> locales = 0, 1978 int32_t version = 0, 1979 flatbuffers::Offset<flatbuffers::String> name = 0, 1980 flatbuffers::Offset<FeatureProcessorOptions> selection_feature_options = 0, 1981 flatbuffers::Offset<FeatureProcessorOptions> classification_feature_options = 0, 1982 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> selection_model = 0, 1983 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> classification_model = 0, 1984 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> embedding_model = 0, 1985 flatbuffers::Offset<SelectionModelOptions> selection_options = 0, 1986 flatbuffers::Offset<ClassificationModelOptions> classification_options = 0, 1987 flatbuffers::Offset<RegexModel> regex_model = 0, 1988 flatbuffers::Offset<DatetimeModel> datetime_model = 0, 1989 flatbuffers::Offset<ModelTriggeringOptions> triggering_options = 0, 1990 ModeFlag enabled_modes = ModeFlag_ALL, 1991 bool snap_whitespace_selections = true, 1992 flatbuffers::Offset<OutputOptions> output_options = 0) { 1993 ModelBuilder builder_(_fbb); 1994 builder_.add_output_options(output_options); 1995 builder_.add_enabled_modes(enabled_modes); 1996 builder_.add_triggering_options(triggering_options); 1997 builder_.add_datetime_model(datetime_model); 1998 builder_.add_regex_model(regex_model); 1999 builder_.add_classification_options(classification_options); 2000 builder_.add_selection_options(selection_options); 2001 builder_.add_embedding_model(embedding_model); 2002 builder_.add_classification_model(classification_model); 2003 builder_.add_selection_model(selection_model); 2004 builder_.add_classification_feature_options(classification_feature_options); 2005 builder_.add_selection_feature_options(selection_feature_options); 2006 builder_.add_name(name); 2007 builder_.add_version(version); 2008 builder_.add_locales(locales); 2009 builder_.add_snap_whitespace_selections(snap_whitespace_selections); 2010 return builder_.Finish(); 2011 } 2012 2013 inline flatbuffers::Offset<Model> CreateModelDirect( 2014 flatbuffers::FlatBufferBuilder &_fbb, 2015 const char *locales = nullptr, 2016 int32_t version = 0, 2017 const char *name = nullptr, 2018 flatbuffers::Offset<FeatureProcessorOptions> selection_feature_options = 0, 2019 flatbuffers::Offset<FeatureProcessorOptions> classification_feature_options = 0, 2020 const std::vector<uint8_t> *selection_model = nullptr, 2021 const std::vector<uint8_t> *classification_model = nullptr, 2022 const std::vector<uint8_t> *embedding_model = nullptr, 2023 flatbuffers::Offset<SelectionModelOptions> selection_options = 0, 2024 flatbuffers::Offset<ClassificationModelOptions> classification_options = 0, 2025 flatbuffers::Offset<RegexModel> regex_model = 0, 2026 flatbuffers::Offset<DatetimeModel> datetime_model = 0, 2027 flatbuffers::Offset<ModelTriggeringOptions> triggering_options = 0, 2028 ModeFlag enabled_modes = ModeFlag_ALL, 2029 bool snap_whitespace_selections = true, 2030 flatbuffers::Offset<OutputOptions> output_options = 0) { 2031 return libtextclassifier2::CreateModel( 2032 _fbb, 2033 locales ? _fbb.CreateString(locales) : 0, 2034 version, 2035 name ? _fbb.CreateString(name) : 0, 2036 selection_feature_options, 2037 classification_feature_options, 2038 selection_model ? _fbb.CreateVector<uint8_t>(*selection_model) : 0, 2039 classification_model ? _fbb.CreateVector<uint8_t>(*classification_model) : 0, 2040 embedding_model ? _fbb.CreateVector<uint8_t>(*embedding_model) : 0, 2041 selection_options, 2042 classification_options, 2043 regex_model, 2044 datetime_model, 2045 triggering_options, 2046 enabled_modes, 2047 snap_whitespace_selections, 2048 output_options); 2049 } 2050 2051 flatbuffers::Offset<Model> CreateModel(flatbuffers::FlatBufferBuilder &_fbb, const ModelT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2052 2053 struct TokenizationCodepointRangeT : public flatbuffers::NativeTable { 2054 typedef TokenizationCodepointRange TableType; 2055 int32_t start; 2056 int32_t end; 2057 libtextclassifier2::TokenizationCodepointRange_::Role role; 2058 int32_t script_id; 2059 TokenizationCodepointRangeT() 2060 : start(0), 2061 end(0), 2062 role(libtextclassifier2::TokenizationCodepointRange_::Role_DEFAULT_ROLE), 2063 script_id(0) { 2064 } 2065 }; 2066 2067 struct TokenizationCodepointRange FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 2068 typedef TokenizationCodepointRangeT NativeTableType; 2069 enum { 2070 VT_START = 4, 2071 VT_END = 6, 2072 VT_ROLE = 8, 2073 VT_SCRIPT_ID = 10 2074 }; 2075 int32_t start() const { 2076 return GetField<int32_t>(VT_START, 0); 2077 } 2078 int32_t end() const { 2079 return GetField<int32_t>(VT_END, 0); 2080 } 2081 libtextclassifier2::TokenizationCodepointRange_::Role role() const { 2082 return static_cast<libtextclassifier2::TokenizationCodepointRange_::Role>(GetField<int32_t>(VT_ROLE, 0)); 2083 } 2084 int32_t script_id() const { 2085 return GetField<int32_t>(VT_SCRIPT_ID, 0); 2086 } 2087 bool Verify(flatbuffers::Verifier &verifier) const { 2088 return VerifyTableStart(verifier) && 2089 VerifyField<int32_t>(verifier, VT_START) && 2090 VerifyField<int32_t>(verifier, VT_END) && 2091 VerifyField<int32_t>(verifier, VT_ROLE) && 2092 VerifyField<int32_t>(verifier, VT_SCRIPT_ID) && 2093 verifier.EndTable(); 2094 } 2095 TokenizationCodepointRangeT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2096 void UnPackTo(TokenizationCodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2097 static flatbuffers::Offset<TokenizationCodepointRange> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2098 }; 2099 2100 struct TokenizationCodepointRangeBuilder { 2101 flatbuffers::FlatBufferBuilder &fbb_; 2102 flatbuffers::uoffset_t start_; 2103 void add_start(int32_t start) { 2104 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_START, start, 0); 2105 } 2106 void add_end(int32_t end) { 2107 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_END, end, 0); 2108 } 2109 void add_role(libtextclassifier2::TokenizationCodepointRange_::Role role) { 2110 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_ROLE, static_cast<int32_t>(role), 0); 2111 } 2112 void add_script_id(int32_t script_id) { 2113 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_SCRIPT_ID, script_id, 0); 2114 } 2115 explicit TokenizationCodepointRangeBuilder(flatbuffers::FlatBufferBuilder &_fbb) 2116 : fbb_(_fbb) { 2117 start_ = fbb_.StartTable(); 2118 } 2119 TokenizationCodepointRangeBuilder &operator=(const TokenizationCodepointRangeBuilder &); 2120 flatbuffers::Offset<TokenizationCodepointRange> Finish() { 2121 const auto end = fbb_.EndTable(start_); 2122 auto o = flatbuffers::Offset<TokenizationCodepointRange>(end); 2123 return o; 2124 } 2125 }; 2126 2127 inline flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange( 2128 flatbuffers::FlatBufferBuilder &_fbb, 2129 int32_t start = 0, 2130 int32_t end = 0, 2131 libtextclassifier2::TokenizationCodepointRange_::Role role = libtextclassifier2::TokenizationCodepointRange_::Role_DEFAULT_ROLE, 2132 int32_t script_id = 0) { 2133 TokenizationCodepointRangeBuilder builder_(_fbb); 2134 builder_.add_script_id(script_id); 2135 builder_.add_role(role); 2136 builder_.add_end(end); 2137 builder_.add_start(start); 2138 return builder_.Finish(); 2139 } 2140 2141 flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2142 2143 namespace FeatureProcessorOptions_ { 2144 2145 struct CodepointRangeT : public flatbuffers::NativeTable { 2146 typedef CodepointRange TableType; 2147 int32_t start; 2148 int32_t end; 2149 CodepointRangeT() 2150 : start(0), 2151 end(0) { 2152 } 2153 }; 2154 2155 struct CodepointRange FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 2156 typedef CodepointRangeT NativeTableType; 2157 enum { 2158 VT_START = 4, 2159 VT_END = 6 2160 }; 2161 int32_t start() const { 2162 return GetField<int32_t>(VT_START, 0); 2163 } 2164 int32_t end() const { 2165 return GetField<int32_t>(VT_END, 0); 2166 } 2167 bool Verify(flatbuffers::Verifier &verifier) const { 2168 return VerifyTableStart(verifier) && 2169 VerifyField<int32_t>(verifier, VT_START) && 2170 VerifyField<int32_t>(verifier, VT_END) && 2171 verifier.EndTable(); 2172 } 2173 CodepointRangeT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2174 void UnPackTo(CodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2175 static flatbuffers::Offset<CodepointRange> Pack(flatbuffers::FlatBufferBuilder &_fbb, const CodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2176 }; 2177 2178 struct CodepointRangeBuilder { 2179 flatbuffers::FlatBufferBuilder &fbb_; 2180 flatbuffers::uoffset_t start_; 2181 void add_start(int32_t start) { 2182 fbb_.AddElement<int32_t>(CodepointRange::VT_START, start, 0); 2183 } 2184 void add_end(int32_t end) { 2185 fbb_.AddElement<int32_t>(CodepointRange::VT_END, end, 0); 2186 } 2187 explicit CodepointRangeBuilder(flatbuffers::FlatBufferBuilder &_fbb) 2188 : fbb_(_fbb) { 2189 start_ = fbb_.StartTable(); 2190 } 2191 CodepointRangeBuilder &operator=(const CodepointRangeBuilder &); 2192 flatbuffers::Offset<CodepointRange> Finish() { 2193 const auto end = fbb_.EndTable(start_); 2194 auto o = flatbuffers::Offset<CodepointRange>(end); 2195 return o; 2196 } 2197 }; 2198 2199 inline flatbuffers::Offset<CodepointRange> CreateCodepointRange( 2200 flatbuffers::FlatBufferBuilder &_fbb, 2201 int32_t start = 0, 2202 int32_t end = 0) { 2203 CodepointRangeBuilder builder_(_fbb); 2204 builder_.add_end(end); 2205 builder_.add_start(start); 2206 return builder_.Finish(); 2207 } 2208 2209 flatbuffers::Offset<CodepointRange> CreateCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const CodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2210 2211 struct BoundsSensitiveFeaturesT : public flatbuffers::NativeTable { 2212 typedef BoundsSensitiveFeatures TableType; 2213 bool enabled; 2214 int32_t num_tokens_before; 2215 int32_t num_tokens_inside_left; 2216 int32_t num_tokens_inside_right; 2217 int32_t num_tokens_after; 2218 bool include_inside_bag; 2219 bool include_inside_length; 2220 bool score_single_token_spans_as_zero; 2221 BoundsSensitiveFeaturesT() 2222 : enabled(false), 2223 num_tokens_before(0), 2224 num_tokens_inside_left(0), 2225 num_tokens_inside_right(0), 2226 num_tokens_after(0), 2227 include_inside_bag(false), 2228 include_inside_length(false), 2229 score_single_token_spans_as_zero(false) { 2230 } 2231 }; 2232 2233 struct BoundsSensitiveFeatures FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 2234 typedef BoundsSensitiveFeaturesT NativeTableType; 2235 enum { 2236 VT_ENABLED = 4, 2237 VT_NUM_TOKENS_BEFORE = 6, 2238 VT_NUM_TOKENS_INSIDE_LEFT = 8, 2239 VT_NUM_TOKENS_INSIDE_RIGHT = 10, 2240 VT_NUM_TOKENS_AFTER = 12, 2241 VT_INCLUDE_INSIDE_BAG = 14, 2242 VT_INCLUDE_INSIDE_LENGTH = 16, 2243 VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO = 18 2244 }; 2245 bool enabled() const { 2246 return GetField<uint8_t>(VT_ENABLED, 0) != 0; 2247 } 2248 int32_t num_tokens_before() const { 2249 return GetField<int32_t>(VT_NUM_TOKENS_BEFORE, 0); 2250 } 2251 int32_t num_tokens_inside_left() const { 2252 return GetField<int32_t>(VT_NUM_TOKENS_INSIDE_LEFT, 0); 2253 } 2254 int32_t num_tokens_inside_right() const { 2255 return GetField<int32_t>(VT_NUM_TOKENS_INSIDE_RIGHT, 0); 2256 } 2257 int32_t num_tokens_after() const { 2258 return GetField<int32_t>(VT_NUM_TOKENS_AFTER, 0); 2259 } 2260 bool include_inside_bag() const { 2261 return GetField<uint8_t>(VT_INCLUDE_INSIDE_BAG, 0) != 0; 2262 } 2263 bool include_inside_length() const { 2264 return GetField<uint8_t>(VT_INCLUDE_INSIDE_LENGTH, 0) != 0; 2265 } 2266 bool score_single_token_spans_as_zero() const { 2267 return GetField<uint8_t>(VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO, 0) != 0; 2268 } 2269 bool Verify(flatbuffers::Verifier &verifier) const { 2270 return VerifyTableStart(verifier) && 2271 VerifyField<uint8_t>(verifier, VT_ENABLED) && 2272 VerifyField<int32_t>(verifier, VT_NUM_TOKENS_BEFORE) && 2273 VerifyField<int32_t>(verifier, VT_NUM_TOKENS_INSIDE_LEFT) && 2274 VerifyField<int32_t>(verifier, VT_NUM_TOKENS_INSIDE_RIGHT) && 2275 VerifyField<int32_t>(verifier, VT_NUM_TOKENS_AFTER) && 2276 VerifyField<uint8_t>(verifier, VT_INCLUDE_INSIDE_BAG) && 2277 VerifyField<uint8_t>(verifier, VT_INCLUDE_INSIDE_LENGTH) && 2278 VerifyField<uint8_t>(verifier, VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO) && 2279 verifier.EndTable(); 2280 } 2281 BoundsSensitiveFeaturesT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2282 void UnPackTo(BoundsSensitiveFeaturesT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2283 static flatbuffers::Offset<BoundsSensitiveFeatures> Pack(flatbuffers::FlatBufferBuilder &_fbb, const BoundsSensitiveFeaturesT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2284 }; 2285 2286 struct BoundsSensitiveFeaturesBuilder { 2287 flatbuffers::FlatBufferBuilder &fbb_; 2288 flatbuffers::uoffset_t start_; 2289 void add_enabled(bool enabled) { 2290 fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_ENABLED, static_cast<uint8_t>(enabled), 0); 2291 } 2292 void add_num_tokens_before(int32_t num_tokens_before) { 2293 fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_BEFORE, num_tokens_before, 0); 2294 } 2295 void add_num_tokens_inside_left(int32_t num_tokens_inside_left) { 2296 fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_INSIDE_LEFT, num_tokens_inside_left, 0); 2297 } 2298 void add_num_tokens_inside_right(int32_t num_tokens_inside_right) { 2299 fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_INSIDE_RIGHT, num_tokens_inside_right, 0); 2300 } 2301 void add_num_tokens_after(int32_t num_tokens_after) { 2302 fbb_.AddElement<int32_t>(BoundsSensitiveFeatures::VT_NUM_TOKENS_AFTER, num_tokens_after, 0); 2303 } 2304 void add_include_inside_bag(bool include_inside_bag) { 2305 fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_INCLUDE_INSIDE_BAG, static_cast<uint8_t>(include_inside_bag), 0); 2306 } 2307 void add_include_inside_length(bool include_inside_length) { 2308 fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_INCLUDE_INSIDE_LENGTH, static_cast<uint8_t>(include_inside_length), 0); 2309 } 2310 void add_score_single_token_spans_as_zero(bool score_single_token_spans_as_zero) { 2311 fbb_.AddElement<uint8_t>(BoundsSensitiveFeatures::VT_SCORE_SINGLE_TOKEN_SPANS_AS_ZERO, static_cast<uint8_t>(score_single_token_spans_as_zero), 0); 2312 } 2313 explicit BoundsSensitiveFeaturesBuilder(flatbuffers::FlatBufferBuilder &_fbb) 2314 : fbb_(_fbb) { 2315 start_ = fbb_.StartTable(); 2316 } 2317 BoundsSensitiveFeaturesBuilder &operator=(const BoundsSensitiveFeaturesBuilder &); 2318 flatbuffers::Offset<BoundsSensitiveFeatures> Finish() { 2319 const auto end = fbb_.EndTable(start_); 2320 auto o = flatbuffers::Offset<BoundsSensitiveFeatures>(end); 2321 return o; 2322 } 2323 }; 2324 2325 inline flatbuffers::Offset<BoundsSensitiveFeatures> CreateBoundsSensitiveFeatures( 2326 flatbuffers::FlatBufferBuilder &_fbb, 2327 bool enabled = false, 2328 int32_t num_tokens_before = 0, 2329 int32_t num_tokens_inside_left = 0, 2330 int32_t num_tokens_inside_right = 0, 2331 int32_t num_tokens_after = 0, 2332 bool include_inside_bag = false, 2333 bool include_inside_length = false, 2334 bool score_single_token_spans_as_zero = false) { 2335 BoundsSensitiveFeaturesBuilder builder_(_fbb); 2336 builder_.add_num_tokens_after(num_tokens_after); 2337 builder_.add_num_tokens_inside_right(num_tokens_inside_right); 2338 builder_.add_num_tokens_inside_left(num_tokens_inside_left); 2339 builder_.add_num_tokens_before(num_tokens_before); 2340 builder_.add_score_single_token_spans_as_zero(score_single_token_spans_as_zero); 2341 builder_.add_include_inside_length(include_inside_length); 2342 builder_.add_include_inside_bag(include_inside_bag); 2343 builder_.add_enabled(enabled); 2344 return builder_.Finish(); 2345 } 2346 2347 flatbuffers::Offset<BoundsSensitiveFeatures> CreateBoundsSensitiveFeatures(flatbuffers::FlatBufferBuilder &_fbb, const BoundsSensitiveFeaturesT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2348 2349 struct AlternativeCollectionMapEntryT : public flatbuffers::NativeTable { 2350 typedef AlternativeCollectionMapEntry TableType; 2351 std::string key; 2352 std::string value; 2353 AlternativeCollectionMapEntryT() { 2354 } 2355 }; 2356 2357 struct AlternativeCollectionMapEntry FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 2358 typedef AlternativeCollectionMapEntryT NativeTableType; 2359 enum { 2360 VT_KEY = 4, 2361 VT_VALUE = 6 2362 }; 2363 const flatbuffers::String *key() const { 2364 return GetPointer<const flatbuffers::String *>(VT_KEY); 2365 } 2366 const flatbuffers::String *value() const { 2367 return GetPointer<const flatbuffers::String *>(VT_VALUE); 2368 } 2369 bool Verify(flatbuffers::Verifier &verifier) const { 2370 return VerifyTableStart(verifier) && 2371 VerifyOffset(verifier, VT_KEY) && 2372 verifier.Verify(key()) && 2373 VerifyOffset(verifier, VT_VALUE) && 2374 verifier.Verify(value()) && 2375 verifier.EndTable(); 2376 } 2377 AlternativeCollectionMapEntryT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2378 void UnPackTo(AlternativeCollectionMapEntryT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2379 static flatbuffers::Offset<AlternativeCollectionMapEntry> Pack(flatbuffers::FlatBufferBuilder &_fbb, const AlternativeCollectionMapEntryT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2380 }; 2381 2382 struct AlternativeCollectionMapEntryBuilder { 2383 flatbuffers::FlatBufferBuilder &fbb_; 2384 flatbuffers::uoffset_t start_; 2385 void add_key(flatbuffers::Offset<flatbuffers::String> key) { 2386 fbb_.AddOffset(AlternativeCollectionMapEntry::VT_KEY, key); 2387 } 2388 void add_value(flatbuffers::Offset<flatbuffers::String> value) { 2389 fbb_.AddOffset(AlternativeCollectionMapEntry::VT_VALUE, value); 2390 } 2391 explicit AlternativeCollectionMapEntryBuilder(flatbuffers::FlatBufferBuilder &_fbb) 2392 : fbb_(_fbb) { 2393 start_ = fbb_.StartTable(); 2394 } 2395 AlternativeCollectionMapEntryBuilder &operator=(const AlternativeCollectionMapEntryBuilder &); 2396 flatbuffers::Offset<AlternativeCollectionMapEntry> Finish() { 2397 const auto end = fbb_.EndTable(start_); 2398 auto o = flatbuffers::Offset<AlternativeCollectionMapEntry>(end); 2399 return o; 2400 } 2401 }; 2402 2403 inline flatbuffers::Offset<AlternativeCollectionMapEntry> CreateAlternativeCollectionMapEntry( 2404 flatbuffers::FlatBufferBuilder &_fbb, 2405 flatbuffers::Offset<flatbuffers::String> key = 0, 2406 flatbuffers::Offset<flatbuffers::String> value = 0) { 2407 AlternativeCollectionMapEntryBuilder builder_(_fbb); 2408 builder_.add_value(value); 2409 builder_.add_key(key); 2410 return builder_.Finish(); 2411 } 2412 2413 inline flatbuffers::Offset<AlternativeCollectionMapEntry> CreateAlternativeCollectionMapEntryDirect( 2414 flatbuffers::FlatBufferBuilder &_fbb, 2415 const char *key = nullptr, 2416 const char *value = nullptr) { 2417 return libtextclassifier2::FeatureProcessorOptions_::CreateAlternativeCollectionMapEntry( 2418 _fbb, 2419 key ? _fbb.CreateString(key) : 0, 2420 value ? _fbb.CreateString(value) : 0); 2421 } 2422 2423 flatbuffers::Offset<AlternativeCollectionMapEntry> CreateAlternativeCollectionMapEntry(flatbuffers::FlatBufferBuilder &_fbb, const AlternativeCollectionMapEntryT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2424 2425 } // namespace FeatureProcessorOptions_ 2426 2427 struct FeatureProcessorOptionsT : public flatbuffers::NativeTable { 2428 typedef FeatureProcessorOptions TableType; 2429 int32_t num_buckets; 2430 int32_t embedding_size; 2431 int32_t embedding_quantization_bits; 2432 int32_t context_size; 2433 int32_t max_selection_span; 2434 std::vector<int32_t> chargram_orders; 2435 int32_t max_word_length; 2436 bool unicode_aware_features; 2437 bool extract_case_feature; 2438 bool extract_selection_mask_feature; 2439 std::vector<std::string> regexp_feature; 2440 bool remap_digits; 2441 bool lowercase_tokens; 2442 bool selection_reduced_output_space; 2443 std::vector<std::string> collections; 2444 int32_t default_collection; 2445 bool only_use_line_with_click; 2446 bool split_tokens_on_selection_boundaries; 2447 std::vector<std::unique_ptr<TokenizationCodepointRangeT>> tokenization_codepoint_config; 2448 libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod center_token_selection_method; 2449 bool snap_label_span_boundaries_to_containing_tokens; 2450 std::vector<std::unique_ptr<libtextclassifier2::FeatureProcessorOptions_::CodepointRangeT>> supported_codepoint_ranges; 2451 std::vector<std::unique_ptr<libtextclassifier2::FeatureProcessorOptions_::CodepointRangeT>> internal_tokenizer_codepoint_ranges; 2452 float min_supported_codepoint_ratio; 2453 int32_t feature_version; 2454 libtextclassifier2::FeatureProcessorOptions_::TokenizationType tokenization_type; 2455 bool icu_preserve_whitespace_tokens; 2456 std::vector<int32_t> ignored_span_boundary_codepoints; 2457 std::unique_ptr<libtextclassifier2::FeatureProcessorOptions_::BoundsSensitiveFeaturesT> bounds_sensitive_features; 2458 std::vector<std::string> allowed_chargrams; 2459 bool tokenize_on_script_change; 2460 FeatureProcessorOptionsT() 2461 : num_buckets(-1), 2462 embedding_size(-1), 2463 embedding_quantization_bits(8), 2464 context_size(-1), 2465 max_selection_span(-1), 2466 max_word_length(20), 2467 unicode_aware_features(false), 2468 extract_case_feature(false), 2469 extract_selection_mask_feature(false), 2470 remap_digits(false), 2471 lowercase_tokens(false), 2472 selection_reduced_output_space(true), 2473 default_collection(-1), 2474 only_use_line_with_click(false), 2475 split_tokens_on_selection_boundaries(false), 2476 center_token_selection_method(libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD), 2477 snap_label_span_boundaries_to_containing_tokens(false), 2478 min_supported_codepoint_ratio(0.0f), 2479 feature_version(0), 2480 tokenization_type(libtextclassifier2::FeatureProcessorOptions_::TokenizationType_INTERNAL_TOKENIZER), 2481 icu_preserve_whitespace_tokens(false), 2482 tokenize_on_script_change(false) { 2483 } 2484 }; 2485 2486 struct FeatureProcessorOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 2487 typedef FeatureProcessorOptionsT NativeTableType; 2488 enum { 2489 VT_NUM_BUCKETS = 4, 2490 VT_EMBEDDING_SIZE = 6, 2491 VT_EMBEDDING_QUANTIZATION_BITS = 8, 2492 VT_CONTEXT_SIZE = 10, 2493 VT_MAX_SELECTION_SPAN = 12, 2494 VT_CHARGRAM_ORDERS = 14, 2495 VT_MAX_WORD_LENGTH = 16, 2496 VT_UNICODE_AWARE_FEATURES = 18, 2497 VT_EXTRACT_CASE_FEATURE = 20, 2498 VT_EXTRACT_SELECTION_MASK_FEATURE = 22, 2499 VT_REGEXP_FEATURE = 24, 2500 VT_REMAP_DIGITS = 26, 2501 VT_LOWERCASE_TOKENS = 28, 2502 VT_SELECTION_REDUCED_OUTPUT_SPACE = 30, 2503 VT_COLLECTIONS = 32, 2504 VT_DEFAULT_COLLECTION = 34, 2505 VT_ONLY_USE_LINE_WITH_CLICK = 36, 2506 VT_SPLIT_TOKENS_ON_SELECTION_BOUNDARIES = 38, 2507 VT_TOKENIZATION_CODEPOINT_CONFIG = 40, 2508 VT_CENTER_TOKEN_SELECTION_METHOD = 42, 2509 VT_SNAP_LABEL_SPAN_BOUNDARIES_TO_CONTAINING_TOKENS = 44, 2510 VT_SUPPORTED_CODEPOINT_RANGES = 46, 2511 VT_INTERNAL_TOKENIZER_CODEPOINT_RANGES = 48, 2512 VT_MIN_SUPPORTED_CODEPOINT_RATIO = 50, 2513 VT_FEATURE_VERSION = 52, 2514 VT_TOKENIZATION_TYPE = 54, 2515 VT_ICU_PRESERVE_WHITESPACE_TOKENS = 56, 2516 VT_IGNORED_SPAN_BOUNDARY_CODEPOINTS = 58, 2517 VT_BOUNDS_SENSITIVE_FEATURES = 60, 2518 VT_ALLOWED_CHARGRAMS = 62, 2519 VT_TOKENIZE_ON_SCRIPT_CHANGE = 64 2520 }; 2521 int32_t num_buckets() const { 2522 return GetField<int32_t>(VT_NUM_BUCKETS, -1); 2523 } 2524 int32_t embedding_size() const { 2525 return GetField<int32_t>(VT_EMBEDDING_SIZE, -1); 2526 } 2527 int32_t embedding_quantization_bits() const { 2528 return GetField<int32_t>(VT_EMBEDDING_QUANTIZATION_BITS, 8); 2529 } 2530 int32_t context_size() const { 2531 return GetField<int32_t>(VT_CONTEXT_SIZE, -1); 2532 } 2533 int32_t max_selection_span() const { 2534 return GetField<int32_t>(VT_MAX_SELECTION_SPAN, -1); 2535 } 2536 const flatbuffers::Vector<int32_t> *chargram_orders() const { 2537 return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_CHARGRAM_ORDERS); 2538 } 2539 int32_t max_word_length() const { 2540 return GetField<int32_t>(VT_MAX_WORD_LENGTH, 20); 2541 } 2542 bool unicode_aware_features() const { 2543 return GetField<uint8_t>(VT_UNICODE_AWARE_FEATURES, 0) != 0; 2544 } 2545 bool extract_case_feature() const { 2546 return GetField<uint8_t>(VT_EXTRACT_CASE_FEATURE, 0) != 0; 2547 } 2548 bool extract_selection_mask_feature() const { 2549 return GetField<uint8_t>(VT_EXTRACT_SELECTION_MASK_FEATURE, 0) != 0; 2550 } 2551 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *regexp_feature() const { 2552 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_REGEXP_FEATURE); 2553 } 2554 bool remap_digits() const { 2555 return GetField<uint8_t>(VT_REMAP_DIGITS, 0) != 0; 2556 } 2557 bool lowercase_tokens() const { 2558 return GetField<uint8_t>(VT_LOWERCASE_TOKENS, 0) != 0; 2559 } 2560 bool selection_reduced_output_space() const { 2561 return GetField<uint8_t>(VT_SELECTION_REDUCED_OUTPUT_SPACE, 1) != 0; 2562 } 2563 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *collections() const { 2564 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_COLLECTIONS); 2565 } 2566 int32_t default_collection() const { 2567 return GetField<int32_t>(VT_DEFAULT_COLLECTION, -1); 2568 } 2569 bool only_use_line_with_click() const { 2570 return GetField<uint8_t>(VT_ONLY_USE_LINE_WITH_CLICK, 0) != 0; 2571 } 2572 bool split_tokens_on_selection_boundaries() const { 2573 return GetField<uint8_t>(VT_SPLIT_TOKENS_ON_SELECTION_BOUNDARIES, 0) != 0; 2574 } 2575 const flatbuffers::Vector<flatbuffers::Offset<TokenizationCodepointRange>> *tokenization_codepoint_config() const { 2576 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<TokenizationCodepointRange>> *>(VT_TOKENIZATION_CODEPOINT_CONFIG); 2577 } 2578 libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod center_token_selection_method() const { 2579 return static_cast<libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod>(GetField<int32_t>(VT_CENTER_TOKEN_SELECTION_METHOD, 0)); 2580 } 2581 bool snap_label_span_boundaries_to_containing_tokens() const { 2582 return GetField<uint8_t>(VT_SNAP_LABEL_SPAN_BOUNDARIES_TO_CONTAINING_TOKENS, 0) != 0; 2583 } 2584 const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> *supported_codepoint_ranges() const { 2585 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> *>(VT_SUPPORTED_CODEPOINT_RANGES); 2586 } 2587 const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> *internal_tokenizer_codepoint_ranges() const { 2588 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> *>(VT_INTERNAL_TOKENIZER_CODEPOINT_RANGES); 2589 } 2590 float min_supported_codepoint_ratio() const { 2591 return GetField<float>(VT_MIN_SUPPORTED_CODEPOINT_RATIO, 0.0f); 2592 } 2593 int32_t feature_version() const { 2594 return GetField<int32_t>(VT_FEATURE_VERSION, 0); 2595 } 2596 libtextclassifier2::FeatureProcessorOptions_::TokenizationType tokenization_type() const { 2597 return static_cast<libtextclassifier2::FeatureProcessorOptions_::TokenizationType>(GetField<int32_t>(VT_TOKENIZATION_TYPE, 1)); 2598 } 2599 bool icu_preserve_whitespace_tokens() const { 2600 return GetField<uint8_t>(VT_ICU_PRESERVE_WHITESPACE_TOKENS, 0) != 0; 2601 } 2602 const flatbuffers::Vector<int32_t> *ignored_span_boundary_codepoints() const { 2603 return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_IGNORED_SPAN_BOUNDARY_CODEPOINTS); 2604 } 2605 const libtextclassifier2::FeatureProcessorOptions_::BoundsSensitiveFeatures *bounds_sensitive_features() const { 2606 return GetPointer<const libtextclassifier2::FeatureProcessorOptions_::BoundsSensitiveFeatures *>(VT_BOUNDS_SENSITIVE_FEATURES); 2607 } 2608 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *allowed_chargrams() const { 2609 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_ALLOWED_CHARGRAMS); 2610 } 2611 bool tokenize_on_script_change() const { 2612 return GetField<uint8_t>(VT_TOKENIZE_ON_SCRIPT_CHANGE, 0) != 0; 2613 } 2614 bool Verify(flatbuffers::Verifier &verifier) const { 2615 return VerifyTableStart(verifier) && 2616 VerifyField<int32_t>(verifier, VT_NUM_BUCKETS) && 2617 VerifyField<int32_t>(verifier, VT_EMBEDDING_SIZE) && 2618 VerifyField<int32_t>(verifier, VT_EMBEDDING_QUANTIZATION_BITS) && 2619 VerifyField<int32_t>(verifier, VT_CONTEXT_SIZE) && 2620 VerifyField<int32_t>(verifier, VT_MAX_SELECTION_SPAN) && 2621 VerifyOffset(verifier, VT_CHARGRAM_ORDERS) && 2622 verifier.Verify(chargram_orders()) && 2623 VerifyField<int32_t>(verifier, VT_MAX_WORD_LENGTH) && 2624 VerifyField<uint8_t>(verifier, VT_UNICODE_AWARE_FEATURES) && 2625 VerifyField<uint8_t>(verifier, VT_EXTRACT_CASE_FEATURE) && 2626 VerifyField<uint8_t>(verifier, VT_EXTRACT_SELECTION_MASK_FEATURE) && 2627 VerifyOffset(verifier, VT_REGEXP_FEATURE) && 2628 verifier.Verify(regexp_feature()) && 2629 verifier.VerifyVectorOfStrings(regexp_feature()) && 2630 VerifyField<uint8_t>(verifier, VT_REMAP_DIGITS) && 2631 VerifyField<uint8_t>(verifier, VT_LOWERCASE_TOKENS) && 2632 VerifyField<uint8_t>(verifier, VT_SELECTION_REDUCED_OUTPUT_SPACE) && 2633 VerifyOffset(verifier, VT_COLLECTIONS) && 2634 verifier.Verify(collections()) && 2635 verifier.VerifyVectorOfStrings(collections()) && 2636 VerifyField<int32_t>(verifier, VT_DEFAULT_COLLECTION) && 2637 VerifyField<uint8_t>(verifier, VT_ONLY_USE_LINE_WITH_CLICK) && 2638 VerifyField<uint8_t>(verifier, VT_SPLIT_TOKENS_ON_SELECTION_BOUNDARIES) && 2639 VerifyOffset(verifier, VT_TOKENIZATION_CODEPOINT_CONFIG) && 2640 verifier.Verify(tokenization_codepoint_config()) && 2641 verifier.VerifyVectorOfTables(tokenization_codepoint_config()) && 2642 VerifyField<int32_t>(verifier, VT_CENTER_TOKEN_SELECTION_METHOD) && 2643 VerifyField<uint8_t>(verifier, VT_SNAP_LABEL_SPAN_BOUNDARIES_TO_CONTAINING_TOKENS) && 2644 VerifyOffset(verifier, VT_SUPPORTED_CODEPOINT_RANGES) && 2645 verifier.Verify(supported_codepoint_ranges()) && 2646 verifier.VerifyVectorOfTables(supported_codepoint_ranges()) && 2647 VerifyOffset(verifier, VT_INTERNAL_TOKENIZER_CODEPOINT_RANGES) && 2648 verifier.Verify(internal_tokenizer_codepoint_ranges()) && 2649 verifier.VerifyVectorOfTables(internal_tokenizer_codepoint_ranges()) && 2650 VerifyField<float>(verifier, VT_MIN_SUPPORTED_CODEPOINT_RATIO) && 2651 VerifyField<int32_t>(verifier, VT_FEATURE_VERSION) && 2652 VerifyField<int32_t>(verifier, VT_TOKENIZATION_TYPE) && 2653 VerifyField<uint8_t>(verifier, VT_ICU_PRESERVE_WHITESPACE_TOKENS) && 2654 VerifyOffset(verifier, VT_IGNORED_SPAN_BOUNDARY_CODEPOINTS) && 2655 verifier.Verify(ignored_span_boundary_codepoints()) && 2656 VerifyOffset(verifier, VT_BOUNDS_SENSITIVE_FEATURES) && 2657 verifier.VerifyTable(bounds_sensitive_features()) && 2658 VerifyOffset(verifier, VT_ALLOWED_CHARGRAMS) && 2659 verifier.Verify(allowed_chargrams()) && 2660 verifier.VerifyVectorOfStrings(allowed_chargrams()) && 2661 VerifyField<uint8_t>(verifier, VT_TOKENIZE_ON_SCRIPT_CHANGE) && 2662 verifier.EndTable(); 2663 } 2664 FeatureProcessorOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2665 void UnPackTo(FeatureProcessorOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 2666 static flatbuffers::Offset<FeatureProcessorOptions> Pack(flatbuffers::FlatBufferBuilder &_fbb, const FeatureProcessorOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2667 }; 2668 2669 struct FeatureProcessorOptionsBuilder { 2670 flatbuffers::FlatBufferBuilder &fbb_; 2671 flatbuffers::uoffset_t start_; 2672 void add_num_buckets(int32_t num_buckets) { 2673 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_NUM_BUCKETS, num_buckets, -1); 2674 } 2675 void add_embedding_size(int32_t embedding_size) { 2676 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_EMBEDDING_SIZE, embedding_size, -1); 2677 } 2678 void add_embedding_quantization_bits(int32_t embedding_quantization_bits) { 2679 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_EMBEDDING_QUANTIZATION_BITS, embedding_quantization_bits, 8); 2680 } 2681 void add_context_size(int32_t context_size) { 2682 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_CONTEXT_SIZE, context_size, -1); 2683 } 2684 void add_max_selection_span(int32_t max_selection_span) { 2685 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_MAX_SELECTION_SPAN, max_selection_span, -1); 2686 } 2687 void add_chargram_orders(flatbuffers::Offset<flatbuffers::Vector<int32_t>> chargram_orders) { 2688 fbb_.AddOffset(FeatureProcessorOptions::VT_CHARGRAM_ORDERS, chargram_orders); 2689 } 2690 void add_max_word_length(int32_t max_word_length) { 2691 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_MAX_WORD_LENGTH, max_word_length, 20); 2692 } 2693 void add_unicode_aware_features(bool unicode_aware_features) { 2694 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_UNICODE_AWARE_FEATURES, static_cast<uint8_t>(unicode_aware_features), 0); 2695 } 2696 void add_extract_case_feature(bool extract_case_feature) { 2697 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_EXTRACT_CASE_FEATURE, static_cast<uint8_t>(extract_case_feature), 0); 2698 } 2699 void add_extract_selection_mask_feature(bool extract_selection_mask_feature) { 2700 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_EXTRACT_SELECTION_MASK_FEATURE, static_cast<uint8_t>(extract_selection_mask_feature), 0); 2701 } 2702 void add_regexp_feature(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> regexp_feature) { 2703 fbb_.AddOffset(FeatureProcessorOptions::VT_REGEXP_FEATURE, regexp_feature); 2704 } 2705 void add_remap_digits(bool remap_digits) { 2706 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_REMAP_DIGITS, static_cast<uint8_t>(remap_digits), 0); 2707 } 2708 void add_lowercase_tokens(bool lowercase_tokens) { 2709 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_LOWERCASE_TOKENS, static_cast<uint8_t>(lowercase_tokens), 0); 2710 } 2711 void add_selection_reduced_output_space(bool selection_reduced_output_space) { 2712 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_SELECTION_REDUCED_OUTPUT_SPACE, static_cast<uint8_t>(selection_reduced_output_space), 1); 2713 } 2714 void add_collections(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> collections) { 2715 fbb_.AddOffset(FeatureProcessorOptions::VT_COLLECTIONS, collections); 2716 } 2717 void add_default_collection(int32_t default_collection) { 2718 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_DEFAULT_COLLECTION, default_collection, -1); 2719 } 2720 void add_only_use_line_with_click(bool only_use_line_with_click) { 2721 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_ONLY_USE_LINE_WITH_CLICK, static_cast<uint8_t>(only_use_line_with_click), 0); 2722 } 2723 void add_split_tokens_on_selection_boundaries(bool split_tokens_on_selection_boundaries) { 2724 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_SPLIT_TOKENS_ON_SELECTION_BOUNDARIES, static_cast<uint8_t>(split_tokens_on_selection_boundaries), 0); 2725 } 2726 void add_tokenization_codepoint_config(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TokenizationCodepointRange>>> tokenization_codepoint_config) { 2727 fbb_.AddOffset(FeatureProcessorOptions::VT_TOKENIZATION_CODEPOINT_CONFIG, tokenization_codepoint_config); 2728 } 2729 void add_center_token_selection_method(libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod center_token_selection_method) { 2730 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_CENTER_TOKEN_SELECTION_METHOD, static_cast<int32_t>(center_token_selection_method), 0); 2731 } 2732 void add_snap_label_span_boundaries_to_containing_tokens(bool snap_label_span_boundaries_to_containing_tokens) { 2733 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_SNAP_LABEL_SPAN_BOUNDARIES_TO_CONTAINING_TOKENS, static_cast<uint8_t>(snap_label_span_boundaries_to_containing_tokens), 0); 2734 } 2735 void add_supported_codepoint_ranges(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>>> supported_codepoint_ranges) { 2736 fbb_.AddOffset(FeatureProcessorOptions::VT_SUPPORTED_CODEPOINT_RANGES, supported_codepoint_ranges); 2737 } 2738 void add_internal_tokenizer_codepoint_ranges(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>>> internal_tokenizer_codepoint_ranges) { 2739 fbb_.AddOffset(FeatureProcessorOptions::VT_INTERNAL_TOKENIZER_CODEPOINT_RANGES, internal_tokenizer_codepoint_ranges); 2740 } 2741 void add_min_supported_codepoint_ratio(float min_supported_codepoint_ratio) { 2742 fbb_.AddElement<float>(FeatureProcessorOptions::VT_MIN_SUPPORTED_CODEPOINT_RATIO, min_supported_codepoint_ratio, 0.0f); 2743 } 2744 void add_feature_version(int32_t feature_version) { 2745 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_FEATURE_VERSION, feature_version, 0); 2746 } 2747 void add_tokenization_type(libtextclassifier2::FeatureProcessorOptions_::TokenizationType tokenization_type) { 2748 fbb_.AddElement<int32_t>(FeatureProcessorOptions::VT_TOKENIZATION_TYPE, static_cast<int32_t>(tokenization_type), 1); 2749 } 2750 void add_icu_preserve_whitespace_tokens(bool icu_preserve_whitespace_tokens) { 2751 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_ICU_PRESERVE_WHITESPACE_TOKENS, static_cast<uint8_t>(icu_preserve_whitespace_tokens), 0); 2752 } 2753 void add_ignored_span_boundary_codepoints(flatbuffers::Offset<flatbuffers::Vector<int32_t>> ignored_span_boundary_codepoints) { 2754 fbb_.AddOffset(FeatureProcessorOptions::VT_IGNORED_SPAN_BOUNDARY_CODEPOINTS, ignored_span_boundary_codepoints); 2755 } 2756 void add_bounds_sensitive_features(flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::BoundsSensitiveFeatures> bounds_sensitive_features) { 2757 fbb_.AddOffset(FeatureProcessorOptions::VT_BOUNDS_SENSITIVE_FEATURES, bounds_sensitive_features); 2758 } 2759 void add_allowed_chargrams(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> allowed_chargrams) { 2760 fbb_.AddOffset(FeatureProcessorOptions::VT_ALLOWED_CHARGRAMS, allowed_chargrams); 2761 } 2762 void add_tokenize_on_script_change(bool tokenize_on_script_change) { 2763 fbb_.AddElement<uint8_t>(FeatureProcessorOptions::VT_TOKENIZE_ON_SCRIPT_CHANGE, static_cast<uint8_t>(tokenize_on_script_change), 0); 2764 } 2765 explicit FeatureProcessorOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) 2766 : fbb_(_fbb) { 2767 start_ = fbb_.StartTable(); 2768 } 2769 FeatureProcessorOptionsBuilder &operator=(const FeatureProcessorOptionsBuilder &); 2770 flatbuffers::Offset<FeatureProcessorOptions> Finish() { 2771 const auto end = fbb_.EndTable(start_); 2772 auto o = flatbuffers::Offset<FeatureProcessorOptions>(end); 2773 return o; 2774 } 2775 }; 2776 2777 inline flatbuffers::Offset<FeatureProcessorOptions> CreateFeatureProcessorOptions( 2778 flatbuffers::FlatBufferBuilder &_fbb, 2779 int32_t num_buckets = -1, 2780 int32_t embedding_size = -1, 2781 int32_t embedding_quantization_bits = 8, 2782 int32_t context_size = -1, 2783 int32_t max_selection_span = -1, 2784 flatbuffers::Offset<flatbuffers::Vector<int32_t>> chargram_orders = 0, 2785 int32_t max_word_length = 20, 2786 bool unicode_aware_features = false, 2787 bool extract_case_feature = false, 2788 bool extract_selection_mask_feature = false, 2789 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> regexp_feature = 0, 2790 bool remap_digits = false, 2791 bool lowercase_tokens = false, 2792 bool selection_reduced_output_space = true, 2793 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> collections = 0, 2794 int32_t default_collection = -1, 2795 bool only_use_line_with_click = false, 2796 bool split_tokens_on_selection_boundaries = false, 2797 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TokenizationCodepointRange>>> tokenization_codepoint_config = 0, 2798 libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod center_token_selection_method = libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD, 2799 bool snap_label_span_boundaries_to_containing_tokens = false, 2800 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>>> supported_codepoint_ranges = 0, 2801 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>>> internal_tokenizer_codepoint_ranges = 0, 2802 float min_supported_codepoint_ratio = 0.0f, 2803 int32_t feature_version = 0, 2804 libtextclassifier2::FeatureProcessorOptions_::TokenizationType tokenization_type = libtextclassifier2::FeatureProcessorOptions_::TokenizationType_INTERNAL_TOKENIZER, 2805 bool icu_preserve_whitespace_tokens = false, 2806 flatbuffers::Offset<flatbuffers::Vector<int32_t>> ignored_span_boundary_codepoints = 0, 2807 flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::BoundsSensitiveFeatures> bounds_sensitive_features = 0, 2808 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> allowed_chargrams = 0, 2809 bool tokenize_on_script_change = false) { 2810 FeatureProcessorOptionsBuilder builder_(_fbb); 2811 builder_.add_allowed_chargrams(allowed_chargrams); 2812 builder_.add_bounds_sensitive_features(bounds_sensitive_features); 2813 builder_.add_ignored_span_boundary_codepoints(ignored_span_boundary_codepoints); 2814 builder_.add_tokenization_type(tokenization_type); 2815 builder_.add_feature_version(feature_version); 2816 builder_.add_min_supported_codepoint_ratio(min_supported_codepoint_ratio); 2817 builder_.add_internal_tokenizer_codepoint_ranges(internal_tokenizer_codepoint_ranges); 2818 builder_.add_supported_codepoint_ranges(supported_codepoint_ranges); 2819 builder_.add_center_token_selection_method(center_token_selection_method); 2820 builder_.add_tokenization_codepoint_config(tokenization_codepoint_config); 2821 builder_.add_default_collection(default_collection); 2822 builder_.add_collections(collections); 2823 builder_.add_regexp_feature(regexp_feature); 2824 builder_.add_max_word_length(max_word_length); 2825 builder_.add_chargram_orders(chargram_orders); 2826 builder_.add_max_selection_span(max_selection_span); 2827 builder_.add_context_size(context_size); 2828 builder_.add_embedding_quantization_bits(embedding_quantization_bits); 2829 builder_.add_embedding_size(embedding_size); 2830 builder_.add_num_buckets(num_buckets); 2831 builder_.add_tokenize_on_script_change(tokenize_on_script_change); 2832 builder_.add_icu_preserve_whitespace_tokens(icu_preserve_whitespace_tokens); 2833 builder_.add_snap_label_span_boundaries_to_containing_tokens(snap_label_span_boundaries_to_containing_tokens); 2834 builder_.add_split_tokens_on_selection_boundaries(split_tokens_on_selection_boundaries); 2835 builder_.add_only_use_line_with_click(only_use_line_with_click); 2836 builder_.add_selection_reduced_output_space(selection_reduced_output_space); 2837 builder_.add_lowercase_tokens(lowercase_tokens); 2838 builder_.add_remap_digits(remap_digits); 2839 builder_.add_extract_selection_mask_feature(extract_selection_mask_feature); 2840 builder_.add_extract_case_feature(extract_case_feature); 2841 builder_.add_unicode_aware_features(unicode_aware_features); 2842 return builder_.Finish(); 2843 } 2844 2845 inline flatbuffers::Offset<FeatureProcessorOptions> CreateFeatureProcessorOptionsDirect( 2846 flatbuffers::FlatBufferBuilder &_fbb, 2847 int32_t num_buckets = -1, 2848 int32_t embedding_size = -1, 2849 int32_t embedding_quantization_bits = 8, 2850 int32_t context_size = -1, 2851 int32_t max_selection_span = -1, 2852 const std::vector<int32_t> *chargram_orders = nullptr, 2853 int32_t max_word_length = 20, 2854 bool unicode_aware_features = false, 2855 bool extract_case_feature = false, 2856 bool extract_selection_mask_feature = false, 2857 const std::vector<flatbuffers::Offset<flatbuffers::String>> *regexp_feature = nullptr, 2858 bool remap_digits = false, 2859 bool lowercase_tokens = false, 2860 bool selection_reduced_output_space = true, 2861 const std::vector<flatbuffers::Offset<flatbuffers::String>> *collections = nullptr, 2862 int32_t default_collection = -1, 2863 bool only_use_line_with_click = false, 2864 bool split_tokens_on_selection_boundaries = false, 2865 const std::vector<flatbuffers::Offset<TokenizationCodepointRange>> *tokenization_codepoint_config = nullptr, 2866 libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod center_token_selection_method = libtextclassifier2::FeatureProcessorOptions_::CenterTokenSelectionMethod_DEFAULT_CENTER_TOKEN_METHOD, 2867 bool snap_label_span_boundaries_to_containing_tokens = false, 2868 const std::vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> *supported_codepoint_ranges = nullptr, 2869 const std::vector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> *internal_tokenizer_codepoint_ranges = nullptr, 2870 float min_supported_codepoint_ratio = 0.0f, 2871 int32_t feature_version = 0, 2872 libtextclassifier2::FeatureProcessorOptions_::TokenizationType tokenization_type = libtextclassifier2::FeatureProcessorOptions_::TokenizationType_INTERNAL_TOKENIZER, 2873 bool icu_preserve_whitespace_tokens = false, 2874 const std::vector<int32_t> *ignored_span_boundary_codepoints = nullptr, 2875 flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::BoundsSensitiveFeatures> bounds_sensitive_features = 0, 2876 const std::vector<flatbuffers::Offset<flatbuffers::String>> *allowed_chargrams = nullptr, 2877 bool tokenize_on_script_change = false) { 2878 return libtextclassifier2::CreateFeatureProcessorOptions( 2879 _fbb, 2880 num_buckets, 2881 embedding_size, 2882 embedding_quantization_bits, 2883 context_size, 2884 max_selection_span, 2885 chargram_orders ? _fbb.CreateVector<int32_t>(*chargram_orders) : 0, 2886 max_word_length, 2887 unicode_aware_features, 2888 extract_case_feature, 2889 extract_selection_mask_feature, 2890 regexp_feature ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*regexp_feature) : 0, 2891 remap_digits, 2892 lowercase_tokens, 2893 selection_reduced_output_space, 2894 collections ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*collections) : 0, 2895 default_collection, 2896 only_use_line_with_click, 2897 split_tokens_on_selection_boundaries, 2898 tokenization_codepoint_config ? _fbb.CreateVector<flatbuffers::Offset<TokenizationCodepointRange>>(*tokenization_codepoint_config) : 0, 2899 center_token_selection_method, 2900 snap_label_span_boundaries_to_containing_tokens, 2901 supported_codepoint_ranges ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>>(*supported_codepoint_ranges) : 0, 2902 internal_tokenizer_codepoint_ranges ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>>(*internal_tokenizer_codepoint_ranges) : 0, 2903 min_supported_codepoint_ratio, 2904 feature_version, 2905 tokenization_type, 2906 icu_preserve_whitespace_tokens, 2907 ignored_span_boundary_codepoints ? _fbb.CreateVector<int32_t>(*ignored_span_boundary_codepoints) : 0, 2908 bounds_sensitive_features, 2909 allowed_chargrams ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*allowed_chargrams) : 0, 2910 tokenize_on_script_change); 2911 } 2912 2913 flatbuffers::Offset<FeatureProcessorOptions> CreateFeatureProcessorOptions(flatbuffers::FlatBufferBuilder &_fbb, const FeatureProcessorOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 2914 2915 inline CompressedBufferT *CompressedBuffer::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 2916 auto _o = new CompressedBufferT(); 2917 UnPackTo(_o, _resolver); 2918 return _o; 2919 } 2920 2921 inline void CompressedBuffer::UnPackTo(CompressedBufferT *_o, const flatbuffers::resolver_function_t *_resolver) const { 2922 (void)_o; 2923 (void)_resolver; 2924 { auto _e = buffer(); if (_e) { _o->buffer.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->buffer[_i] = _e->Get(_i); } } }; 2925 { auto _e = uncompressed_size(); _o->uncompressed_size = _e; }; 2926 } 2927 2928 inline flatbuffers::Offset<CompressedBuffer> CompressedBuffer::Pack(flatbuffers::FlatBufferBuilder &_fbb, const CompressedBufferT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 2929 return CreateCompressedBuffer(_fbb, _o, _rehasher); 2930 } 2931 2932 inline flatbuffers::Offset<CompressedBuffer> CreateCompressedBuffer(flatbuffers::FlatBufferBuilder &_fbb, const CompressedBufferT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 2933 (void)_rehasher; 2934 (void)_o; 2935 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const CompressedBufferT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 2936 auto _buffer = _o->buffer.size() ? _fbb.CreateVector(_o->buffer) : 0; 2937 auto _uncompressed_size = _o->uncompressed_size; 2938 return libtextclassifier2::CreateCompressedBuffer( 2939 _fbb, 2940 _buffer, 2941 _uncompressed_size); 2942 } 2943 2944 inline SelectionModelOptionsT *SelectionModelOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 2945 auto _o = new SelectionModelOptionsT(); 2946 UnPackTo(_o, _resolver); 2947 return _o; 2948 } 2949 2950 inline void SelectionModelOptions::UnPackTo(SelectionModelOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { 2951 (void)_o; 2952 (void)_resolver; 2953 { auto _e = strip_unpaired_brackets(); _o->strip_unpaired_brackets = _e; }; 2954 { auto _e = symmetry_context_size(); _o->symmetry_context_size = _e; }; 2955 { auto _e = batch_size(); _o->batch_size = _e; }; 2956 { auto _e = always_classify_suggested_selection(); _o->always_classify_suggested_selection = _e; }; 2957 } 2958 2959 inline flatbuffers::Offset<SelectionModelOptions> SelectionModelOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SelectionModelOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 2960 return CreateSelectionModelOptions(_fbb, _o, _rehasher); 2961 } 2962 2963 inline flatbuffers::Offset<SelectionModelOptions> CreateSelectionModelOptions(flatbuffers::FlatBufferBuilder &_fbb, const SelectionModelOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 2964 (void)_rehasher; 2965 (void)_o; 2966 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SelectionModelOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 2967 auto _strip_unpaired_brackets = _o->strip_unpaired_brackets; 2968 auto _symmetry_context_size = _o->symmetry_context_size; 2969 auto _batch_size = _o->batch_size; 2970 auto _always_classify_suggested_selection = _o->always_classify_suggested_selection; 2971 return libtextclassifier2::CreateSelectionModelOptions( 2972 _fbb, 2973 _strip_unpaired_brackets, 2974 _symmetry_context_size, 2975 _batch_size, 2976 _always_classify_suggested_selection); 2977 } 2978 2979 inline ClassificationModelOptionsT *ClassificationModelOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 2980 auto _o = new ClassificationModelOptionsT(); 2981 UnPackTo(_o, _resolver); 2982 return _o; 2983 } 2984 2985 inline void ClassificationModelOptions::UnPackTo(ClassificationModelOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { 2986 (void)_o; 2987 (void)_resolver; 2988 { auto _e = phone_min_num_digits(); _o->phone_min_num_digits = _e; }; 2989 { auto _e = phone_max_num_digits(); _o->phone_max_num_digits = _e; }; 2990 { auto _e = address_min_num_tokens(); _o->address_min_num_tokens = _e; }; 2991 { auto _e = max_num_tokens(); _o->max_num_tokens = _e; }; 2992 } 2993 2994 inline flatbuffers::Offset<ClassificationModelOptions> ClassificationModelOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ClassificationModelOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 2995 return CreateClassificationModelOptions(_fbb, _o, _rehasher); 2996 } 2997 2998 inline flatbuffers::Offset<ClassificationModelOptions> CreateClassificationModelOptions(flatbuffers::FlatBufferBuilder &_fbb, const ClassificationModelOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 2999 (void)_rehasher; 3000 (void)_o; 3001 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ClassificationModelOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3002 auto _phone_min_num_digits = _o->phone_min_num_digits; 3003 auto _phone_max_num_digits = _o->phone_max_num_digits; 3004 auto _address_min_num_tokens = _o->address_min_num_tokens; 3005 auto _max_num_tokens = _o->max_num_tokens; 3006 return libtextclassifier2::CreateClassificationModelOptions( 3007 _fbb, 3008 _phone_min_num_digits, 3009 _phone_max_num_digits, 3010 _address_min_num_tokens, 3011 _max_num_tokens); 3012 } 3013 3014 namespace RegexModel_ { 3015 3016 inline PatternT *Pattern::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3017 auto _o = new PatternT(); 3018 UnPackTo(_o, _resolver); 3019 return _o; 3020 } 3021 3022 inline void Pattern::UnPackTo(PatternT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3023 (void)_o; 3024 (void)_resolver; 3025 { auto _e = collection_name(); if (_e) _o->collection_name = _e->str(); }; 3026 { auto _e = pattern(); if (_e) _o->pattern = _e->str(); }; 3027 { auto _e = enabled_modes(); _o->enabled_modes = _e; }; 3028 { auto _e = target_classification_score(); _o->target_classification_score = _e; }; 3029 { auto _e = priority_score(); _o->priority_score = _e; }; 3030 { auto _e = use_approximate_matching(); _o->use_approximate_matching = _e; }; 3031 { auto _e = compressed_pattern(); if (_e) _o->compressed_pattern = std::unique_ptr<libtextclassifier2::CompressedBufferT>(_e->UnPack(_resolver)); }; 3032 } 3033 3034 inline flatbuffers::Offset<Pattern> Pattern::Pack(flatbuffers::FlatBufferBuilder &_fbb, const PatternT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3035 return CreatePattern(_fbb, _o, _rehasher); 3036 } 3037 3038 inline flatbuffers::Offset<Pattern> CreatePattern(flatbuffers::FlatBufferBuilder &_fbb, const PatternT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3039 (void)_rehasher; 3040 (void)_o; 3041 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const PatternT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3042 auto _collection_name = _o->collection_name.empty() ? 0 : _fbb.CreateString(_o->collection_name); 3043 auto _pattern = _o->pattern.empty() ? 0 : _fbb.CreateString(_o->pattern); 3044 auto _enabled_modes = _o->enabled_modes; 3045 auto _target_classification_score = _o->target_classification_score; 3046 auto _priority_score = _o->priority_score; 3047 auto _use_approximate_matching = _o->use_approximate_matching; 3048 auto _compressed_pattern = _o->compressed_pattern ? CreateCompressedBuffer(_fbb, _o->compressed_pattern.get(), _rehasher) : 0; 3049 return libtextclassifier2::RegexModel_::CreatePattern( 3050 _fbb, 3051 _collection_name, 3052 _pattern, 3053 _enabled_modes, 3054 _target_classification_score, 3055 _priority_score, 3056 _use_approximate_matching, 3057 _compressed_pattern); 3058 } 3059 3060 } // namespace RegexModel_ 3061 3062 inline RegexModelT *RegexModel::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3063 auto _o = new RegexModelT(); 3064 UnPackTo(_o, _resolver); 3065 return _o; 3066 } 3067 3068 inline void RegexModel::UnPackTo(RegexModelT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3069 (void)_o; 3070 (void)_resolver; 3071 { auto _e = patterns(); if (_e) { _o->patterns.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->patterns[_i] = std::unique_ptr<libtextclassifier2::RegexModel_::PatternT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3072 } 3073 3074 inline flatbuffers::Offset<RegexModel> RegexModel::Pack(flatbuffers::FlatBufferBuilder &_fbb, const RegexModelT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3075 return CreateRegexModel(_fbb, _o, _rehasher); 3076 } 3077 3078 inline flatbuffers::Offset<RegexModel> CreateRegexModel(flatbuffers::FlatBufferBuilder &_fbb, const RegexModelT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3079 (void)_rehasher; 3080 (void)_o; 3081 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const RegexModelT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3082 auto _patterns = _o->patterns.size() ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::RegexModel_::Pattern>> (_o->patterns.size(), [](size_t i, _VectorArgs *__va) { return CreatePattern(*__va->__fbb, __va->__o->patterns[i].get(), __va->__rehasher); }, &_va ) : 0; 3083 return libtextclassifier2::CreateRegexModel( 3084 _fbb, 3085 _patterns); 3086 } 3087 3088 namespace DatetimeModelPattern_ { 3089 3090 inline RegexT *Regex::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3091 auto _o = new RegexT(); 3092 UnPackTo(_o, _resolver); 3093 return _o; 3094 } 3095 3096 inline void Regex::UnPackTo(RegexT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3097 (void)_o; 3098 (void)_resolver; 3099 { auto _e = pattern(); if (_e) _o->pattern = _e->str(); }; 3100 { auto _e = groups(); if (_e) { _o->groups.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->groups[_i] = (DatetimeGroupType)_e->Get(_i); } } }; 3101 { auto _e = compressed_pattern(); if (_e) _o->compressed_pattern = std::unique_ptr<libtextclassifier2::CompressedBufferT>(_e->UnPack(_resolver)); }; 3102 } 3103 3104 inline flatbuffers::Offset<Regex> Regex::Pack(flatbuffers::FlatBufferBuilder &_fbb, const RegexT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3105 return CreateRegex(_fbb, _o, _rehasher); 3106 } 3107 3108 inline flatbuffers::Offset<Regex> CreateRegex(flatbuffers::FlatBufferBuilder &_fbb, const RegexT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3109 (void)_rehasher; 3110 (void)_o; 3111 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const RegexT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3112 auto _pattern = _o->pattern.empty() ? 0 : _fbb.CreateString(_o->pattern); 3113 auto _groups = _o->groups.size() ? _fbb.CreateVector((const int32_t*)_o->groups.data(), _o->groups.size()) : 0; 3114 auto _compressed_pattern = _o->compressed_pattern ? CreateCompressedBuffer(_fbb, _o->compressed_pattern.get(), _rehasher) : 0; 3115 return libtextclassifier2::DatetimeModelPattern_::CreateRegex( 3116 _fbb, 3117 _pattern, 3118 _groups, 3119 _compressed_pattern); 3120 } 3121 3122 } // namespace DatetimeModelPattern_ 3123 3124 inline DatetimeModelPatternT *DatetimeModelPattern::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3125 auto _o = new DatetimeModelPatternT(); 3126 UnPackTo(_o, _resolver); 3127 return _o; 3128 } 3129 3130 inline void DatetimeModelPattern::UnPackTo(DatetimeModelPatternT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3131 (void)_o; 3132 (void)_resolver; 3133 { auto _e = regexes(); if (_e) { _o->regexes.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->regexes[_i] = std::unique_ptr<libtextclassifier2::DatetimeModelPattern_::RegexT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3134 { auto _e = locales(); if (_e) { _o->locales.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->locales[_i] = _e->Get(_i); } } }; 3135 { auto _e = target_classification_score(); _o->target_classification_score = _e; }; 3136 { auto _e = priority_score(); _o->priority_score = _e; }; 3137 { auto _e = enabled_modes(); _o->enabled_modes = _e; }; 3138 } 3139 3140 inline flatbuffers::Offset<DatetimeModelPattern> DatetimeModelPattern::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelPatternT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3141 return CreateDatetimeModelPattern(_fbb, _o, _rehasher); 3142 } 3143 3144 inline flatbuffers::Offset<DatetimeModelPattern> CreateDatetimeModelPattern(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelPatternT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3145 (void)_rehasher; 3146 (void)_o; 3147 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DatetimeModelPatternT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3148 auto _regexes = _o->regexes.size() ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::DatetimeModelPattern_::Regex>> (_o->regexes.size(), [](size_t i, _VectorArgs *__va) { return CreateRegex(*__va->__fbb, __va->__o->regexes[i].get(), __va->__rehasher); }, &_va ) : 0; 3149 auto _locales = _o->locales.size() ? _fbb.CreateVector(_o->locales) : 0; 3150 auto _target_classification_score = _o->target_classification_score; 3151 auto _priority_score = _o->priority_score; 3152 auto _enabled_modes = _o->enabled_modes; 3153 return libtextclassifier2::CreateDatetimeModelPattern( 3154 _fbb, 3155 _regexes, 3156 _locales, 3157 _target_classification_score, 3158 _priority_score, 3159 _enabled_modes); 3160 } 3161 3162 inline DatetimeModelExtractorT *DatetimeModelExtractor::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3163 auto _o = new DatetimeModelExtractorT(); 3164 UnPackTo(_o, _resolver); 3165 return _o; 3166 } 3167 3168 inline void DatetimeModelExtractor::UnPackTo(DatetimeModelExtractorT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3169 (void)_o; 3170 (void)_resolver; 3171 { auto _e = extractor(); _o->extractor = _e; }; 3172 { auto _e = pattern(); if (_e) _o->pattern = _e->str(); }; 3173 { auto _e = locales(); if (_e) { _o->locales.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->locales[_i] = _e->Get(_i); } } }; 3174 { auto _e = compressed_pattern(); if (_e) _o->compressed_pattern = std::unique_ptr<CompressedBufferT>(_e->UnPack(_resolver)); }; 3175 } 3176 3177 inline flatbuffers::Offset<DatetimeModelExtractor> DatetimeModelExtractor::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelExtractorT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3178 return CreateDatetimeModelExtractor(_fbb, _o, _rehasher); 3179 } 3180 3181 inline flatbuffers::Offset<DatetimeModelExtractor> CreateDatetimeModelExtractor(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelExtractorT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3182 (void)_rehasher; 3183 (void)_o; 3184 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DatetimeModelExtractorT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3185 auto _extractor = _o->extractor; 3186 auto _pattern = _o->pattern.empty() ? 0 : _fbb.CreateString(_o->pattern); 3187 auto _locales = _o->locales.size() ? _fbb.CreateVector(_o->locales) : 0; 3188 auto _compressed_pattern = _o->compressed_pattern ? CreateCompressedBuffer(_fbb, _o->compressed_pattern.get(), _rehasher) : 0; 3189 return libtextclassifier2::CreateDatetimeModelExtractor( 3190 _fbb, 3191 _extractor, 3192 _pattern, 3193 _locales, 3194 _compressed_pattern); 3195 } 3196 3197 inline DatetimeModelT *DatetimeModel::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3198 auto _o = new DatetimeModelT(); 3199 UnPackTo(_o, _resolver); 3200 return _o; 3201 } 3202 3203 inline void DatetimeModel::UnPackTo(DatetimeModelT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3204 (void)_o; 3205 (void)_resolver; 3206 { auto _e = locales(); if (_e) { _o->locales.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->locales[_i] = _e->Get(_i)->str(); } } }; 3207 { auto _e = patterns(); if (_e) { _o->patterns.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->patterns[_i] = std::unique_ptr<DatetimeModelPatternT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3208 { auto _e = extractors(); if (_e) { _o->extractors.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->extractors[_i] = std::unique_ptr<DatetimeModelExtractorT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3209 { auto _e = use_extractors_for_locating(); _o->use_extractors_for_locating = _e; }; 3210 { auto _e = default_locales(); if (_e) { _o->default_locales.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->default_locales[_i] = _e->Get(_i); } } }; 3211 } 3212 3213 inline flatbuffers::Offset<DatetimeModel> DatetimeModel::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3214 return CreateDatetimeModel(_fbb, _o, _rehasher); 3215 } 3216 3217 inline flatbuffers::Offset<DatetimeModel> CreateDatetimeModel(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3218 (void)_rehasher; 3219 (void)_o; 3220 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DatetimeModelT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3221 auto _locales = _o->locales.size() ? _fbb.CreateVectorOfStrings(_o->locales) : 0; 3222 auto _patterns = _o->patterns.size() ? _fbb.CreateVector<flatbuffers::Offset<DatetimeModelPattern>> (_o->patterns.size(), [](size_t i, _VectorArgs *__va) { return CreateDatetimeModelPattern(*__va->__fbb, __va->__o->patterns[i].get(), __va->__rehasher); }, &_va ) : 0; 3223 auto _extractors = _o->extractors.size() ? _fbb.CreateVector<flatbuffers::Offset<DatetimeModelExtractor>> (_o->extractors.size(), [](size_t i, _VectorArgs *__va) { return CreateDatetimeModelExtractor(*__va->__fbb, __va->__o->extractors[i].get(), __va->__rehasher); }, &_va ) : 0; 3224 auto _use_extractors_for_locating = _o->use_extractors_for_locating; 3225 auto _default_locales = _o->default_locales.size() ? _fbb.CreateVector(_o->default_locales) : 0; 3226 return libtextclassifier2::CreateDatetimeModel( 3227 _fbb, 3228 _locales, 3229 _patterns, 3230 _extractors, 3231 _use_extractors_for_locating, 3232 _default_locales); 3233 } 3234 3235 namespace DatetimeModelLibrary_ { 3236 3237 inline ItemT *Item::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3238 auto _o = new ItemT(); 3239 UnPackTo(_o, _resolver); 3240 return _o; 3241 } 3242 3243 inline void Item::UnPackTo(ItemT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3244 (void)_o; 3245 (void)_resolver; 3246 { auto _e = key(); if (_e) _o->key = _e->str(); }; 3247 { auto _e = value(); if (_e) _o->value = std::unique_ptr<libtextclassifier2::DatetimeModelT>(_e->UnPack(_resolver)); }; 3248 } 3249 3250 inline flatbuffers::Offset<Item> Item::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ItemT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3251 return CreateItem(_fbb, _o, _rehasher); 3252 } 3253 3254 inline flatbuffers::Offset<Item> CreateItem(flatbuffers::FlatBufferBuilder &_fbb, const ItemT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3255 (void)_rehasher; 3256 (void)_o; 3257 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ItemT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3258 auto _key = _o->key.empty() ? 0 : _fbb.CreateString(_o->key); 3259 auto _value = _o->value ? CreateDatetimeModel(_fbb, _o->value.get(), _rehasher) : 0; 3260 return libtextclassifier2::DatetimeModelLibrary_::CreateItem( 3261 _fbb, 3262 _key, 3263 _value); 3264 } 3265 3266 } // namespace DatetimeModelLibrary_ 3267 3268 inline DatetimeModelLibraryT *DatetimeModelLibrary::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3269 auto _o = new DatetimeModelLibraryT(); 3270 UnPackTo(_o, _resolver); 3271 return _o; 3272 } 3273 3274 inline void DatetimeModelLibrary::UnPackTo(DatetimeModelLibraryT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3275 (void)_o; 3276 (void)_resolver; 3277 { auto _e = models(); if (_e) { _o->models.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->models[_i] = std::unique_ptr<libtextclassifier2::DatetimeModelLibrary_::ItemT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3278 } 3279 3280 inline flatbuffers::Offset<DatetimeModelLibrary> DatetimeModelLibrary::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelLibraryT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3281 return CreateDatetimeModelLibrary(_fbb, _o, _rehasher); 3282 } 3283 3284 inline flatbuffers::Offset<DatetimeModelLibrary> CreateDatetimeModelLibrary(flatbuffers::FlatBufferBuilder &_fbb, const DatetimeModelLibraryT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3285 (void)_rehasher; 3286 (void)_o; 3287 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DatetimeModelLibraryT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3288 auto _models = _o->models.size() ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::DatetimeModelLibrary_::Item>> (_o->models.size(), [](size_t i, _VectorArgs *__va) { return CreateItem(*__va->__fbb, __va->__o->models[i].get(), __va->__rehasher); }, &_va ) : 0; 3289 return libtextclassifier2::CreateDatetimeModelLibrary( 3290 _fbb, 3291 _models); 3292 } 3293 3294 inline ModelTriggeringOptionsT *ModelTriggeringOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3295 auto _o = new ModelTriggeringOptionsT(); 3296 UnPackTo(_o, _resolver); 3297 return _o; 3298 } 3299 3300 inline void ModelTriggeringOptions::UnPackTo(ModelTriggeringOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3301 (void)_o; 3302 (void)_resolver; 3303 { auto _e = min_annotate_confidence(); _o->min_annotate_confidence = _e; }; 3304 { auto _e = enabled_modes(); _o->enabled_modes = _e; }; 3305 } 3306 3307 inline flatbuffers::Offset<ModelTriggeringOptions> ModelTriggeringOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelTriggeringOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3308 return CreateModelTriggeringOptions(_fbb, _o, _rehasher); 3309 } 3310 3311 inline flatbuffers::Offset<ModelTriggeringOptions> CreateModelTriggeringOptions(flatbuffers::FlatBufferBuilder &_fbb, const ModelTriggeringOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3312 (void)_rehasher; 3313 (void)_o; 3314 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ModelTriggeringOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3315 auto _min_annotate_confidence = _o->min_annotate_confidence; 3316 auto _enabled_modes = _o->enabled_modes; 3317 return libtextclassifier2::CreateModelTriggeringOptions( 3318 _fbb, 3319 _min_annotate_confidence, 3320 _enabled_modes); 3321 } 3322 3323 inline OutputOptionsT *OutputOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3324 auto _o = new OutputOptionsT(); 3325 UnPackTo(_o, _resolver); 3326 return _o; 3327 } 3328 3329 inline void OutputOptions::UnPackTo(OutputOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3330 (void)_o; 3331 (void)_resolver; 3332 { auto _e = filtered_collections_annotation(); if (_e) { _o->filtered_collections_annotation.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->filtered_collections_annotation[_i] = _e->Get(_i)->str(); } } }; 3333 { auto _e = filtered_collections_classification(); if (_e) { _o->filtered_collections_classification.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->filtered_collections_classification[_i] = _e->Get(_i)->str(); } } }; 3334 { auto _e = filtered_collections_selection(); if (_e) { _o->filtered_collections_selection.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->filtered_collections_selection[_i] = _e->Get(_i)->str(); } } }; 3335 } 3336 3337 inline flatbuffers::Offset<OutputOptions> OutputOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const OutputOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3338 return CreateOutputOptions(_fbb, _o, _rehasher); 3339 } 3340 3341 inline flatbuffers::Offset<OutputOptions> CreateOutputOptions(flatbuffers::FlatBufferBuilder &_fbb, const OutputOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3342 (void)_rehasher; 3343 (void)_o; 3344 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const OutputOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3345 auto _filtered_collections_annotation = _o->filtered_collections_annotation.size() ? _fbb.CreateVectorOfStrings(_o->filtered_collections_annotation) : 0; 3346 auto _filtered_collections_classification = _o->filtered_collections_classification.size() ? _fbb.CreateVectorOfStrings(_o->filtered_collections_classification) : 0; 3347 auto _filtered_collections_selection = _o->filtered_collections_selection.size() ? _fbb.CreateVectorOfStrings(_o->filtered_collections_selection) : 0; 3348 return libtextclassifier2::CreateOutputOptions( 3349 _fbb, 3350 _filtered_collections_annotation, 3351 _filtered_collections_classification, 3352 _filtered_collections_selection); 3353 } 3354 3355 inline ModelT *Model::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3356 auto _o = new ModelT(); 3357 UnPackTo(_o, _resolver); 3358 return _o; 3359 } 3360 3361 inline void Model::UnPackTo(ModelT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3362 (void)_o; 3363 (void)_resolver; 3364 { auto _e = locales(); if (_e) _o->locales = _e->str(); }; 3365 { auto _e = version(); _o->version = _e; }; 3366 { auto _e = name(); if (_e) _o->name = _e->str(); }; 3367 { auto _e = selection_feature_options(); if (_e) _o->selection_feature_options = std::unique_ptr<FeatureProcessorOptionsT>(_e->UnPack(_resolver)); }; 3368 { auto _e = classification_feature_options(); if (_e) _o->classification_feature_options = std::unique_ptr<FeatureProcessorOptionsT>(_e->UnPack(_resolver)); }; 3369 { auto _e = selection_model(); if (_e) { _o->selection_model.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->selection_model[_i] = _e->Get(_i); } } }; 3370 { auto _e = classification_model(); if (_e) { _o->classification_model.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->classification_model[_i] = _e->Get(_i); } } }; 3371 { auto _e = embedding_model(); if (_e) { _o->embedding_model.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->embedding_model[_i] = _e->Get(_i); } } }; 3372 { auto _e = selection_options(); if (_e) _o->selection_options = std::unique_ptr<SelectionModelOptionsT>(_e->UnPack(_resolver)); }; 3373 { auto _e = classification_options(); if (_e) _o->classification_options = std::unique_ptr<ClassificationModelOptionsT>(_e->UnPack(_resolver)); }; 3374 { auto _e = regex_model(); if (_e) _o->regex_model = std::unique_ptr<RegexModelT>(_e->UnPack(_resolver)); }; 3375 { auto _e = datetime_model(); if (_e) _o->datetime_model = std::unique_ptr<DatetimeModelT>(_e->UnPack(_resolver)); }; 3376 { auto _e = triggering_options(); if (_e) _o->triggering_options = std::unique_ptr<ModelTriggeringOptionsT>(_e->UnPack(_resolver)); }; 3377 { auto _e = enabled_modes(); _o->enabled_modes = _e; }; 3378 { auto _e = snap_whitespace_selections(); _o->snap_whitespace_selections = _e; }; 3379 { auto _e = output_options(); if (_e) _o->output_options = std::unique_ptr<OutputOptionsT>(_e->UnPack(_resolver)); }; 3380 } 3381 3382 inline flatbuffers::Offset<Model> Model::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3383 return CreateModel(_fbb, _o, _rehasher); 3384 } 3385 3386 inline flatbuffers::Offset<Model> CreateModel(flatbuffers::FlatBufferBuilder &_fbb, const ModelT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3387 (void)_rehasher; 3388 (void)_o; 3389 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ModelT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3390 auto _locales = _o->locales.empty() ? 0 : _fbb.CreateString(_o->locales); 3391 auto _version = _o->version; 3392 auto _name = _o->name.empty() ? 0 : _fbb.CreateString(_o->name); 3393 auto _selection_feature_options = _o->selection_feature_options ? CreateFeatureProcessorOptions(_fbb, _o->selection_feature_options.get(), _rehasher) : 0; 3394 auto _classification_feature_options = _o->classification_feature_options ? CreateFeatureProcessorOptions(_fbb, _o->classification_feature_options.get(), _rehasher) : 0; 3395 auto _selection_model = _o->selection_model.size() ? _fbb.CreateVector(_o->selection_model) : 0; 3396 auto _classification_model = _o->classification_model.size() ? _fbb.CreateVector(_o->classification_model) : 0; 3397 auto _embedding_model = _o->embedding_model.size() ? _fbb.CreateVector(_o->embedding_model) : 0; 3398 auto _selection_options = _o->selection_options ? CreateSelectionModelOptions(_fbb, _o->selection_options.get(), _rehasher) : 0; 3399 auto _classification_options = _o->classification_options ? CreateClassificationModelOptions(_fbb, _o->classification_options.get(), _rehasher) : 0; 3400 auto _regex_model = _o->regex_model ? CreateRegexModel(_fbb, _o->regex_model.get(), _rehasher) : 0; 3401 auto _datetime_model = _o->datetime_model ? CreateDatetimeModel(_fbb, _o->datetime_model.get(), _rehasher) : 0; 3402 auto _triggering_options = _o->triggering_options ? CreateModelTriggeringOptions(_fbb, _o->triggering_options.get(), _rehasher) : 0; 3403 auto _enabled_modes = _o->enabled_modes; 3404 auto _snap_whitespace_selections = _o->snap_whitespace_selections; 3405 auto _output_options = _o->output_options ? CreateOutputOptions(_fbb, _o->output_options.get(), _rehasher) : 0; 3406 return libtextclassifier2::CreateModel( 3407 _fbb, 3408 _locales, 3409 _version, 3410 _name, 3411 _selection_feature_options, 3412 _classification_feature_options, 3413 _selection_model, 3414 _classification_model, 3415 _embedding_model, 3416 _selection_options, 3417 _classification_options, 3418 _regex_model, 3419 _datetime_model, 3420 _triggering_options, 3421 _enabled_modes, 3422 _snap_whitespace_selections, 3423 _output_options); 3424 } 3425 3426 inline TokenizationCodepointRangeT *TokenizationCodepointRange::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3427 auto _o = new TokenizationCodepointRangeT(); 3428 UnPackTo(_o, _resolver); 3429 return _o; 3430 } 3431 3432 inline void TokenizationCodepointRange::UnPackTo(TokenizationCodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3433 (void)_o; 3434 (void)_resolver; 3435 { auto _e = start(); _o->start = _e; }; 3436 { auto _e = end(); _o->end = _e; }; 3437 { auto _e = role(); _o->role = _e; }; 3438 { auto _e = script_id(); _o->script_id = _e; }; 3439 } 3440 3441 inline flatbuffers::Offset<TokenizationCodepointRange> TokenizationCodepointRange::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3442 return CreateTokenizationCodepointRange(_fbb, _o, _rehasher); 3443 } 3444 3445 inline flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3446 (void)_rehasher; 3447 (void)_o; 3448 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TokenizationCodepointRangeT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3449 auto _start = _o->start; 3450 auto _end = _o->end; 3451 auto _role = _o->role; 3452 auto _script_id = _o->script_id; 3453 return libtextclassifier2::CreateTokenizationCodepointRange( 3454 _fbb, 3455 _start, 3456 _end, 3457 _role, 3458 _script_id); 3459 } 3460 3461 namespace FeatureProcessorOptions_ { 3462 3463 inline CodepointRangeT *CodepointRange::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3464 auto _o = new CodepointRangeT(); 3465 UnPackTo(_o, _resolver); 3466 return _o; 3467 } 3468 3469 inline void CodepointRange::UnPackTo(CodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3470 (void)_o; 3471 (void)_resolver; 3472 { auto _e = start(); _o->start = _e; }; 3473 { auto _e = end(); _o->end = _e; }; 3474 } 3475 3476 inline flatbuffers::Offset<CodepointRange> CodepointRange::Pack(flatbuffers::FlatBufferBuilder &_fbb, const CodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3477 return CreateCodepointRange(_fbb, _o, _rehasher); 3478 } 3479 3480 inline flatbuffers::Offset<CodepointRange> CreateCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const CodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3481 (void)_rehasher; 3482 (void)_o; 3483 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const CodepointRangeT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3484 auto _start = _o->start; 3485 auto _end = _o->end; 3486 return libtextclassifier2::FeatureProcessorOptions_::CreateCodepointRange( 3487 _fbb, 3488 _start, 3489 _end); 3490 } 3491 3492 inline BoundsSensitiveFeaturesT *BoundsSensitiveFeatures::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3493 auto _o = new BoundsSensitiveFeaturesT(); 3494 UnPackTo(_o, _resolver); 3495 return _o; 3496 } 3497 3498 inline void BoundsSensitiveFeatures::UnPackTo(BoundsSensitiveFeaturesT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3499 (void)_o; 3500 (void)_resolver; 3501 { auto _e = enabled(); _o->enabled = _e; }; 3502 { auto _e = num_tokens_before(); _o->num_tokens_before = _e; }; 3503 { auto _e = num_tokens_inside_left(); _o->num_tokens_inside_left = _e; }; 3504 { auto _e = num_tokens_inside_right(); _o->num_tokens_inside_right = _e; }; 3505 { auto _e = num_tokens_after(); _o->num_tokens_after = _e; }; 3506 { auto _e = include_inside_bag(); _o->include_inside_bag = _e; }; 3507 { auto _e = include_inside_length(); _o->include_inside_length = _e; }; 3508 { auto _e = score_single_token_spans_as_zero(); _o->score_single_token_spans_as_zero = _e; }; 3509 } 3510 3511 inline flatbuffers::Offset<BoundsSensitiveFeatures> BoundsSensitiveFeatures::Pack(flatbuffers::FlatBufferBuilder &_fbb, const BoundsSensitiveFeaturesT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3512 return CreateBoundsSensitiveFeatures(_fbb, _o, _rehasher); 3513 } 3514 3515 inline flatbuffers::Offset<BoundsSensitiveFeatures> CreateBoundsSensitiveFeatures(flatbuffers::FlatBufferBuilder &_fbb, const BoundsSensitiveFeaturesT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3516 (void)_rehasher; 3517 (void)_o; 3518 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const BoundsSensitiveFeaturesT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3519 auto _enabled = _o->enabled; 3520 auto _num_tokens_before = _o->num_tokens_before; 3521 auto _num_tokens_inside_left = _o->num_tokens_inside_left; 3522 auto _num_tokens_inside_right = _o->num_tokens_inside_right; 3523 auto _num_tokens_after = _o->num_tokens_after; 3524 auto _include_inside_bag = _o->include_inside_bag; 3525 auto _include_inside_length = _o->include_inside_length; 3526 auto _score_single_token_spans_as_zero = _o->score_single_token_spans_as_zero; 3527 return libtextclassifier2::FeatureProcessorOptions_::CreateBoundsSensitiveFeatures( 3528 _fbb, 3529 _enabled, 3530 _num_tokens_before, 3531 _num_tokens_inside_left, 3532 _num_tokens_inside_right, 3533 _num_tokens_after, 3534 _include_inside_bag, 3535 _include_inside_length, 3536 _score_single_token_spans_as_zero); 3537 } 3538 3539 inline AlternativeCollectionMapEntryT *AlternativeCollectionMapEntry::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3540 auto _o = new AlternativeCollectionMapEntryT(); 3541 UnPackTo(_o, _resolver); 3542 return _o; 3543 } 3544 3545 inline void AlternativeCollectionMapEntry::UnPackTo(AlternativeCollectionMapEntryT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3546 (void)_o; 3547 (void)_resolver; 3548 { auto _e = key(); if (_e) _o->key = _e->str(); }; 3549 { auto _e = value(); if (_e) _o->value = _e->str(); }; 3550 } 3551 3552 inline flatbuffers::Offset<AlternativeCollectionMapEntry> AlternativeCollectionMapEntry::Pack(flatbuffers::FlatBufferBuilder &_fbb, const AlternativeCollectionMapEntryT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3553 return CreateAlternativeCollectionMapEntry(_fbb, _o, _rehasher); 3554 } 3555 3556 inline flatbuffers::Offset<AlternativeCollectionMapEntry> CreateAlternativeCollectionMapEntry(flatbuffers::FlatBufferBuilder &_fbb, const AlternativeCollectionMapEntryT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3557 (void)_rehasher; 3558 (void)_o; 3559 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const AlternativeCollectionMapEntryT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3560 auto _key = _o->key.empty() ? 0 : _fbb.CreateString(_o->key); 3561 auto _value = _o->value.empty() ? 0 : _fbb.CreateString(_o->value); 3562 return libtextclassifier2::FeatureProcessorOptions_::CreateAlternativeCollectionMapEntry( 3563 _fbb, 3564 _key, 3565 _value); 3566 } 3567 3568 } // namespace FeatureProcessorOptions_ 3569 3570 inline FeatureProcessorOptionsT *FeatureProcessorOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 3571 auto _o = new FeatureProcessorOptionsT(); 3572 UnPackTo(_o, _resolver); 3573 return _o; 3574 } 3575 3576 inline void FeatureProcessorOptions::UnPackTo(FeatureProcessorOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { 3577 (void)_o; 3578 (void)_resolver; 3579 { auto _e = num_buckets(); _o->num_buckets = _e; }; 3580 { auto _e = embedding_size(); _o->embedding_size = _e; }; 3581 { auto _e = embedding_quantization_bits(); _o->embedding_quantization_bits = _e; }; 3582 { auto _e = context_size(); _o->context_size = _e; }; 3583 { auto _e = max_selection_span(); _o->max_selection_span = _e; }; 3584 { auto _e = chargram_orders(); if (_e) { _o->chargram_orders.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->chargram_orders[_i] = _e->Get(_i); } } }; 3585 { auto _e = max_word_length(); _o->max_word_length = _e; }; 3586 { auto _e = unicode_aware_features(); _o->unicode_aware_features = _e; }; 3587 { auto _e = extract_case_feature(); _o->extract_case_feature = _e; }; 3588 { auto _e = extract_selection_mask_feature(); _o->extract_selection_mask_feature = _e; }; 3589 { auto _e = regexp_feature(); if (_e) { _o->regexp_feature.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->regexp_feature[_i] = _e->Get(_i)->str(); } } }; 3590 { auto _e = remap_digits(); _o->remap_digits = _e; }; 3591 { auto _e = lowercase_tokens(); _o->lowercase_tokens = _e; }; 3592 { auto _e = selection_reduced_output_space(); _o->selection_reduced_output_space = _e; }; 3593 { auto _e = collections(); if (_e) { _o->collections.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->collections[_i] = _e->Get(_i)->str(); } } }; 3594 { auto _e = default_collection(); _o->default_collection = _e; }; 3595 { auto _e = only_use_line_with_click(); _o->only_use_line_with_click = _e; }; 3596 { auto _e = split_tokens_on_selection_boundaries(); _o->split_tokens_on_selection_boundaries = _e; }; 3597 { auto _e = tokenization_codepoint_config(); if (_e) { _o->tokenization_codepoint_config.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->tokenization_codepoint_config[_i] = std::unique_ptr<TokenizationCodepointRangeT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3598 { auto _e = center_token_selection_method(); _o->center_token_selection_method = _e; }; 3599 { auto _e = snap_label_span_boundaries_to_containing_tokens(); _o->snap_label_span_boundaries_to_containing_tokens = _e; }; 3600 { auto _e = supported_codepoint_ranges(); if (_e) { _o->supported_codepoint_ranges.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->supported_codepoint_ranges[_i] = std::unique_ptr<libtextclassifier2::FeatureProcessorOptions_::CodepointRangeT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3601 { auto _e = internal_tokenizer_codepoint_ranges(); if (_e) { _o->internal_tokenizer_codepoint_ranges.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->internal_tokenizer_codepoint_ranges[_i] = std::unique_ptr<libtextclassifier2::FeatureProcessorOptions_::CodepointRangeT>(_e->Get(_i)->UnPack(_resolver)); } } }; 3602 { auto _e = min_supported_codepoint_ratio(); _o->min_supported_codepoint_ratio = _e; }; 3603 { auto _e = feature_version(); _o->feature_version = _e; }; 3604 { auto _e = tokenization_type(); _o->tokenization_type = _e; }; 3605 { auto _e = icu_preserve_whitespace_tokens(); _o->icu_preserve_whitespace_tokens = _e; }; 3606 { auto _e = ignored_span_boundary_codepoints(); if (_e) { _o->ignored_span_boundary_codepoints.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->ignored_span_boundary_codepoints[_i] = _e->Get(_i); } } }; 3607 { auto _e = bounds_sensitive_features(); if (_e) _o->bounds_sensitive_features = std::unique_ptr<libtextclassifier2::FeatureProcessorOptions_::BoundsSensitiveFeaturesT>(_e->UnPack(_resolver)); }; 3608 { auto _e = allowed_chargrams(); if (_e) { _o->allowed_chargrams.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->allowed_chargrams[_i] = _e->Get(_i)->str(); } } }; 3609 { auto _e = tokenize_on_script_change(); _o->tokenize_on_script_change = _e; }; 3610 } 3611 3612 inline flatbuffers::Offset<FeatureProcessorOptions> FeatureProcessorOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const FeatureProcessorOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 3613 return CreateFeatureProcessorOptions(_fbb, _o, _rehasher); 3614 } 3615 3616 inline flatbuffers::Offset<FeatureProcessorOptions> CreateFeatureProcessorOptions(flatbuffers::FlatBufferBuilder &_fbb, const FeatureProcessorOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 3617 (void)_rehasher; 3618 (void)_o; 3619 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const FeatureProcessorOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 3620 auto _num_buckets = _o->num_buckets; 3621 auto _embedding_size = _o->embedding_size; 3622 auto _embedding_quantization_bits = _o->embedding_quantization_bits; 3623 auto _context_size = _o->context_size; 3624 auto _max_selection_span = _o->max_selection_span; 3625 auto _chargram_orders = _o->chargram_orders.size() ? _fbb.CreateVector(_o->chargram_orders) : 0; 3626 auto _max_word_length = _o->max_word_length; 3627 auto _unicode_aware_features = _o->unicode_aware_features; 3628 auto _extract_case_feature = _o->extract_case_feature; 3629 auto _extract_selection_mask_feature = _o->extract_selection_mask_feature; 3630 auto _regexp_feature = _o->regexp_feature.size() ? _fbb.CreateVectorOfStrings(_o->regexp_feature) : 0; 3631 auto _remap_digits = _o->remap_digits; 3632 auto _lowercase_tokens = _o->lowercase_tokens; 3633 auto _selection_reduced_output_space = _o->selection_reduced_output_space; 3634 auto _collections = _o->collections.size() ? _fbb.CreateVectorOfStrings(_o->collections) : 0; 3635 auto _default_collection = _o->default_collection; 3636 auto _only_use_line_with_click = _o->only_use_line_with_click; 3637 auto _split_tokens_on_selection_boundaries = _o->split_tokens_on_selection_boundaries; 3638 auto _tokenization_codepoint_config = _o->tokenization_codepoint_config.size() ? _fbb.CreateVector<flatbuffers::Offset<TokenizationCodepointRange>> (_o->tokenization_codepoint_config.size(), [](size_t i, _VectorArgs *__va) { return CreateTokenizationCodepointRange(*__va->__fbb, __va->__o->tokenization_codepoint_config[i].get(), __va->__rehasher); }, &_va ) : 0; 3639 auto _center_token_selection_method = _o->center_token_selection_method; 3640 auto _snap_label_span_boundaries_to_containing_tokens = _o->snap_label_span_boundaries_to_containing_tokens; 3641 auto _supported_codepoint_ranges = _o->supported_codepoint_ranges.size() ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> (_o->supported_codepoint_ranges.size(), [](size_t i, _VectorArgs *__va) { return CreateCodepointRange(*__va->__fbb, __va->__o->supported_codepoint_ranges[i].get(), __va->__rehasher); }, &_va ) : 0; 3642 auto _internal_tokenizer_codepoint_ranges = _o->internal_tokenizer_codepoint_ranges.size() ? _fbb.CreateVector<flatbuffers::Offset<libtextclassifier2::FeatureProcessorOptions_::CodepointRange>> (_o->internal_tokenizer_codepoint_ranges.size(), [](size_t i, _VectorArgs *__va) { return CreateCodepointRange(*__va->__fbb, __va->__o->internal_tokenizer_codepoint_ranges[i].get(), __va->__rehasher); }, &_va ) : 0; 3643 auto _min_supported_codepoint_ratio = _o->min_supported_codepoint_ratio; 3644 auto _feature_version = _o->feature_version; 3645 auto _tokenization_type = _o->tokenization_type; 3646 auto _icu_preserve_whitespace_tokens = _o->icu_preserve_whitespace_tokens; 3647 auto _ignored_span_boundary_codepoints = _o->ignored_span_boundary_codepoints.size() ? _fbb.CreateVector(_o->ignored_span_boundary_codepoints) : 0; 3648 auto _bounds_sensitive_features = _o->bounds_sensitive_features ? CreateBoundsSensitiveFeatures(_fbb, _o->bounds_sensitive_features.get(), _rehasher) : 0; 3649 auto _allowed_chargrams = _o->allowed_chargrams.size() ? _fbb.CreateVectorOfStrings(_o->allowed_chargrams) : 0; 3650 auto _tokenize_on_script_change = _o->tokenize_on_script_change; 3651 return libtextclassifier2::CreateFeatureProcessorOptions( 3652 _fbb, 3653 _num_buckets, 3654 _embedding_size, 3655 _embedding_quantization_bits, 3656 _context_size, 3657 _max_selection_span, 3658 _chargram_orders, 3659 _max_word_length, 3660 _unicode_aware_features, 3661 _extract_case_feature, 3662 _extract_selection_mask_feature, 3663 _regexp_feature, 3664 _remap_digits, 3665 _lowercase_tokens, 3666 _selection_reduced_output_space, 3667 _collections, 3668 _default_collection, 3669 _only_use_line_with_click, 3670 _split_tokens_on_selection_boundaries, 3671 _tokenization_codepoint_config, 3672 _center_token_selection_method, 3673 _snap_label_span_boundaries_to_containing_tokens, 3674 _supported_codepoint_ranges, 3675 _internal_tokenizer_codepoint_ranges, 3676 _min_supported_codepoint_ratio, 3677 _feature_version, 3678 _tokenization_type, 3679 _icu_preserve_whitespace_tokens, 3680 _ignored_span_boundary_codepoints, 3681 _bounds_sensitive_features, 3682 _allowed_chargrams, 3683 _tokenize_on_script_change); 3684 } 3685 3686 inline const libtextclassifier2::Model *GetModel(const void *buf) { 3687 return flatbuffers::GetRoot<libtextclassifier2::Model>(buf); 3688 } 3689 3690 inline const char *ModelIdentifier() { 3691 return "TC2 "; 3692 } 3693 3694 inline bool ModelBufferHasIdentifier(const void *buf) { 3695 return flatbuffers::BufferHasIdentifier( 3696 buf, ModelIdentifier()); 3697 } 3698 3699 inline bool VerifyModelBuffer( 3700 flatbuffers::Verifier &verifier) { 3701 return verifier.VerifyBuffer<libtextclassifier2::Model>(ModelIdentifier()); 3702 } 3703 3704 inline void FinishModelBuffer( 3705 flatbuffers::FlatBufferBuilder &fbb, 3706 flatbuffers::Offset<libtextclassifier2::Model> root) { 3707 fbb.Finish(root, ModelIdentifier()); 3708 } 3709 3710 inline std::unique_ptr<ModelT> UnPackModel( 3711 const void *buf, 3712 const flatbuffers::resolver_function_t *res = nullptr) { 3713 return std::unique_ptr<ModelT>(GetModel(buf)->UnPack(res)); 3714 } 3715 3716 } // namespace libtextclassifier2 3717 3718 #endif // FLATBUFFERS_GENERATED_MODEL_LIBTEXTCLASSIFIER2_H_ 3719