2015-01-23 1 views
1

사용자 주석에 몇 가지 주석을 사용하기 위해 CoreNLP 패키지를 사용하고 있으며 3.5.0 버전으로 업그레이드했기 때문에 반복적으로 같은 오류가 발생하는 것으로 보입니다 :스탠포드 CoreNLP - egw4-reut.512.clusters를 찾을 수 없습니다.

Stanford NER Error: Loading distsim lexicon FailedStanford NER tagger generates 'file not found' exception with provided models 내 문제가 해결되지 않은 :

Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ...

Loading distsim lexicon from /u/nlp/data/pos_tags_are_useless/egw4-reut.512.clusters ...

java.lang.RuntimeException: java.io.FileNotFoundException: \u\nlp\data\pos_tags_are_useless\egw4-reut.512.clusters (The system cannot find the path specified) at edu.stanford.nlp.objectbank.ReaderIteratorFactory$ReaderIterator.setNextObject(ReaderIteratorFactory.java:225) (cue fifty lines of error)

몇 가지 검색은 여기 나에게 이런 유사한 질문을 가지고 내가 독점적으로 (메이븐 중앙를 통해) 3.5.0의 코드와 모델을 사용하고 있습니다. 나는 NER 모델에서 props 파일을 수정하고 사용자 디렉토리의 다른 .clusters 파일을 가리키며 성공을 시도했다.

나는 CoreNLP 객체를 생성하는 데 사용하는 코드는 꽤 표준이지만, 여기있다 :

Properties props = new Properties(); 
    props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref"); 
    stan = new StanfordCoreNLP(props); 

지금 내가 놓친 게 분명 뭔가가 있다고 생각하고있다. 어떤 도움이라도 대단히 감사하겠습니다.

Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... Loading distsim lexicon from /u/nlp/data/pos_tags_are_useless/egw4-reut.512.clusters ... java.lang.RuntimeException: java.io.FileNotFoundException: \u\nlp\data\pos_tags_are_useless\egw4-reut.512.clusters (The system cannot find the path specified) 
at edu.stanford.nlp.objectbank.ReaderIteratorFactory$ReaderIterator.setNextObject(ReaderIteratorFactory.java:225) 
at edu.stanford.nlp.objectbank.ReaderIteratorFactory$ReaderIterator.<init>(ReaderIteratorFactory.java:161) 
at edu.stanford.nlp.objectbank.ReaderIteratorFactory.iterator(ReaderIteratorFactory.java:98) 
at edu.stanford.nlp.objectbank.ObjectBank$OBIterator.<init>(ObjectBank.java:404) 
at edu.stanford.nlp.objectbank.ObjectBank.iterator(ObjectBank.java:242) 
at edu.stanford.nlp.ie.NERFeatureFactory.initLexicon(NERFeatureFactory.java:471) 
at edu.stanford.nlp.ie.NERFeatureFactory.init(NERFeatureFactory.java:379) 
at edu.stanford.nlp.ie.AbstractSequenceClassifier.reinit(AbstractSequenceClassifier.java:171) 
at edu.stanford.nlp.ie.crf.CRFClassifier.loadClassifier(CRFClassifier.java:2630) 
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1620) 
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1675) 
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1662) 
at edu.stanford.nlp.ie.crf.CRFClassifier.getClassifier(CRFClassifier.java:2851) 
at edu.stanford.nlp.ie.ClassifierCombiner.loadClassifierFromPath(ClassifierCombiner.java:189) 
at edu.stanford.nlp.ie.ClassifierCombiner.loadClassifiers(ClassifierCombiner.java:173) 
at edu.stanford.nlp.ie.ClassifierCombiner.<init>(ClassifierCombiner.java:113) 
at edu.stanford.nlp.ie.NERClassifierCombiner.<init>(NERClassifierCombiner.java:64) 
at edu.stanford.nlp.pipeline.StanfordCoreNLP$6.create(StanfordCoreNLP.java:617) 
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85) 
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:267) 
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:129) 
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:125) 
at rgu.jclos.quilt.utilities.nlp.DependenciesTagger.<init>(DependenciesTagger.java:99) 
at rgu.jclos.quilt.eca.approaches.ApproachC_USS.main(ApproachC_USS.java:47) 
Caused by: java.io.FileNotFoundException: \u\nlp\data\pos_tags_are_useless\egw4-reut.512.clusters (The system cannot find the path specified) 
    at java.io.FileInputStream.open(Native Method) 
    at java.io.FileInputStream.<init>(FileInputStream.java:131) 
    at edu.stanford.nlp.io.EncodingFileReader.<init>(EncodingFileReader.java:78) 
    at edu.stanford.nlp.objectbank.ReaderIteratorFactory$ReaderIterator.setNextObject(ReaderIteratorFactory.java:192) 
    ... 23 more 
Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: java.io.FileNotFoundException 
    at edu.stanford.nlp.pipeline.StanfordCoreNLP$6.create(StanfordCoreNLP.java:621) 
    at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85) 
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:267) 
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:129) 
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:125) 
    at rgu.jclos.quilt.utilities.nlp.DependenciesTagger.<init>(DependenciesTagger.java:99) 
    at rgu.jclos.quilt.eca.approaches.ApproachC_USS.main(ApproachC_USS.java:47) 
