ushahidi / geograpy

Extract countries, regions and cities from a URL or text
219 stars 133 forks source link

Error processing data (from demo) #2

Closed brunobg closed 9 years ago

brunobg commented 9 years ago

NLTK seems to have changed this: http://www.nltk.org/_modules/nltk/tree.html

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/geograpy/**init**.py", line 6, in get_place_context
    e.find_entities()
  File "/usr/local/lib/python2.7/dist-packages/geograpy/extraction.py", line 31, in find_entities
    if (ne.node == 'GPE' or ne.node == 'PERSON') and ne[0][1] == 'NNP':
  File "/usr/local/lib/python2.7/dist-packages/nltk/tree.py", line 198, in _get_node
    raise NotImplementedError("Use label() to access a node label.")
NotImplementedError: Use label() to access a node label.
MdJawad commented 9 years ago

To resolve the following issue : ############################################################################ NLTK seems to have changed this: http://www.nltk.org/_modules/nltk/tree.html


Traceback (most recent call last):
File "", line 1, in 
File "/usr/local/lib/python2.7/dist-packages/geograpy/init.py", line 6, in get_place_context
e.find_entities()
File "/usr/local/lib/python2.7/dist-packages/geograpy/extraction.py", line 31, in find_entities
if (ne.node == 'GPE' or ne.node == 'PERSON') and ne[0][1] == 'NNP':
File "/usr/local/lib/python2.7/dist-packages/nltk/tree.py", line 198, in _get_node
raise NotImplementedError("Use label() to access a node label.")
NotImplementedError: Use label() to access a node label.
############################################################################

Update the extraction.py code to the following.

if (ne.label() == 'GPE' or ne.label() == 'PERSON') and ne[0][1] == 'NNP':
miguelfg commented 9 years ago

This hasn't been updated, right?. The issue was opened 8 months ago, it is intended to be fixed?

gati commented 9 years ago

Hey guys, the issue messages got buried in my inbox. I don't have write access to this repo anymore now that I'm not at Ushahidi. @brianherbert can you merge these requests, give me write access to this repo, or just transfer ownership to me? (It's a standalone library I wrote while we were developing CrisisNET)

brunobg commented 9 years ago

I ended up making a fork with several fixes, but it's not completely finished yet. https://github.com/Corollarium/geograpy2

aoduor commented 9 years ago

Hey @brunobg @gati - I've merged in the pull request. @brunobg, you can send through the rest of your fixes when they're complete and i'll merge them in.

Thanks so much!

brunobg commented 9 years ago

Sure, but it's almost a rewrite and it won't be backwards compatible. I've kept plain fixes in https://github.com/Corollarium/geograpy and that's the PR you already merged. Thanks!