2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include "gc_internal.h"
22 #include "gc_inference.h"
23 #include "gc_private.h"
25 static bool is_initialized = false;
26 static gc_classifier_h *gc_handle = NULL;
31 return GC_ERROR_ALREADY_DONE;
33 is_initialized = true;
38 int _deinitialize(void)
41 return GC_ERROR_ALREADY_DONE;
43 is_initialized = false;
48 int _gc_check_init_status(void)
50 int ret_val = GC_ERROR_NONE;
52 if (is_initialized == false)
53 ret_val = GC_ERROR_INITIALIZATION_NOT_DONE;
58 int _create_classifier(gc_classifier_h *classifier_handle, char *app_id, char *user_id)
60 int ret_val = GC_ERROR_NONE;
65 int _gc_check_handle_creation(void)
67 int ret_val = GC_ERROR_NONE;
69 if (gc_handle == NULL)
70 ret_val = GC_ERROR_HANDLE_NOT_CREATED;
75 int _gc_check_handle_validity(gc_classifier_h *classifier_handle)
77 int ret_val = GC_ERROR_NONE;
82 int _delete_classifier(gc_classifier_h *classifier_handle)
84 int ret_val = GC_ERROR_NONE;
93 int _get_category(gc_classifier_s *classifier_handle, char *text_data, int text_data_len, gc_category_s *category_list)
96 int ret_val = GC_ERROR_NONE;
98 gc_get_category_result result = get_category(classifier_handle->uID, classifier_handle->appID, text_data);
100 strncpy(category_list->first_category, result.first_category, strlen(result.first_category) + 1);
101 strncpy(category_list->second_category, result.second_category, strlen(result.second_category) + 1);
102 strncpy(category_list->third_category, result.third_category, strlen(result.third_category) + 1);
104 category_list->first_category_score = result.first_category_score;
105 category_list->second_category_score = result.second_category_score;
106 category_list->third_category_score = result.third_category_score;
110 int _add_category(gc_classifier_s *classifier_handle, char *category_name)
113 int ret_val = add_category(classifier_handle->appID, classifier_handle->uID, category_name);
118 int _delete_category(gc_classifier_s *classifier_handle, char *category_name)
121 int ret_val = delete_category(classifier_handle->appID, classifier_handle->uID, category_name);
126 int _update_category(gc_classifier_s *classifier_handle, char *category_name, char *text_data, int text_data_len)
129 int ret_val = update_category(classifier_handle->appID, classifier_handle->uID, category_name, text_data, text_data_len);