1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_LITE_SUPPORT_CUSTOM_OPS_KERNEL_SENTENCEPIECE_DOUBLE_ARRAY_TRIE_BUILDER_H_ 17 #define TENSORFLOW_LITE_SUPPORT_CUSTOM_OPS_KERNEL_SENTENCEPIECE_DOUBLE_ARRAY_TRIE_BUILDER_H_ 18 19 #include <string> 20 #include <vector> 21 22 #include "tensorflow_lite_support/custom_ops/kernel/sentencepiece/config_generated.h" 23 #include "tensorflow_lite_support/custom_ops/kernel/sentencepiece/utils.h" 24 25 namespace tflite { 26 namespace ops { 27 namespace custom { 28 namespace sentencepiece { 29 30 std::vector<uint32_t> BuildTrie(const std::vector<std::string>& data, 31 const std::vector<int>& ids); 32 33 // A variant where ids are indexes in data. 34 std::vector<uint32_t> BuildTrie(const std::vector<std::string>& data); 35 36 } // namespace sentencepiece 37 } // namespace custom 38 } // namespace ops 39 } // namespace tflite 40 41 #endif // TENSORFLOW_LITE_SUPPORT_CUSTOM_OPS_KERNEL_SENTENCEPIECE_DOUBLE_ARRAY_TRIE_BUILDER_H_ 42