Fondamentalement, ce que je veux, c'est remplacer tous les pronoms d'un texte par l'entité actuelle.Résolution de la coréférence à l'aide de Stanford Parser dans .NET
// 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);
Jusqu'à présent, je ne pouvait trouver comment « pretty print », mais je voudrais traiter davantage le résultat de « graphique », mais je ne sais pas comment analyser en fait le résultat de « l'annotation. get (nouveau CorefChainAnnotation(). getClass()) ". En Java, il est dit qu'il retournera une carte < Entier, CorefChain>, mais je ne sais pas comment il est censé fonctionner en C#.
Avez-vous des idées?