简体   繁体   中英

Stanford CoreNLP - relation annotator

I'm trying to use the Stanford CoreNLP relation extractor ( http://nlp.stanford.edu/software/relationExtractor.shtml ).

I've installed the CoreNLP, like it suggested and I tried adding the relation parameter to the annotator pipeline but to no avail. Below is the code that I tried entering through my command line in Linux.

java -cp "*" -Xxm1g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,parse,relation -file <path toinput file>

The error message is that when it's trying to add the annotator relation, it states:

Unable to resolve "edu/stanford/nlp/models/supervised_relation_extractor/roth_relation_model_pipelineNER.ser" as either a class path, filename or URL. 

I tried searching the web to see if I could just download the roth_relation_model_pipelineNER.ser file and just stick it in the models directory but I can't find it (I also don't know Java very well).

Please let me know if you have any suggestions. Thanks.

In response to @StanfordNLPHelp 's (thank you for your quick reply BTW):

I am running the command with the models.jar file in the same directory and it is picking it up (screenshot below):

在此处输入图片说明

In addition, I downloaded the newest version of the CoreNLP zip file from the website. Unzipped it and also unpacked the models.jar file (stanford-parser-3.5.2-models.jar). I went to the models directory but there was only the lexparser and parser directories there, I didn't see one for supervised_relation_extractor. Attached is a screenshot. 在此处输入图片说明

Also, this is a side note but I had a similar problem with the pos annotator as well. I was running into the same issue where it couldn't find the file. But I was able to download a separate .jar file and place it where the program wanted it using this website (question #6 - http://nlp.stanford.edu/software/pos-tagger-faq.shtml ) and that was able to work.

That file is in this jar: stanford-corenlp-3.5.2-models.jar

When you run your command in the Terminal, that .jar file needs to be in the directory you are running the command in for the -cp "*" to pick it up. If you see that error it means that you don't have stanford-corenlp-3.5.2-models.jar in your classpath.

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