1 /* 2 * Copyright (C) 2018 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 #ifndef LIBTEXTCLASSIFIER_ANNOTATOR_PERSON_NAME_PERSON_NAME_ENGINE_DUMMY_H_ 18 #define LIBTEXTCLASSIFIER_ANNOTATOR_PERSON_NAME_PERSON_NAME_ENGINE_DUMMY_H_ 19 20 #include <string> 21 #include <vector> 22 23 #include "annotator/feature-processor.h" 24 #include "annotator/person_name/person_name_model_generated.h" 25 #include "annotator/types.h" 26 #include "utils/base/logging.h" 27 #include "utils/utf8/unicodetext.h" 28 #include "utils/utf8/unilib.h" 29 30 namespace libtextclassifier3 { 31 32 // A dummy implementation of the person name engine. 33 class PersonNameEngine { 34 public: PersonNameEngine(const FeatureProcessor * feature_processor,const UniLib * unilib)35 explicit PersonNameEngine(const FeatureProcessor* feature_processor, 36 const UniLib* unilib) {} 37 Initialize(const PersonNameModel * model)38 bool Initialize(const PersonNameModel* model) { 39 TC3_LOG(ERROR) << "No person name engine to initialize."; 40 return false; 41 } 42 ClassifyText(const std::string & context,CodepointSpan selection_indices,ClassificationResult * classification_result)43 bool ClassifyText(const std::string& context, CodepointSpan selection_indices, 44 ClassificationResult* classification_result) const { 45 return false; 46 } 47 Chunk(const UnicodeText & context_unicode,const std::vector<Token> & tokens,std::vector<AnnotatedSpan> * result)48 bool Chunk(const UnicodeText& context_unicode, 49 const std::vector<Token>& tokens, 50 std::vector<AnnotatedSpan>* result) const { 51 return true; 52 } 53 }; 54 55 } // namespace libtextclassifier3 56 57 #endif // LIBTEXTCLASSIFIER_ANNOTATOR_PERSON_NAME_PERSON_NAME_ENGINE_DUMMY_H_ 58