简体   繁体   中英

How to run NegAIT with Stanford core nlp in Java in terminal in Mac?

I am not familiar with Java (only python). But I'd like to run NegAIT.

I have stanford core nlp 3.7 installed & downloaded the NegAIT repository . They're both in my home directory. I also have JDK SE 1.8 set as my home path.

When I ran the command on my Macbook terminal inside the NegAIT-master folder:

java -cp negate.jar:/Users/username/NegAIT-master/stanford-corenlp-3.7.0/stanford-corenlp-3.7.0.jar:/Users/username/NegAIT-master/stanford-corenlp-3.7.0/stanford-corenlp-3.7.0-models.jar negate.NegationParser AagenaesSyndrome.txt AagenaesSyndromeNegation

I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: edu/stanford/nlp/pipeline/StanfordCoreNLP
    at negate.TextRead.<init>(TextRead.java:48)
    at negate.NegationParser.main(NegationParser.java:21)
Caused by: java.lang.ClassNotFoundException: edu.stanford.nlp.pipeline.StanfordCoreNLP
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 2 more

As I said, I am familiar with Python but not with Java, if someone could help me out or give me a tip on how to run this tool I would highly appreciate it.

Stanford CoreNLP is not being found on your CLASSPATH. It looks like that is because you haven't substituted your login name for username in the paths in the -cp .

Or, if you are in running the commend inside the NegAIT-master folder, and the CoreNLP jar files are in a subdirectory stanford-corenlp-3.7.0 from there, you could simplify the CLASSPATH to:

java -cp negate.jar:stanford-corenlp-3.7.0/stanford-corenlp-3.7.0.jar:stanford-corenlp-3.7.0/stanford-corenlp-3.7.0-models.jar negate.NegationParser AagenaesSyndrome.txt AagenaesSyndromeNegation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM