1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
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 OHOS_GLOBAL_I18N_ENTITY_RECOGNIZER_ADDON_H
17 #define OHOS_GLOBAL_I18N_ENTITY_RECOGNIZER_ADDON_H
18 
19 #include "entity_recognizer.h"
20 #include "locale_config.h"
21 #include "napi/native_api.h"
22 #include "napi/native_node_api.h"
23 
24 namespace OHOS {
25 namespace Global {
26 namespace I18n {
27 class EntityRecognizerAddon {
28 public:
29     EntityRecognizerAddon();
30     ~EntityRecognizerAddon();
31     static void Destructor(napi_env env, void *nativeObject, void *hint);
32     static napi_value InitEntityRecognizer(napi_env env, napi_value exports);
33 
34 private:
35     static napi_value constructor(napi_env env, napi_callback_info info);
36     static napi_value FindEntityInfo(napi_env env, napi_callback_info info);
37     static napi_value CreateEntityInfoItem(napi_env env, const int begin, const int end, const std::string& type);
38     static napi_value GetEntityInfoItem(napi_env env, std::vector<std::vector<int>>& entityInfo);
39     std::unique_ptr<EntityRecognizer> entityRecognizer_ = nullptr;
40 };
41 } // namespace I18n
42 } // namespace Global
43 } // namespace OHOS
44 #endif