From: Jihoon Kim Date: Fri, 13 May 2022 12:24:21 +0000 (+0900) Subject: Add language detect and word tokenize CAPI X-Git-Tag: submit/tizen/20220524.051852~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31ee0b9208f63e0cf38d29a84e23bc11f16ff4e8;p=platform%2Fcore%2Fuifw%2Fnlp.git Add language detect and word tokenize CAPI root:~> nlp-unittests [==========] Running 10 tests from 2 test suites. [----------] Global test environment set-up. [----------] 6 tests from NlpCAPITest [ RUN ] NlpCAPITest.utc_nlp_connect_invalid_parameter [ OK ] NlpCAPITest.utc_nlp_connect_invalid_parameter (2 ms) [ RUN ] NlpCAPITest.utc_nlp_connect_p start loop status : 0 Request language detect. str(Hello World) request id : 0 start loop [language_detect_result_cb] request id: 1. language: en quit loop Request language detect. str(안녕하세요) request id : 0 start loop [language_detect_result_cb] request id: 2. language: ko quit loop Request Pos tag. str(Hello World) request id : 3 start loop [pos_tag_result_cb] request id: 3 token: Hello, tag: NNP token: World, tag: NNP quit loop Request word tokenize. str(Hello World) request id : 4 start loop [word_tokenize_result_cb] request id: 4 [word_tokenize_foreach_cb] word(Hello) [word_tokenize_foreach_cb] word(World) quit loop [ OK ] NlpCAPITest.utc_nlp_connect_p (4282 ms) [ RUN ] NlpCAPITest.utc_nlp_foreach_pos_tag_invalid_parameter [ OK ] NlpCAPITest.utc_nlp_foreach_pos_tag_invalid_parameter (0 ms) [ RUN ] NlpCAPITest.utc_nlp_request_word_tokenize_invalid_parameter [ OK ] NlpCAPITest.utc_nlp_request_word_tokenize_invalid_parameter (0 ms) [ RUN ] NlpCAPITest.utc_nlp_foreach_word_tokenize_invalid_parameter [ OK ] NlpCAPITest.utc_nlp_foreach_word_tokenize_invalid_parameter (0 ms) [ RUN ] NlpCAPITest.utc_nlp_request_language_detect_invalid_parameter [ OK ] NlpCAPITest.utc_nlp_request_language_detect_invalid_parameter (0 ms) [----------] 6 tests from NlpCAPITest (4285 ms total) [----------] 4 tests from NlpServiceTest [ RUN ] NlpServiceTest.utc_nlp_service_tokenize_p token: 'I' token: 'am' token: 'a' token: 'boy' word_tokenize process done [ OK ] NlpServiceTest.utc_nlp_service_tokenize_p (1049 ms) [ RUN ] NlpServiceTest.utc_nlp_service_language_detect_p Detected language: en [ OK ] NlpServiceTest.utc_nlp_service_language_detect_p (1247 ms) [ RUN ] NlpServiceTest.utc_nlp_service_pos_tag_p tag : NNP tag : NNP [ OK ] NlpServiceTest.utc_nlp_service_pos_tag_p (432 ms) [ RUN ] NlpServiceTest.utc_nlp_service_ne_chunk_p token: We tag: PRP token: saw tag: VBD token: the tag: DT token: yellow tag: JJ token: dog tag: NN ne_chunk process done [ OK ] NlpServiceTest.utc_nlp_service_ne_chunk_p (344 ms) [----------] 4 tests from NlpServiceTest (3072 ms total) [----------] Global test environment tear-down [==========] 10 tests from 2 test suites ran. (7357 ms total) [ PASSED ] 10 tests. Change-Id: I3bc77f6e60aa500e2363fad83d4ffdea6775d67b Signed-off-by: Jihoon Kim --- diff --git a/client/nlp_client.c b/client/nlp_client.c index 9043ec6..8f73486 100644 --- a/client/nlp_client.c +++ b/client/nlp_client.c @@ -42,6 +42,100 @@ typedef struct { const char *tag; } pos_tag_s; +static char *get_request_id() +{ + _request_id++; + char buffer [sizeof(unsigned int)*8+1]; + snprintf(buffer, sizeof(buffer), "%u", _request_id); + + return strdup(buffer); +} + +static void process_pos_tag_result(nlp_h nh, bundle *msg) +{ + char *request_id = NULL; + + bundle_get_str(msg, "request_id", &request_id); + + const char **tag_array = NULL; + const char **token_array = NULL; + int len_tag_array = 0; + int len_token_array = 0; + pos_tag_s* pos_tag_pair = NULL; + GList *glist = NULL; + nlp_pos_tag_result_h pos_tag_result_h = NULL; + + tag_array = bundle_get_str_array(msg, "return_tag", &len_tag_array); + token_array = bundle_get_str_array(msg, "return_token", &len_token_array); + + for (int i=0; i < len_tag_array; i++) { + pos_tag_pair = (pos_tag_s* )calloc(1, sizeof(pos_tag_s)); + if (pos_tag_pair) { + pos_tag_pair->token = token_array[i]; + pos_tag_pair->tag = tag_array[i]; + } + + LOGD("tag: %s, token : %s", tag_array[i], token_array[i]); + + glist = g_list_append(glist, pos_tag_pair); + } + + pos_tag_result_h = glist; + + if (nh->pos_tag_result_cb) + nh->pos_tag_result_cb((unsigned int)atoi(request_id), pos_tag_result_h, nh->pos_tag_result_data); +} + +static void process_word_tokenize_result(nlp_h nh, bundle *msg) +{ + char *request_id = NULL; + + bundle_get_str(msg, "request_id", &request_id); + LOGD("id : %s", request_id); + + const char **word_array = NULL; + int len_word_array = 0; + GList *glist = NULL; + nlp_word_tokenize_result_h word_tokenize_result_h = NULL; + + word_array = bundle_get_str_array(msg, "return_token", &len_word_array); + + for (int i=0; i < len_word_array; i++) { + LOGD("word : %s", word_array[i]); + glist = g_list_append(glist, (void *)word_array[i]); + } + + word_tokenize_result_h = glist; + + if (nh->word_tokenize_result_cb) + nh->word_tokenize_result_cb((unsigned int)atoi(request_id), word_tokenize_result_h, nh->word_tokenize_result_data); +} + +static void process_language_detect_result(nlp_h nh, bundle *msg) +{ + char *request_id = NULL; + + bundle_get_str(msg, "request_id", &request_id); + LOGD("id : %s", request_id); + + const char **word_array = NULL; + int len_word_array = 0; + //GList *glist = NULL; + //nlp_word_tokenize_result_h word_tokenize_result_h = NULL; + + word_array = bundle_get_str_array(msg, "return_token", &len_word_array); + + for (int i=0; i < len_word_array; i++) { + LOGD("language : %s", word_array[i]); + //glist = g_list_append(glist, (void *)word_array[i]); + } + + //word_tokenize_result_h = glist; + + if (nh->language_detect_result_cb) + nh->language_detect_result_cb((unsigned int)atoi(request_id), word_array[0], nh->language_detect_result_data); +} + //LCOV_EXCL_START static void _notify_cb(void *user_data, const char *sender, bundle *msg) { @@ -58,33 +152,13 @@ static void _notify_cb(void *user_data, const char *sender, bundle *msg) if (!command) return; if (strcmp(command, "pos_tag") == 0) { - const char **tag_array = NULL; - const char **token_array = NULL; - int len_tag_array = 0; - int len_token_array = 0; - pos_tag_s* pos_tag_pair = NULL; - GList *glist = NULL; - nlp_pos_tag_result_h pos_tag_result_h = NULL; - - tag_array = bundle_get_str_array(msg, "return_tag", &len_tag_array); - token_array = bundle_get_str_array(msg, "return_token", &len_token_array); - - for (int i=0; i < len_tag_array; i++) { - pos_tag_pair = (pos_tag_s* )calloc(1, sizeof(pos_tag_s)); - if (pos_tag_pair) { - pos_tag_pair->token = token_array[i]; - pos_tag_pair->tag = tag_array[i]; - } - - LOGD("tag: %s, token : %s", tag_array[i], token_array[i]); - - glist = g_list_append(glist, pos_tag_pair); - } - - pos_tag_result_h = glist; - - if (nh->pos_tag_result_cb) - nh->pos_tag_result_cb((unsigned int)atoi(request_id), pos_tag_result_h, nh->pos_tag_result_data); + process_pos_tag_result(nh, msg); + } + else if (strcmp(command, "word_tokenize") == 0) { + process_word_tokenize_result(nh, msg); + } + else if (strcmp(command, "langdetect") == 0) { + process_language_detect_result(nh, msg); } } @@ -209,6 +283,7 @@ EXPORT_API int nlp_connect(nlp_h nh, nlp_connection_status_changed_cb callback, } if (!nh->rpc_h) { + LOGW("[ERROR] RPC handle is NULL"); return NLP_ERROR_OPERATION_FAILED; } @@ -245,7 +320,7 @@ EXPORT_API int nlp_connect(nlp_h nh, nlp_connection_status_changed_cb callback, } } -EXPORT_API int nlp_request_pos_tag(nlp_h nh, const char *str, unsigned int *request_id) +int send_request(nlp_h nh, const char *command, const char *str, unsigned int *request_id) { if (!nh || !str) { LOGW("[ERROR] Invalid parameter"); @@ -253,17 +328,18 @@ EXPORT_API int nlp_request_pos_tag(nlp_h nh, const char *str, unsigned int *requ } if (!nh->rpc_h) { + LOGW("[ERROR] RPC handle is NULL"); return NLP_ERROR_OPERATION_FAILED; } - _request_id++; - char id[16]; - snprintf(id, sizeof(id), "%u", _request_id); + char *req_id = get_request_id(); bundle *msg = bundle_create(); - bundle_add_str(msg, "command", "pos_tag"); + bundle_add_str(msg, "command", command); bundle_add_str(msg, "info", str); - bundle_add_str(msg, "request_id", id); + bundle_add_str(msg, "request_id", req_id); + + free(req_id); rpc_port_proxy_message_invoke_send(nh->rpc_h, msg); bundle_free(msg); @@ -274,6 +350,11 @@ EXPORT_API int nlp_request_pos_tag(nlp_h nh, const char *str, unsigned int *requ return NLP_ERROR_NONE; } +EXPORT_API int nlp_request_pos_tag(nlp_h nh, const char *str, unsigned int *request_id) +{ + return send_request(nh, "pos_tag", str, request_id); +} + EXPORT_API int nlp_set_pos_tag_result_cb(nlp_h nh, nlp_pos_tag_result_cb callback, void *user_data) { if (!nh || !callback) { @@ -334,3 +415,98 @@ int nlp_foreach_pos_tag(nlp_pos_tag_result_h pos_tag_result_h, nlp_pos_tag_forea return NLP_ERROR_NONE; } + +EXPORT_API int nlp_request_word_tokenize(nlp_h nh, const char *str, unsigned int *request_id) +{ + return send_request(nh, "word_tokenize", str, request_id); +} + +EXPORT_API int nlp_set_word_tokenize_result_cb(nlp_h nh, nlp_word_tokenize_result_cb callback, void *user_data) +{ + if (!nh || !callback) { + LOGW("[ERROR] Invalid parameter"); + return NLP_ERROR_INVALID_PARAMETER; + } + + nh->word_tokenize_result_cb = callback; + nh->word_tokenize_result_data = user_data; + + return NLP_ERROR_NONE; +} + +EXPORT_API int nlp_unset_word_tokenize_result_cb(nlp_h nh) +{ + if (!nh) { + LOGW("[ERROR] Invalid parameter"); + return NLP_ERROR_INVALID_PARAMETER; + } + + nh->word_tokenize_result_cb = NULL; + nh->word_tokenize_result_data = NULL; + + return NLP_ERROR_NONE; +} + +EXPORT_API int nlp_foreach_word_tokenize(nlp_word_tokenize_result_h word_tokenize_result_h, nlp_word_tokenize_foreach_cb callback, void* user_data) +{ + if (!word_tokenize_result_h || !callback) { + LOGW("[ERROR] Invalid parameter"); + return NLP_ERROR_INVALID_PARAMETER; + } + + GList *glist = word_tokenize_result_h; + + GList* iter = NULL; + char *word = NULL; + + if (g_list_length(glist) > 0) { + iter = g_list_first(glist); + + while (NULL != iter) { + word = iter->data; + if (NULL != word) { + LOGD("word(%s)", word); + callback(word, user_data); + } + + /* next item */ + iter = g_list_next(iter); + } + + g_list_free(glist); + glist = NULL; + } + + return NLP_ERROR_NONE; +} + +EXPORT_API int nlp_request_language_detect(nlp_h nh, const char *str, unsigned int *request_id) +{ + return send_request(nh, "langdetect", str, request_id); +} + +EXPORT_API int nlp_set_language_detect_result_cb(nlp_h nh, nlp_language_detect_result_cb callback, void *user_data) +{ + if (!nh || !callback) { + LOGW("[ERROR] Invalid parameter"); + return NLP_ERROR_INVALID_PARAMETER; + } + + nh->language_detect_result_cb = callback; + nh->language_detect_result_data = user_data; + + return NLP_ERROR_NONE; +} + +EXPORT_API int nlp_unset_language_detect_result_cb(nlp_h nh) +{ + if (!nh) { + LOGW("[ERROR] Invalid parameter"); + return NLP_ERROR_INVALID_PARAMETER; + } + + nh->language_detect_result_cb = NULL; + nh->language_detect_result_data = NULL; + + return NLP_ERROR_NONE; +} diff --git a/client/nlp_private.h b/client/nlp_private.h index f51fcfc..5225f67 100644 --- a/client/nlp_private.h +++ b/client/nlp_private.h @@ -31,6 +31,12 @@ struct nlp_s { nlp_pos_tag_result_cb pos_tag_result_cb; void *pos_tag_result_data; + + nlp_word_tokenize_result_cb word_tokenize_result_cb; + void *word_tokenize_result_data; + + nlp_language_detect_result_cb language_detect_result_cb; + void *language_detect_result_data; }; #endif /* __TIZEN_UIX_NLP_PRIVATE_H__ */ diff --git a/include/nlp.h b/include/nlp.h index a938b1b..06b51a9 100644 --- a/include/nlp.h +++ b/include/nlp.h @@ -68,6 +68,8 @@ typedef struct nlp_s *nlp_h; typedef GList *nlp_pos_tag_result_h; +typedef GList *nlp_word_tokenize_result_h; + /** * @brief Called when the connection status is changed. * @since_tizen 7.0 @@ -79,10 +81,54 @@ typedef GList *nlp_pos_tag_result_h; */ typedef void (*nlp_connection_status_changed_cb)(nlp_h nh, nlp_connection_status_e status, void* user_data); +/** + * @brief Called when the result of part-of-speech is received. + * @since_tizen 7.0 + * @param[in] request_id The request ID to be distingushed + * @param[in] pos_tag_result_h The part-of-speech tag result handle + * @param[in] user_data The user data passed from the callback function + * @see nlp_set_pos_tag_result_cb() + */ typedef void (*nlp_pos_tag_result_cb)(unsigned int request_id, nlp_pos_tag_result_h pos_tag_result_h, void *user_data); +/** + * @brief Called to retrieve the tokenized word. + * @since_tizen 7.0 + * @param[in] token The tokenized word + * @param[in] tag The result of POS tag + * @see nlp_foreach_pos_tag() + */ typedef bool (*nlp_pos_tag_foreach_cb)(const char* token, const char *tag, void* user_data); +/** + * @brief Called when the result of word tokenize is received. + * @since_tizen 7.0 + * @param[in] request_id The request ID to be distingushed + * @param[in] word_tokenize_result_h The word tokenize result handle + * @param[in] user_data The user data passed from the callback function + * @see nlp_set_word_tokenize_result_cb() + */ +typedef void (*nlp_word_tokenize_result_cb)(unsigned int request_id, nlp_word_tokenize_result_h word_tokenize_result_h, void *user_data); + +/** + * @brief Called to retrieve the tokenized word. + * @since_tizen 7.0 + * @param[in] word The tokenized word + * @param[in] user_data The user data passed from the callback function + * @see nlp_foreach_word_tokenize() + */ +typedef bool (*nlp_word_tokenize_foreach_cb)(const char* word, void* user_data); + +/** + * @brief Called when the result of language detect is received. + * @since_tizen 7.0 + * @param[in] request_id The request ID to be distingushed + * @param[in] lang The detected language (ISO 639-1 format such as "en") + * @param[in] user_data The user data passed from the callback function + * @see nlp_set_language_detect_result_cb() + */ +typedef void (*nlp_language_detect_result_cb)(unsigned int request_id, const char *lang, void *user_data); + /** * @brief Creates a handle for nlp. * @since_tizen 7.0 @@ -171,6 +217,94 @@ int nlp_unset_pos_tag_result_cb(nlp_h nh); */ int nlp_foreach_pos_tag(nlp_pos_tag_result_h pos_tag_result_h, nlp_pos_tag_foreach_cb callback, void* user_data); +/** + * @brief Requests to get the word tokenize given the string @str. + * @since_tizen 7.0 + * @remarks The result can be received by the callback function registered by nlp_set_word_tokenize_result_cb(). + * @param[in] nh The nlp handle + * @param[in] str The string to be requested to get the word tokenize + * @param[out] request_id The request ID to be distingushed + * @return 0 on success, otherwise a negative error value + * @retval #NLP_ERROR_NONE No error + * @retval #NLP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NLP_ERROR_OPERATION_FAILED Operation failure + */ +int nlp_request_word_tokenize(nlp_h ah, const char *str, unsigned int *request_id); + +/** + * @brief Sets the callback to receive the word tokenize. + * @since_tizen 7.0 + * @param[in] nh The NLP handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * @return 0 on success, otherwise a negative error value + * @retval #NLP_ERROR_NONE No error + * @retval #NLP_ERROR_INVALID_PARAMETER Invalid parameter + * @see nlp_unset_word_tokenize_result_cb() + */ +int nlp_set_word_tokenize_result_cb(nlp_h nh, nlp_word_tokenize_result_cb callback, void *user_data); + +/** + * @brief Unsets the callback to receive the word tokenize. + * @since_tizen 7.0 + * @param[in] nh The NLP handle + * @return 0 on success, otherwise a negative error value + * @retval #NLP_ERROR_NONE No error + * @retval #NLP_ERROR_INVALID_PARAMETER Invalid parameter + * @see nlp_set_word_tokenize_result_cb() + */ +int nlp_unset_word_tokenize_result_cb(nlp_h nh); + +/** + * @brief Retrieves the tokenized words. + * @since_tizen 7.0 + * @param[in] nlp_word_tokenize_result_h The word tokenize result handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * @return 0 on success, otherwise a negative error value + * @retval #NLP_ERROR_NONE No error + * @retval #NLP_ERROR_INVALID_PARAMETER Invalid parameter + */ +int nlp_foreach_word_tokenize(nlp_word_tokenize_result_h word_tokenize_result_h, nlp_word_tokenize_foreach_cb callback, void* user_data); + +/** + * @brief Requests to detect language given the string @str. + * @since_tizen 7.0 + * @remarks The result can be received by the callback function registered by nlp_set_language_detect_result_cb(). + * @param[in] nh The nlp handle + * @param[in] str The string to be requested to detect language + * @param[out] request_id The request ID to be distingushed + * @return 0 on success, otherwise a negative error value + * @retval #NLP_ERROR_NONE No error + * @retval #NLP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NLP_ERROR_OPERATION_FAILED Operation failure + */ +int nlp_request_language_detect(nlp_h nh, const char *str, unsigned int *request_id); + +/** + * @brief Sets the callback to receive the detected language. + * @since_tizen 7.0 + * @param[in] nlp_language_detect_result_cb The language detect result handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * @return 0 on success, otherwise a negative error value + * @retval #NLP_ERROR_NONE No error + * @retval #NLP_ERROR_INVALID_PARAMETER Invalid parameter + * @see nlp_unset_language_detect_result_cb() + */ +int nlp_set_language_detect_result_cb(nlp_h nh, nlp_language_detect_result_cb callback, void *user_data); + +/** + * @brief Unsets the callback to receive the detected language. + * @since_tizen 7.0 + * @param[in] nh The NLP handle + * @return 0 on success, otherwise a negative error value + * @retval #NLP_ERROR_NONE No error + * @retval #NLP_ERROR_INVALID_PARAMETER Invalid parameter + * @see nlp_set_language_detect_result_cb() + */ +int nlp_unset_language_detect_result_cb(nlp_h nh); + /** * @} */ diff --git a/service/src/service.c b/service/src/service.c index 1c97f9b..5c30dec 100755 --- a/service/src/service.c +++ b/service/src/service.c @@ -146,7 +146,7 @@ static int __message_send(rpc_port_stub_message_context_h context, char *message = NULL; bundle_get_str(msg, "command", &message); rpc_port_stub_message_context_get_tag(context, (void *)&sender_client); - if (sender_client) + if (sender_client) PLOG("[__RPC_PORT__] name(%s), msg(%s)", sender_client->id, message); else PERR("[__RPC_PORT__] no sender info. msg(%s)", message); diff --git a/tests/src/nlp_capi_unittests.cpp b/tests/src/nlp_capi_unittests.cpp index aa9b54e..bdfbfdf 100644 --- a/tests/src/nlp_capi_unittests.cpp +++ b/tests/src/nlp_capi_unittests.cpp @@ -63,22 +63,73 @@ bool pos_tag_foreach_cb(const char* token, const char *tag, void* user_data) void pos_tag_result_cb(unsigned int request_id, nlp_pos_tag_result_h pos_tag_result_h, void *user_data) { - printf("request id: %d\n", request_id); + printf("[%s] request id: %d\n", __func__, request_id); nlp_foreach_pos_tag(pos_tag_result_h, pos_tag_foreach_cb, NULL); STOP_LOOP(); } +bool word_tokenize_foreach_cb(const char* word, void* user_data) +{ + printf("[%s] word(%s)\n", __func__, word); + + return true; +} + +void word_tokenize_result_cb(unsigned int request_id, nlp_word_tokenize_result_h word_tokenize_result_h, void *user_data) +{ + printf("[%s] request id: %d\n", __func__, request_id); + + nlp_foreach_word_tokenize(word_tokenize_result_h, word_tokenize_foreach_cb, NULL); + + STOP_LOOP(); +} + +void language_detect_result_cb(unsigned int request_id, const char *lang, void *user_data) +{ + printf("[%s] request id: %d. language: %s\n", __func__, request_id, lang); + + STOP_LOOP(); +} + static void _connection_cb(nlp_h nh, nlp_connection_status_e status, void* user_data) { printf("status : %d\n", status); unsigned int request_id = 0; + /* English */ + /* language detect*/ + const char *str = "Hello World"; + printf("Request language detect. str(%s)\n", str); + nlp_set_language_detect_result_cb(nh, language_detect_result_cb, NULL); + nlp_request_language_detect(nh, str, &request_id); + printf("request id : %d\n", request_id); + + WAIT_FOR_CALLBACK(); + + str = "안녕하세요"; + printf("Request language detect. str(%s)\n", str); + nlp_request_language_detect(nh, str, &request_id); + printf("request id : %d\n", request_id); + + WAIT_FOR_CALLBACK(); + + /* POS tag */ + str = "Hello World"; + printf("Request Pos tag. str(%s)\n", str); nlp_set_pos_tag_result_cb(nh, pos_tag_result_cb, NULL); - nlp_request_pos_tag(nh, "Hello World", &request_id); + nlp_request_pos_tag(nh, str, &request_id); + printf("request id : %d\n", request_id); + + WAIT_FOR_CALLBACK(); + + /* Word tokenize */ + printf("Request word tokenize. str(%s)\n", str); + nlp_set_word_tokenize_result_cb(nh, word_tokenize_result_cb, NULL); + nlp_request_word_tokenize(nh, str, &request_id); printf("request id : %d\n", request_id); WAIT_FOR_CALLBACK(); @@ -156,4 +207,22 @@ TEST_F(NlpCAPITest, utc_nlp_foreach_pos_tag_invalid_parameter) EXPECT_EQ(ret, NLP_ERROR_INVALID_PARAMETER); } +TEST_F(NlpCAPITest, utc_nlp_request_word_tokenize_invalid_parameter) +{ + int ret = nlp_request_word_tokenize(NULL, NULL, NULL); + EXPECT_EQ(ret, NLP_ERROR_INVALID_PARAMETER); +} + +TEST_F(NlpCAPITest, utc_nlp_foreach_word_tokenize_invalid_parameter) +{ + int ret = nlp_foreach_word_tokenize(NULL, NULL, NULL); + EXPECT_EQ(ret, NLP_ERROR_INVALID_PARAMETER); +} + +TEST_F(NlpCAPITest, utc_nlp_request_language_detect_invalid_parameter) +{ + int ret = nlp_request_language_detect(NULL, NULL, NULL); + EXPECT_EQ(ret, NLP_ERROR_INVALID_PARAMETER); +} + } // namespace