const char *tag;
} pos_tag_s;
-static char *get_request_id()
+static char *generate_request_id()
{
_request_id++;
char buffer [sizeof(unsigned int)*8+1];
return strdup(buffer);
}
-static void process_pos_tag_result(nlp_h nh, bundle *msg)
+unsigned int get_request_id(bundle *msg)
{
+ unsigned int request_id_num = 0;
char *request_id = NULL;
-
bundle_get_str(msg, "request_id", &request_id);
+ LOGD("id : %s", request_id);
+
+ if (request_id)
+ request_id_num = (unsigned int)atoi(request_id);
+
+ return request_id_num;
+}
+
+static void process_pos_tag_result(nlp_h nh, bundle *msg)
+{
+ unsigned int request_id_num = get_request_id(msg);
const char **tag_array = NULL;
const char **token_array = NULL;
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);
+ nh->pos_tag_result_cb(request_id_num, pos_tag_result_h, nh->pos_tag_result_data);
GList* iter = NULL;
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);
+ unsigned int request_id_num = get_request_id(msg);
const char **word_array = NULL;
int len_word_array = 0;
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);
+ nh->word_tokenize_result_cb(request_id_num, word_tokenize_result_h, nh->word_tokenize_result_data);
if (g_list_length(glist) > 0) {
g_list_free(glist);
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);
+ unsigned int request_id_num = get_request_id(msg);
const char **language_array = NULL;
int len_language_array = 0;
}
if (nh->language_detect_result_cb)
- nh->language_detect_result_cb((unsigned int)atoi(request_id), detect_language, nh->language_detect_result_data);
+ nh->language_detect_result_cb(request_id_num, detect_language, nh->language_detect_result_data);
}
//LCOV_EXCL_START
{
nlp_h nh = user_data;
LOGD("sender: %s", sender);
- char *request_id = NULL;
char *command = NULL;
- bundle_get_str(msg, "request_id", &request_id);
bundle_get_str(msg, "command", &command);
- LOGD("id : %s, command : %s", request_id, command);
+ LOGD("command : %s", command);
if (!command) return;
return NLP_ERROR_OPERATION_FAILED;
}
- char *req_id = get_request_id();
+ char *req_id = generate_request_id();
bundle *msg = bundle_create();
bundle_add_str(msg, "command", command);