Created
November 15, 2012 18:38
-
-
Save Nectarineimp/4080357 to your computer and use it in GitHub Desktop.
exploring coreferences from Stanford CoreNLP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Map<Integer, CorefChain> graph = document.get(CorefChainAnnotation.class); | |
| for (Map.Entry<Integer, CorefChain> entry : graph.entrySet()) { | |
| CorefChain c = entry.getValue(); | |
| System.out.println("\nClusterID: " + entry.getKey()); | |
| CorefMention cm = c.getRepresentativeMention(); | |
| if (cm != null) { | |
| System.out.println("Representative Mention: " + cm.mentionSpan + " @" + cm.position.elems()[0] + " H:" + cm.position.elems()[1] + " [ " + cm.startIndex + ", " + cm.endIndex + "]"); | |
| List<CorefMention> cms = c.getCorefMentions(); | |
| System.out.print("Mentions:\n"); | |
| for (CorefMention mention : cms) { | |
| System.out.print("\t" + mention.mentionSpan + " @" + mention.sentNum + " [" + mention.startIndex + ", " + mention.endIndex + "]"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment