From: xiaochn.wang Date: Mon, 5 Nov 2018 06:33:54 +0000 (+0800) Subject: remove unused function nltk_get_attribute X-Git-Tag: submit/tizen/20190201.023228~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F192382%2F1;p=platform%2Fcore%2Fuifw%2Fnlp.git remove unused function nltk_get_attribute Change-Id: I99fee4720513c68d7ca626b460a465f9e4b815df --- diff --git a/service/inc/service.h b/service/inc/service.h index 3446edc..5ede478 100755 --- a/service/inc/service.h +++ b/service/inc/service.h @@ -32,7 +32,6 @@ int nltk_get_size_from_tuple(PyObject* tuple); PyObject* nltk_get_element_from_tuple_by_index(PyObject* tuple, int index); PyObject* nltk_get_element_from_list_by_index(PyObject* list, int index); char* nltk_get_string_from_element(PyObject* elm); -char* nltk_get_attribute(int z); PyObject* globe_nltk; PyObject* globe_lemm; PyObject* globe_lang; diff --git a/service/src/service.c b/service/src/service.c index f8a1a6e..8e05ca8 100755 --- a/service/src/service.c +++ b/service/src/service.c @@ -662,38 +662,3 @@ PyObject* nltk_call_function_with_args(PyObject* func, PyObject* args) PRET_VM(!func, NULL, "Input parameter [func] is NULL!"); return PyObject_CallObject(func, args); } - -// This is an example of an method to get attribute of module. -char* nltk_get_attribute(int z) -{ - PyObject *pModule, *pFunc; - PyObject *pArgs; - char* ch = (char*) malloc(BUF_LEN_256); - if (ch != NULL) - { - memset(ch, 0, BUF_LEN_256); - pModule = PyImport_ImportModule("site"); - if (pModule != NULL) - { - //create args tuple struct to fill the arg one by one ,here ,only create one param with 1 - pArgs = PyTuple_New(1); - //set a string for item 0 of tuple - PyTuple_SetItem(pArgs, 0, PyString_FromString("Hello World")); - //call word_tokenize func with args - pFunc = PyObject_GetAttrString(pModule, "USER_SITE"); - if (pFunc != NULL) { - strncpy(ch, PyString_AsString(pFunc), BUF_LEN_256-1); - } else { - strncpy(ch, "attribute get error\n", BUF_LEN_256-1); - } - } else { - strncpy(ch, "nltk module import error\n", BUF_LEN_256-1); - } - return ch; - } - else - { - PERR("malloc failed"); - return NULL; - } -}