You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by dl...@apache.org on 2014/04/25 21:26:15 UTC
svn commit: r1590113 -
/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java
Author: dligach
Date: Fri Apr 25 19:26:15 2014
New Revision: 1590113
URL: http://svn.apache.org/r1590113
Log:
added note name to the output
Modified:
ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java
Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java?rev=1590113&r1=1590112&r2=1590113&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java Fri Apr 25 19:26:15 2014
@@ -38,6 +38,7 @@ import org.apache.uima.cas.CASException;
import org.apache.uima.collection.CollectionReader;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.tcas.Annotation;
+import org.cleartk.util.ViewURIUtil;
import org.uimafit.component.JCasAnnotator_ImplBase;
import org.uimafit.factory.AnalysisEngineFactory;
import org.uimafit.pipeline.SimplePipeline;
@@ -110,25 +111,14 @@ public class GoldRelationViewer {
relationLookup.put(Arrays.asList(arg1, arg2), relation);
}
+ File noteFile = new File(ViewURIUtil.getURI(jCas).toString());
+ String fileName = noteFile.getName();
+
for(Sentence sentence : JCasUtil.select(systemView, Sentence.class)) {
List<String> formattedRelationsInSentence = new ArrayList<>();
List<EventMention> eventMentionsInSentence = JCasUtil.selectCovered(goldView, EventMention.class, sentence);
List<TimeMention> timeMentionsInSentence = JCasUtil.selectCovered(goldView, TimeMention.class, sentence);
- // retrieve event-event relations in this sentence
- for(EventMention mention1 : eventMentionsInSentence) {
- for(EventMention mention2 : eventMentionsInSentence) {
- if(mention1 == mention2) {
- continue;
- }
- BinaryTextRelation relation = relationLookup.get(Arrays.asList(mention1, mention2));
- if(relation != null) {
- String text = String.format("%s(%s, %s)", relation.getCategory(), mention1.getCoveredText(), mention2.getCoveredText());
- formattedRelationsInSentence.add(text);
- }
- }
- }
-
// retrieve event-time relations in this sentece
for(EventMention eventMention : eventMentionsInSentence) {
for(TimeMention timeMention : timeMentionsInSentence) {
@@ -147,8 +137,22 @@ public class GoldRelationViewer {
}
}
+ // retrieve event-event relations in this sentence
+ for(EventMention mention1 : eventMentionsInSentence) {
+ for(EventMention mention2 : eventMentionsInSentence) {
+ if(mention1 == mention2) {
+ continue;
+ }
+ BinaryTextRelation relation = relationLookup.get(Arrays.asList(mention1, mention2));
+ if(relation != null) {
+ String text = String.format("%s(%s, %s)", relation.getCategory(), mention1.getCoveredText(), mention2.getCoveredText());
+ formattedRelationsInSentence.add(text);
+ }
+ }
+ }
+
if(formattedRelationsInSentence.size() > 0) {
- System.out.println(sentence.getCoveredText());
+ System.out.println(fileName + ": " + sentence.getCoveredText());
for(String text : formattedRelationsInSentence) {
System.out.println(text);
}