Caused by: java.io.FileNotFoundException 
    at edu.stanford.nlp.ie.ClassifierCombiner.loadClassifierFromPath(ClassifierCombiner.java:199) 
    at edu.stanford.nlp.ie.ClassifierCombiner.loadClassifiers(ClassifierCombiner.java:173) 
    at edu.stanford.nlp.ie.ClassifierCombiner.<init>(ClassifierCombiner.java:113) 
    at edu.stanford.nlp.ie.NERClassifierCombiner.<init>(NERClassifierCombiner.java:64) 
    at edu.stanford.nlp.pipeline.StanfordCoreNLP$6.create(StanfordCoreNLP.java:617) 
    ... 6 more 
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to edu.stanford.nlp.classify.LinearClassifier 
at edu.stanford.nlp.ie.ner.CMMClassifier.loadClassifier(CMMClassifier.java:1070) 
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1620) 
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1675) 
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1662) 
at edu.stanford.nlp.ie.ner.CMMClassifier.getClassifier(CMMClassifier.java:1116) 
at edu.stanford.nlp.ie.ClassifierCombiner.loadClassifierFromPath(ClassifierCombiner.java:195) 
... 10 more 
+0

실행 결과 전체 또는 문제를 재현하는 최소한의 예제를 포함 할 수 있습니까? 이 어휘집에는 이미 모델이로드되어 있어야합니다 (오류는 파일 시스템에서 다시로드하려고 시도하는 오류입니다). 그러면 모델이 손상되었거나 이전 버전이 잘못되었다고 생각하게됩니다. 확인해야 할 다른 사항은 모델 버전이 CoreNLP 버전과 동일한 지 확인하는 것입니다. –

+0

감사합니다. 귀하의 의견에 감사드립니다. Stanford 라이브러리는 출력 처리를 위해 유틸리티 클래스에서 사용되었습니다. 그것들을 사용하는 프로젝트에서 모델과 코드는 모두 3.5.0입니다.하지만 Maven에서 전이 의존성을 섞어서 그 유틸리티 클래스를 사용하는 프로젝트에서 내 뒤에서 3.4 파일을 가져 오는 문제가 발생했습니다. 혼란과 그 후의 버그. –

답변

0

그것은 문제가 메이븐에 의해 발생 된 것으로 밝혀 다음과 같이

더 완전한 스택 트레이스 (즉, 도움이 될 수있는 경우)입니다.

내 코드는 스탠포드 CoreNLP를 포장하여 추가 처리를 제공하는 유틸리티 라이브러리에 있으며 완벽하게 잘 작동하고 있습니다. 그러나이 프로젝트를 마스터 프로젝트에 종속성으로 추가 할 때 Maven은 스탠포드 CoreNLP 라이브러리 모델 3.4 버전을 마스터 프로젝트로 가져와 기본값으로 위의 버그를 일으켰습니다.

관련 문제