Giter Site home page Giter Site logo

pyspotlight's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyspotlight's Issues

is there any to ignore the SpotlightException in your tool

hi, I came across a problem when using your tool.
I have to process a list of sentence. Every sentence have to be linked to the API. SO I don't want to the SpotlightException to interrupt the whole process.
is there any to ignore the SpotlightException?

here is my code:

with open('/home/tfang/data/corpus/mr.clean.txt', "r") as f:
	for line in f.readlines():
		doc_list.append(line.strip())
		text = line.strip()

		entity_current = []

		annotations = spotlight.annotate('http://localhost:2222/rest/annotate', \
		text, confidence=0.5, support=0)
		
		if annotations !=None:
			for resource_i in annotations:
				entity_current.append(resource_i["URI"][28:])
			print(entity_current)
		entity_list.append(entity_current)
with open("/home/tfang/data/process/entity_mr", "wb") as f:
	json.dump(entity_list, f)

here is the output in the console:
Traceback (most recent call last): File "entity_link.py", line 21, in <module> text, confidence=0.5, support=0) File "/home/tfang/anaconda3/envs/torch1.6/lib/python3.6/site-packages/spotlight/__init__.py", line 196, in annotate 'No Resources found in spotlight response: %s' % pydict spotlight.SpotlightException: No Resources found in spotlight response: {'@text': 'idiotic and ugly', '@confidence': '0.5', '@support': '0', '@types': '', '@sparql': '', '@policy': 'whitelist'}

connection problem

Dear @aolieman
ANy help to solve this issue please


  File "/project/6008168/tamouze/Python_directory/pyspotlight/test.py", line 2, in <module>
    annotations = spotlight.annotate('http://localhost/rest/annotate', 'Your test text',  confidence=0.4, support=20)
  File "/project/6008168/tamouze/Python_directory/pyspotlight/spotlight/__init__.py", line 192, in annotate
    pydict = _post_request(address, payload, filters, headers)
  File "/project/6008168/tamouze/Python_directory/pyspotlight/spotlight/__init__.py", line 48, in _post_request
    response = requests.post(address, data=payload, headers=reqheaders)
  File "/home/tamouze/.local/easybuild/software/2017/Core/miniconda2/4.3.27/lib/python2.7/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/tamouze/.local/easybuild/software/2017/Core/miniconda2/4.3.27/lib/python2.7/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/tamouze/.local/easybuild/software/2017/Core/miniconda2/4.3.27/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/tamouze/.local/easybuild/software/2017/Core/miniconda2/4.3.27/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/tamouze/.local/easybuild/software/2017/Core/miniconda2/4.3.27/lib/python2.7/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /rest/annotate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x2b70b3e99850>: Failed to establish a new connection: [Errno 111] Connection refused',))

Using pyspotlight fails

Hello,

I tried pyspotlight. First I installed it:

sudo pip3 install pyspotlight

I also tried just using pip, not pip3.

Then I ran the example code. It says

ModuleNotFoundError: No module named 'spotlight'

Can you give me a hint whats wrong? I tried python 2.7 and python 3.7.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.