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 // JNI wrapper for LangId. 18 19 #ifndef LIBTEXTCLASSIFIER_LANG_ID_LANG_ID_JNI_H_ 20 #define LIBTEXTCLASSIFIER_LANG_ID_LANG_ID_JNI_H_ 21 22 #include <jni.h> 23 #include <string> 24 #include "utils/java/jni-base.h" 25 26 #ifndef TC3_LANG_ID_CLASS_NAME 27 #define TC3_LANG_ID_CLASS_NAME LangIdModel 28 #endif 29 30 #define TC3_LANG_ID_CLASS_NAME_STR TC3_ADD_QUOTES(TC3_LANG_ID_CLASS_NAME) 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 TC3_JNI_METHOD(jlong, TC3_LANG_ID_CLASS_NAME, nativeNew) 37 (JNIEnv* env, jobject clazz, jint fd); 38 39 TC3_JNI_METHOD(jlong, TC3_LANG_ID_CLASS_NAME, nativeNewFromPath) 40 (JNIEnv* env, jobject clazz, jstring path); 41 42 TC3_JNI_METHOD(jobjectArray, TC3_LANG_ID_CLASS_NAME, nativeDetectLanguages) 43 (JNIEnv* env, jobject clazz, jlong ptr, jstring text); 44 45 TC3_JNI_METHOD(void, TC3_LANG_ID_CLASS_NAME, nativeClose) 46 (JNIEnv* env, jobject clazz, jlong ptr); 47 48 TC3_JNI_METHOD(jint, TC3_LANG_ID_CLASS_NAME, nativeGetVersion) 49 (JNIEnv* env, jobject clazz, jlong ptr); 50 51 TC3_JNI_METHOD(jint, TC3_LANG_ID_CLASS_NAME, nativeGetVersionFromFd) 52 (JNIEnv* env, jobject clazz, jint fd); 53 54 TC3_JNI_METHOD(jfloat, TC3_LANG_ID_CLASS_NAME, nativeGetLangIdThreshold) 55 (JNIEnv* env, jobject thizz, jlong ptr); 56 57 #ifdef __cplusplus 58 } 59 #endif 60 61 #endif // LIBTEXTCLASSIFIER_LANG_ID_LANG_ID_JNI_H_ 62