斯坦福NLP Parser模型罐太大了

时间:2016-10-13 21:43:14

标签: stanford-nlp

我使用maven来管理依赖项。我需要使用Stanford NLP Parser来获得英语句子的普遍依赖性。我正在使用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中处理这个问题?

1 个答案:

答案 0 :(得分:0)

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

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