Basically what I want is to replace all the pronouns from a text with the actual entity.
// Path to the folder with models extracted from `stanford-corenlp-3.7.0-models.jar`
var jarRoot = ...
// Text for processing
var text = "Kosgi Santosh sent an email to Stanford University. He didn't get a reply.";
// Annotation pipeline configuration
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
props.setProperty("ner.useSUTime", "0");
// We should change current directory, so StanfordCoreNLP could find all the model files automatically
var curDir = Environment.CurrentDirectory;
Directory.SetCurrentDirectory(jarRoot);
var pipeline = new StanfordCoreNLP(props);
Directory.SetCurrentDirectory(curDir);
// Annotation
var annotation = new Annotation(text);
pipeline.annotate(annotation);
var graph = annotation.get(new CorefChainAnnotation().getClass());
Console.WriteLine(graph);
So far I could only find how to "pretty print" it, but I would like to further process the result from "graph", yet I do not know how to actually parse the result from "annotation.get(new CorefChainAnnotation().getClass())". In Java it is said that it would return a Map < Integer, CorefChain >, but I don't know how it is supposed to work in C#.
Do you have any ideas?