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_CONTACT_CONTACT_ENGINE_DUMMY_H_ 18 #define LIBTEXTCLASSIFIER_ANNOTATOR_CONTACT_CONTACT_ENGINE_DUMMY_H_ 19 20 #include <string> 21 #include <vector> 22 23 #include "annotator/feature-processor.h" 24 #include "annotator/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 contact engine. 33 class ContactEngine { 34 public: ContactEngine(const FeatureProcessor * feature_processor,const UniLib * unilib,const ContactAnnotatorOptions * options)35 explicit ContactEngine(const FeatureProcessor* feature_processor, 36 const UniLib* unilib, 37 const ContactAnnotatorOptions* options) {} 38 Initialize(const std::string & serialized_config)39 bool Initialize(const std::string& serialized_config) { 40 TC3_LOG(ERROR) << "No contact engine to initialize."; 41 return false; 42 } 43 ClassifyText(const std::string & context,CodepointSpan selection_indices,ClassificationResult * classification_result)44 bool ClassifyText(const std::string& context, CodepointSpan selection_indices, 45 ClassificationResult* classification_result) const { 46 return false; 47 } 48 Chunk(const UnicodeText & context_unicode,const std::vector<Token> & tokens,std::vector<AnnotatedSpan> * result)49 bool Chunk(const UnicodeText& context_unicode, 50 const std::vector<Token>& tokens, 51 std::vector<AnnotatedSpan>* result) const { 52 return true; 53 } 54 AddContactMetadataToKnowledgeClassificationResult(ClassificationResult * classification_result)55 void AddContactMetadataToKnowledgeClassificationResult( 56 ClassificationResult* classification_result) const {} 57 }; 58 59 } // namespace libtextclassifier3 60 61 #endif // LIBTEXTCLASSIFIER_ANNOTATOR_CONTACT_CONTACT_ENGINE_DUMMY_H_ 62