0

I'm relatively new at this. Trying to get Stanford Segmenter to play well with nltk and keep running into this error I havent been able to resovle.

This is the error:

CRFClassifier invoked on Tue Jan 19 17:39:25 CET 2016 with arguments:
   -sighanCorporaDict C:/Users/Documents/DaimText/stanford-segmenter-2015-12-09/data -textFile C:\Users\NGBENE\AppData\Local\Temp\tmpmti8l2nb -sighanPostProcessing true -keepAllWhitespaces false -loadClassifier C:/Users/Documents/DaimText/stanford-segmenter-2015-12-09/data/pku.gz -serDictionary C:/Users/Documents/DaimText/stanford-segmenter-2015-12-09/data/dict-chris6.ser.gz -inputEncoding UTF-8
serDictionary=C:/Users/Documents/DaimText/stanford-segmenter-2015-12-09/data/dict-chris6.ser.gz
loadClassifier=C:/Users/Documents/DaimText/stanford-segmenter-2015-12-09/data/pku.gz
sighanCorporaDict=C:/Users/Documents/DaimText/stanford-segmenter-2015-12-09/data
inputEncoding=UTF-8
textFile=C:\Users\AppData\Local\Temp\tmpmti8l2nb
sighanPostProcessing=true
keepAllWhitespaces=false
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

I have python3.4

I've reinstalled the nltk (current version 3.1)

I've added the classpath of the slf4j-api.jar (any other .jar i need to add?)

import os
javapath = "C:/Users/Documents/DaimText/stanford-segmenter-2015-12-09/slf4j-api.jar"
os.environ['CLASSPATH'] = javapath

Still doesn't work. Any ideas?

Thanks alot!

UPDATE:

Uninstalled: stanford-segmenter-2015-12-09

Installed: stanford-segmenter-2014-08-27

Followed the test code from here:

http://textminingonline.com/dive-into-nltk-part-vi-add-stanford-word-segmenter-interface-for-python-nltk

Works!

Seems like it might be a problem with the new version.

growclip
  • 105
  • 9
  • 1
    Possible duplicate of [Stanford Parser and NLTK](http://stackoverflow.com/questions/13883277/stanford-parser-and-nltk) – alvas Jan 19 '16 at 17:03
  • Please take a look at https://gist.github.com/alvations/e1df0ba227e542955a8a and keep track of these issues in NLTK https://github.com/nltk/nltk/issues/1237 and https://github.com/nltk/nltk/pull/1249 – alvas Jan 19 '16 at 17:04
  • Hey wait, There's no NLTK API for Stanford Segmenter! I had to write my own the last time I needed to use it. Could you show the code of how you use the Segmenter in NLTK/ python? – alvas Jan 24 '16 at 03:57
  • Ah ha, got it, it's not exactly from the official NLTK codebase. The solution is the same as shown in the github gist, look through it, if you still need help, leave me a message here and I could try to write an answer specific to the segmenter. – alvas Jan 24 '16 at 04:00

0 Answers0