【问题标题】:Stanford NLP Parser Model Jar too large斯坦福 NLP 解析器模型 Jar 太大
【发布时间】:2016-10-13 21:43:14
【问题描述】:

我使用 maven 来管理依赖项。我需要使用斯坦福 NLP 解析器来获取英语句子的通用依赖项。我正在使用 edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz 模型。我的 pom.xml 包含以下内容

    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-parser</artifactId>
        <version>3.6.0</version>
    </dependency>
    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-parser</artifactId>
        <version>3.6.0</version>
        <classifier>models</classifier>
    </dependency>

通过添加模型依赖项,jar 大小增加了大约 300MB。我需要确保罐子尽可能小。有没有办法在 maven 中处理这个问题?

【问题讨论】:

    标签: stanford-nlp


    【解决方案1】:

    您可以通过不包含模型并从其他地方引用它们来使 jar 更小(即,为属性 parse.model 指定自定义路径),但通常如果您想生成解析树,则需要使解析器模型可在某处访问。 CoreNLP 默认将其包含在模型 jar 中,以便更轻松地独立于特定目录结构运行代码。

    另一种选择是运行CoreNLP Server,然后你只需要客户端库(服务器包含models jar)。

    【讨论】:

      猜你喜欢
      • 2014-04-20
      • 1970-01-01
      • 2017-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-30
      相关资源
      最近更新 更多