Stanford NLP: ошибка при загрузке модели тегера (возможно, отсутствует файл модели) - PullRequest
0 голосов
/ 17 сентября 2018

Я пытаюсь использовать Stanford NLP и сталкиваюсь с ошибкой Error while loading a tagger model (probably missing model file).Я не могу понять, что не так.Я установил основную банку, используя maven:

    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-corenlp</artifactId>
        <version>3.9.1</version>
    </dependency>

Я попытался установить файл моделей, используя maven:

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

Но пакет продолжал выделяться:

enter image description here

Итак, я скачал файл модели с здесь и добавил его, используя Файл - Структура проекта - Добавить библиотеку - Скомпилировать - ОК:

enter image description here

Однако, когда я запускаю тестовый класс, он не работает, и возникает вышеупомянутая ошибка:

package com.util;

import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.pipeline.CoreDocument;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;

import java.util.Properties;

public class TextEater {
    public static void main(String[] args) {
        Properties props = new Properties();
        // set the list of annotators to run
        props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,parse,depparse,coref,kbp,quote");
        // set a property for an annotator, in this case the coref annotator is being set to use the neural algorithm
        props.setProperty("coref.algorithm", "neural");
        // build pipeline
        StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
        // create a document object
        CoreDocument document = new CoreDocument("Hello how are you");
        // annnotate the document
        pipeline.annotate(document);
        // examples

        // 10th token of the document
        CoreLabel token = document.tokens().get(10);
        System.out.println("Example: token");
        System.out.println(token);
        System.out.println();
    }

}

Почему не импортируется вручнуюиз библиотеки моделей, кажется, работает?Что можно сделать, чтобы это исправить?Любая помощь приветствуется.

...