Maven依赖项:get不下载Stanford NLP模型文件 [英] Maven dependency:get does not download Stanford NLP model files

查看:204
本文介绍了Maven依赖项:get不下载Stanford NLP模型文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

斯坦福自然语言处理工具包的核心组件在stanford-corenlp-1.3.4.jar文件中包含Java代码,并且在单独的stanford-corenlp-1.3.4-models.jar文件中具有(很大)模型文件. Maven不会自动下载模型文件,只有在将<classifier>models</classifier>行添加到.pom时,它才会自动下载.这是一个.pom片段,可同时获取代码和模型.

The core component of the Stanford Natural Language Processing Toolkit has Java code in a stanford-corenlp-1.3.4.jar file, and has (very large) model files in a separate stanford-corenlp-1.3.4-models.jar file. Maven does not download the model files automatically, but only if you add <classifier>models</classifier> line to the .pom. Here is a .pom snippet that fetches both the code and the models.

    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-corenlp</artifactId>
        <version>1.3.4</version>
        <classifier>models</classifier>
    </dependency>

我正在尝试从命令行中找出如何做同样的事情.看来Maven dependency:get 插件任务是执行此操作的方法.以下命令行似乎是正确的

I'm trying to figure out how to do the same thing from the command line. It seems like the Maven dependency:get plugin task is the way to do this. The following command line seems like it would be correct

mvn dependency:get \
    -DgroupId=edu.stanford.nlp \
    -DartifactId=stanford-corenlp \
    -Dversion=LATEST \
    -Dclassifier=models \
    -DrepoUrl=repo1.maven.org

但是,它仅下载代码Jar文件,而不下载模型Jar文件.

However, it only downloads the code Jar file but not the models Jar file.

有人知道为什么会这样吗?我不确定这是否只是Stanford NLP软件包的问题,​​还是dependency:getclassifier选项的更一般的问题.

Any idea why this is the case? I'm not sure if this is just an issue with the Stanford NLP package or a more general issue with the classifier option of dependency:get.

推荐答案

首先感谢您的提问.它回答了我有关如何同时包含数据和库的问题.我将分享我在Maven中所做的事情,但是我不确定这是否满足您的问题:

First thanks for your question. It answered my question about how to include both the data and the lib. I'll share what I'm doing with Maven, but I'm not sure this satisfies your question:

<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>1.3.4</version>
  <classifier>models</classifier>
</dependency>
<dependency>
      <groupId>edu.stanford.nlp</groupId>
      <artifactId>stanford-corenlp</artifactId>
      <version>1.3.4</version>
    </dependency>
    <dependency>
      <groupId>edu.stanford.nlp</groupId>
      <artifactId>stanford-parser</artifactId>
      <version>2.0.4</version>
    </dependency>

此外,请确保我的jar包含我使用的库:

Also, make sure my jar includes the libs I use:

  <build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>org.example.nlpservice.NLP</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
      <executions>
        <execution>
          <id>make-assembly</id> <!-- this is used for inheritance merges -->
          <phase>package</phase> <!-- bind to the packaging phase -->
          <goals>
            <goal>single</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
   </build>

最后,您是否尝试过mvn deploymvn install?您可以从本地mvn缓存/存储库复制到/lib目录.

Finally, have you tried mvn deploy or mvn install yet? You could copy from your local mvn cache/repo into a /lib directory.

这篇关于Maven依赖项:get不下载Stanford NLP模型文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