Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

知识图谱(N元组)抽取的输入格式使用string报错 #64

Open
lamho-bienetre opened this issue Feb 2, 2021 · 0 comments
Open

Comments

@lamho-bienetre
Copy link

from smoothnlp import kg
kg.extract("SmoothNLP在V0.3版本中正式推出知识抽取功能")

报出一堆错误

Expecting value: line 1 column 1 (char 0)
An invalid response was received from the upstream server

Expecting value: line 1 column 1 (char 0)
An invalid response was received from the upstream server

Expecting value: line 1 column 1 (char 0)
An invalid response was received from the upstream server

Expecting value: line 1 column 1 (char 0)
An invalid response was received from the upstream server
JSONDecodeError                           Traceback (most recent call last)
~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     44     try:
---> 45         result = r.json()
     46     except (json.decoder.JSONDecodeError,Exception) as e:

~\Documents\Anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs)
    891                     pass
--> 892         return complexjson.loads(self.text, **kwargs)
    893 

~\Documents\Anaconda3\lib\json\__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:

~\Documents\Anaconda3\lib\json\decoder.py in decode(self, s, _w)
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()

~\Documents\Anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
<ipython-input-15-d45ce311a5bb> in <module>()
----> 1 kg.extract("SmoothNLP在V0.3版本中正式推出知识抽取功能")

~\Documents\Anaconda3\lib\site-packages\smoothnlp\algorithm\kg\__init__.py in extract(text, pretty)
     58         raise TypeError(" Unsupported type for text parameter: {}".format(text))
     59     all_kgs = []
---> 60     sentkgs = extract_all_kg(text = sents, pretty = pretty)
     61     for sentkg in sentkgs:
     62         all_kgs+=sentkg

~\Documents\Anaconda3\lib\site-packages\smoothnlp\algorithm\kg\__init__.py in extract_all_kg(text, pretty)
     23     :return:
     24     """
---> 25     kg_result = _request(text,path="/kg/query",other_params={'pretty':pretty})
     26     return kg_result
     27 

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request(text, path, max_size_limit, other_params)
     75         config.logger.info(
     76             "request parameter: NUM_THREAD = {}, POOL_TYPE = {}".format(config.NUM_THREADS, config.POOL_TYPE))
---> 77         return _request_concurent(text,path,max_size_limit,other_params)
     78     elif isinstance(text,str):
     79         return _request_single(text,path = path,counter=0,max_size_limit=max_size_limit,other_params=other_params)

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_concurent(texts, path, max_size_limit, other_params)
     67         pool = ThreadPool(config.NUM_THREADS)
     68     params = [(text,path,0,max_size_limit,other_params) for text in texts]
---> 69     result = pool.starmap(_request_single,params)
     70     pool.close()
     71     return result

~\Documents\Anaconda3\lib\multiprocessing\pool.py in starmap(self, func, iterable, chunksize)
    272         `func` and (a, b) becomes func(a, b).
    273         '''
--> 274         return self._map_async(func, iterable, starmapstar, chunksize).get()
    275 
    276     def starmap_async(self, func, iterable, chunksize=None, callback=None,

~\Documents\Anaconda3\lib\multiprocessing\pool.py in get(self, timeout)
    642             return self._value
    643         else:
--> 644             raise self._value
    645 
    646     def _set(self, i, obj):

~\Documents\Anaconda3\lib\multiprocessing\pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
    117         job, i, func, args, kwds = task
    118         try:
--> 119             result = (True, func(*args, **kwds))
    120         except Exception as e:
    121             if wrap_exception and func is not _helper_reraises_exception:

~\Documents\Anaconda3\lib\multiprocessing\pool.py in starmapstar(args)
     45 
     46 def starmapstar(args):
---> 47     return list(itertools.starmap(args[0], args[1]))
     48 
     49 #

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     48         print(r.text)
     49         counter +=3
---> 50         return _request_single(text, path=path, counter=counter, max_size_limit=max_size_limit)
     51     if r.status_code==429:  ## qps超限制
     52         counter += 1

~\Documents\Anaconda3\lib\site-packages\smoothnlp\server\__init__.py in _request_single(text, path, counter, max_size_limit, other_params)
     27     if counter > 99:
     28         raise Exception(
---> 29             " exceed maximal attemps for parsing. ")
     30     if config.apikey is not None and isinstance(config.apikey,str):   ## pro 版本支持 apikey 调用
     31         other_params['apikey'] = config.apikey

Exception:  exceed maximal attemps for parsing. 
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant