Не удается загрузить модель теггера в Stanford CoreNLP Java API - PullRequest
0 голосов
/ 04 августа 2020

Я работал со Stanford CoreNLP API версии 4.0.0 в java. Однако недавно я обновился до версии 4.1.0, и у меня проблемы с использованием аннотатора "pos". В частности, я не могу загрузить модель tagger. Я подтвердил, что банка моделей находится в моем пути к классам и что у меня нет нескольких версий CoreNLP в моем пути к классам. Я также извлек файл jar модели и подтвердил, что pos-tagger включен. Из того, что я могу найти, похоже, что pos-tagger - единственная модель, к которой нельзя получить доступ. Для последней попытки я загрузил банку моделей engli sh и попытался заменить банку моделей этой новой загрузкой. Это не сработало. Вот две ошибки, которые я получаю:

edu.stanford.nlp.io.RuntimeIOException: Error while loading a tagger model (probably missing model file)
    at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:801)
    at edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:322)
    at edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:275)
    at edu.stanford.nlp.pipeline.POSTaggerAnnotator.loadModel(POSTaggerAnnotator.java:85)
    at edu.stanford.nlp.pipeline.POSTaggerAnnotator.<init>(POSTaggerAnnotator.java:73)
    at edu.stanford.nlp.pipeline.AnnotatorImplementations.posTagger(AnnotatorImplementations.java:68)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.lambda$getNamedAnnotators$5(StanfordCoreNLP.java:527)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.lambda$null$32(StanfordCoreNLP.java:608)
    at edu.stanford.nlp.util.Lazy$3.compute(Lazy.java:126)
    at edu.stanford.nlp.util.Lazy.get(Lazy.java:31)
    at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:149)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:253)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:194)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:190)

Caused by: java.io.IOException: Unable to open "edu/stanford/nlp/models/pos-tagger/english-left3words-distsim.tagger" as class path, filename or URL
    at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:482)
    at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:798)
    ... 44 more

Есть идеи, как это исправить? Заранее спасибо!

...