我想在Java命令行中使用stanford-parser-full-2015-01-30

java -mx100m edu.stanford.nlp.trees.EnglishGrammaticalStructure -sentFile input.txt -collapsedTree -CCprocessed -parseTree -parserFile englishPCFG.ser.gz

当我使用此命令

java -mx100m edu.stanford.nlp.trees.EnglishGrammaticalStructure   -sentFile input.txt -collapsedTree -CCprocessed -parseTree -parserFile englishPCFG.ser.gz它返回此错误:无法找到或加载主文件   edu.stanford.nlp.trees.EnglishGrammaticalStructure类

当我使用此命令

java -cp“ *” edu.stanford.nlp.trees.EnglishGrammaticalStructure   -sentFile input.txt -collapsedTree -CCprocessed -parseTree -parserFile englishPCFG.ser.gz它会重新运行
Loading parser from serialized file englishPCFG.ser.gz ...
java.io.IOException: Unable to resolve "englishPCFG.ser.gz" as either class path, filename or URL
        at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:463)
        at edu.stanford.nlp.io.IOUtils.readStreamFromString(IOUtils.java:396)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromSerializedFile(LexicalizedParser.java:599)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromFile(LexicalizedParser.java:394)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:181)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:160)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at edu.stanford.nlp.trees.GrammaticalStructure.loadParser(GrammaticalStructure.java:1394)
        at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1645)
Loading parser from text file englishPCFG.ser.gz java.io.IOException: Unable to resolve "englishPCFG.ser.gz" as either class path, filename or URL
        at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:463)
        at edu.stanford.nlp.io.IOUtils.readerFromString(IOUtils.java:591)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromTextFile(LexicalizedParser.java:533)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromFile(LexicalizedParser.java:396)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:181)
        at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:160)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at edu.stanford.nlp.trees.GrammaticalStructure.loadParser(GrammaticalStructure.java:1394)
        at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1645)
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
        at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1655)
Caused by: java.lang.NullPointerException
        at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1652)

我不知道问题出在哪里以及如何使用该库

评论