【问题标题】:Stanford CoreNLP doesn't exist斯坦福 CoreNLP 不存在
【发布时间】:2020-05-05 17:27:31
【问题描述】:

我的代码开头有以下内容:

import twitter4j.*;       
import java.util.List;
import java.util.Properties;

import java.io.*;
import java.util.*;

import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.neural.rnn.RNNCoreAnnotations;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.sentiment.SentimentCoreAnnotations;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.util.CoreMap;

问题是,我收到如下错误:

Twitter_Project.java:8:错误:包 edu.stanford.nlp.ling 不存在

导入 edu.stanford.nlp.ling.CoreAnnotations;

似乎我没有将文件放在应有的文件夹中,但我不明白如何重新排列我的文件夹... 唯一的问题是,我真的不明白在哪里重新定位我的 java 文件,这样我就不会再返回这个错误了。

这就是 stanford corenlp 文件夹中的所有内容:

请帮忙——这是我第一次使用 stanford corenlp 并且也使用这些类型的集成程序(如果这是正确的话),我很困惑。

【问题讨论】:

    标签: java stanford-nlp file-exists not-exists


    【解决方案1】:

    您好,您需要确保发行版中的所有 jar 文件都在您的 CLASSPATH 中。具体操作方式取决于您是从命令行运行还是在 IDE 中运行。

    此链接解释了 CLASSPATH 的概念:https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

    【讨论】:

      【解决方案2】:

      在将 Stanford CoreNLP 安装在 Docker 容器中之前,我很难安装它。现在您可以分两步安装和运行它:

      从 Dockerhub 拉取镜像:

      $ docker pull anwala/stanfordcorenlp

      运行 CoreNLP 服务器:

      $ docker run --rm -d -p 9000:9000 --name stanfordcorenlp anwala/stanfordcorenlp

      通过浏览器/命令行/自定义python script等使用服务器: https://ws-dl.blogspot.com/2018/03/2018-03-04-installing-stanford-corenlp.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-03-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多