我想做一个非常简单的工作:给一个包含代词的字符串,我想解决它们.
例如,我想把这句话改为"玛丽有一只小羊羔.她很可爱." 在"玛丽有一只小羊羔.玛丽很可爱."
我曾尝试使用Stanford CoreNLP.但是,我似乎无法启动解析器.我使用Eclipse在项目中导入了所有包含的jar,并且我已经为JVM(-Xmx3g)分配了3GB.
错误非常尴尬:
线程"main"中的异常java.lang.NoSuchMethodError:edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(Ljava/lang/String; [Ljava/lang/String;)Ledu/stanford/nlp/parser/lexparser/LexicalizedParser;
我不明白L的来源,我认为这是我问题的根源......这很奇怪.我试图进入源文件,但没有错误的引用.
码:
import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations.CollapsedCCProcessedDependenciesAnnotation;
import edu.stanford.nlp.dcoref.CorefCoreAnnotations.CorefChainAnnotation;
import edu.stanford.nlp.dcoref.CorefCoreAnnotations.CorefGraphAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.NamedEntityTagAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.PartOfSpeechAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TextAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.trees.TreeCoreAnnotations.TreeAnnotation;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.dcoref.CorefChain;
import edu.stanford.nlp.pipeline.*;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.semgraph.SemanticGraph;
import edu.stanford.nlp.util.CoreMap;
import edu.stanford.nlp.util.IntTuple;
import edu.stanford.nlp.util.Pair;
import edu.stanford.nlp.util.Timing;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
public class Coref {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException, …Run Code Online (Sandbox Code Playgroud) Stanford解析器和Stanford CoreNlp使用的词性(POS)模型是不同的,这就是为什么通过Stanford Parser和CoreNlp执行的POS标记的输出存在差异.
是否有文档比较两个模型和差异的其他详细解释?
似乎corenlp的输出对于这些情况是错误的.除了我在错误分析期间检查过的几句话,我猜这些错误可能会有很多类似的情况.