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 2015/11/02 19:11:23 UTC

svn commit: r1712103 - /ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java

Author: dligach
Date: Mon Nov  2 18:11:22 2015
New Revision: 1712103

URL: http://svn.apache.org/viewvc?rev=1712103&view=rev
Log:
now including correctly labeled examples when printing errors

Modified:
    ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java

Modified: ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java?rev=1712103&r1=1712102&r2=1712103&view=diff
==============================================================================
--- ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java (original)
+++ ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java Mon Nov  2 18:11:22 2015
@@ -78,6 +78,7 @@ import org.cleartk.ml.jar.DirectoryDataW
 import org.cleartk.ml.jar.GenericJarClassifierFactory;
 import org.cleartk.ml.jar.JarClassifierBuilder;
 import org.cleartk.ml.liblinear.LibLinearStringOutcomeDataWriter;
+import org.cleartk.util.ViewUriUtil;
 
 import com.google.common.base.Function;
 import com.google.common.base.Objects;
@@ -523,17 +524,23 @@ public class RelationExtractorEvaluation
 				Set<HashableArguments> all = Sets.union(goldMap.keySet(), systemMap.keySet());
 				List<HashableArguments> sorted = Lists.newArrayList(all);
 				Collections.sort(sorted);
+				
+	      File noteFile = new File(ViewUriUtil.getURI(jCas).toString());
+	      String fileName = noteFile.getName();
+				
 				for (HashableArguments key : sorted) {
 					BinaryTextRelation goldRelation = goldMap.get(key);
 					BinaryTextRelation systemRelation = systemMap.get(key);
 					if (goldRelation == null) {
-						System.out.println("System added: " + formatRelation(systemRelation));
+						System.out.printf("[%s] System added: %s\n", fileName, formatRelation(systemRelation));
 					} else if (systemRelation == null) {
-						System.out.println("System dropped: " + formatRelation(goldRelation));
+						System.out.printf("[%s] System dropped: %s\n", fileName, formatRelation(goldRelation));
 					} else if (!systemRelation.getCategory().equals(goldRelation.getCategory())) {
 						String label = systemRelation.getCategory();
-						System.out.printf("System labeled %s for %s\n", label, formatRelation(systemRelation));
-					}
+						System.out.printf("[%s] System labeled %s for %s\n", fileName, label, formatRelation(systemRelation));
+					} else if (systemRelation.getCategory().equals(goldRelation.getCategory())) {
+					  System.out.printf("[%s] System nailed it: %s\n", fileName, formatRelation(systemRelation));
+					} 
 				}
 			}
 		}
@@ -573,7 +580,7 @@ public class RelationExtractorEvaluation
 				String predictedCategory = predictedSpanOutcomes.get(span);
 
 				if(goldCategory==null){
-					System.out.println("false positive: "+ predictedCategory);
+//					System.out.println("false positive: "+ predictedCategory);
 					outPrint.println("fp");
 				}else{
 					if(predictedCategory==null){