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