7

I was testing the StanfordNERTagger using the NLTK wrapper and this warning appeared:

DeprecationWarning: The StanfordTokenizer will be deprecated in version 
3.2.5. Please use nltk.tag.corenlp.CoreNLPPOSTagger or 
nltk.tag.corenlp.CoreNLPNERTagger instead.
super(StanfordNERTagger, self).__init__(*args, **kwargs)

My code looks like this:

from nltk import word_tokenize, pos_tag, ne_chunk
from nltk.tag import StanfordNERTagger

sentence = "Today George went to school and met his friend Peter."

# stanford's NER tagger 3 entity classification
st = StanfordNERTagger('/home/hercules/Desktop/PhD/Tools/stanford-ner-
     2017-06-09/classifiers/english.all.3class.distsim.crf.ser.gz',
     '/home/hercules/Desktop/PhD/Tools/stanford-ner-2017-06-09/stanford-
     ner.jar',
     encoding='utf-8')

tokenized_text = word_tokenize(sentence)
classified_text = st.tag(tokenized_text)

print("Stanford NER tagger:")
print(classified_text)

I tried to use CoreNLPNERTagger but I could not find any examples or documentation. I only found this link: where it gives something like an example in the comments of the class CoreNLPNERTagger(CoreNLPTagger) (I found it by searching the keyword "CoreNLPNERTagger")

I tried to follow that example with no use. I think I should start (if that is the correct term) the coreNLP server first but if is that the case I don't know how.

If anyone got any idea or advice I would be grateful.

Anoroah
  • 1,987
  • 2
  • 20
  • 31
  • I'm voting to close this question as off-topic because it was cross posted – Bhargav Rao Aug 01 '18 at 19:19
  • 1
    I don't get why cross posting makes a question off topic. And given that the question has 1k views shows that a lot of people had the same issue with me and searched SO. – Anoroah Aug 01 '18 at 20:11
  • Cross posting a question makes it eligible for deletion actually. See [Is cross-posting a question on multiple Stack Exchange sites permitted?](https://meta.stackexchange.com/questions/64068/is-cross-posting-a-question-on-multiple-stack-exchange-sites-permitted-if-the-qu). Usually we delete it, but given that this has a lot of views and a partially good answer, I decided not to delete it and just close it. – Bhargav Rao Aug 01 '18 at 20:13
  • The link you provide does not justify that. Check Faheem Mitha's commend on the answer. – Anoroah Aug 01 '18 at 20:20
  • Unfortunately I have to follow rules which have been created as answers on Meta. If you feel that cross posting should be allowed, feel free to create a new post on http://meta.stackexchange.com. – Bhargav Rao Aug 01 '18 at 20:22
  • Can you provide a link to the actual rule then? – Anoroah Aug 01 '18 at 20:23
  • That answer posted there is the actual rule. Cross posting is not allowed on Stack Exchange sites and we are expected to delete posts which are cross posted. – Bhargav Rao Aug 01 '18 at 20:24
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/177227/discussion-between-imoutidi-and-bhargav-rao). – Anoroah Aug 01 '18 at 20:25

1 Answers1

1

Well i found myself working with Stanford POS Tagger recently (got a similar warning) but still the tagger is still working.
The thing is, this is a warning telling you that they will change/remove the StanfordNERTagger class (more information about the warning).
What i advise you to do is to maintain your code with venv or just copy the module (that's what i did) for example in order to keep your nltk module the way it is (avoid updating therefore sticking with this class).
Hope this helps you.