ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1639534 - in /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval: AnnotationStatisticsCompact.java MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java TestFeatureSelection.java XMIReader.java
Date Thu, 13 Nov 2014 21:45:32 GMT
Author: tmill
Date: Thu Nov 13 21:45:31 2014
New Revision: 1639534

URL: http://svn.apache.org/r1639534
Log:
Cleaned up eval directory in assertions.

Removed:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/TestFeatureSelection.java
Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AnnotationStatisticsCompact.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/XMIReader.java

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AnnotationStatisticsCompact.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AnnotationStatisticsCompact.java?rev=1639534&r1=1639533&r2=1639534&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AnnotationStatisticsCompact.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AnnotationStatisticsCompact.java
Thu Nov 13 21:45:31 2014
@@ -125,7 +125,7 @@ public class AnnotationStatisticsCompact
    */
   public static <OUTCOME_TYPE extends Comparable<? super OUTCOME_TYPE>> AnnotationStatisticsCompact<OUTCOME_TYPE>
addAll(
       Iterable<AnnotationStatisticsCompact<OUTCOME_TYPE>> statistics) {
-    AnnotationStatisticsCompact<OUTCOME_TYPE> result = new AnnotationStatisticsCompact<OUTCOME_TYPE>();
+    AnnotationStatisticsCompact<OUTCOME_TYPE> result = new AnnotationStatisticsCompact<>();
     for (AnnotationStatisticsCompact<OUTCOME_TYPE> item : statistics) {
       result.addAll(item);
     }
@@ -140,7 +140,7 @@ public class AnnotationStatisticsCompact
     this.referenceOutcomes = HashMultiset.create();
     this.predictedOutcomes = HashMultiset.create();
     this.correctOutcomes = HashMultiset.create();
-    this.confusionMatrix = new ConfusionMatrix<OUTCOME_TYPE>();
+    this.confusionMatrix = new ConfusionMatrix<>();
   }
 
   /**
@@ -192,13 +192,13 @@ public class AnnotationStatisticsCompact
       Function<ANNOTATION_TYPE, OUTCOME_TYPE> annotationToOutcome) {
 
     // map gold spans to their outcomes
-    Map<SPAN_TYPE, OUTCOME_TYPE> referenceSpanOutcomes = new HashMap<SPAN_TYPE,
OUTCOME_TYPE>();
+    Map<SPAN_TYPE, OUTCOME_TYPE> referenceSpanOutcomes = new HashMap<>();
     for (ANNOTATION_TYPE ann : referenceAnnotations) {
       referenceSpanOutcomes.put(annotationToSpan.apply(ann), annotationToOutcome.apply(ann));
     }
 
     // map system spans to their outcomes
-    Map<SPAN_TYPE, OUTCOME_TYPE> predictedSpanOutcomes = new HashMap<SPAN_TYPE,
OUTCOME_TYPE>();
+    Map<SPAN_TYPE, OUTCOME_TYPE> predictedSpanOutcomes = new HashMap<>();
     for (ANNOTATION_TYPE ann : predictedAnnotations) {
       predictedSpanOutcomes.put(annotationToSpan.apply(ann), annotationToOutcome.apply(ann));
     }
@@ -208,7 +208,7 @@ public class AnnotationStatisticsCompact
     this.predictedOutcomes.addAll(predictedSpanOutcomes.values());
 
     // determine the outcomes that were correct
-    Set<SPAN_TYPE> intersection = new HashSet<SPAN_TYPE>();
+    Set<SPAN_TYPE> intersection = new HashSet<>();
     intersection.addAll(referenceSpanOutcomes.keySet());
     intersection.retainAll(predictedSpanOutcomes.keySet());
     for (SPAN_TYPE span : intersection) {
@@ -220,7 +220,7 @@ public class AnnotationStatisticsCompact
     }
 
     // update the confusion matrix
-    Set<SPAN_TYPE> union = new HashSet<SPAN_TYPE>();
+    Set<SPAN_TYPE> union = new HashSet<>();
     union.addAll(referenceSpanOutcomes.keySet());
     union.addAll(predictedSpanOutcomes.keySet());
     for (SPAN_TYPE span : union) {
@@ -412,7 +412,7 @@ public class AnnotationStatisticsCompact
         this.referenceOutcomes.size(),
         this.predictedOutcomes.size(),
         this.correctOutcomes.size()));
-    List<OUTCOME_TYPE> outcomes = new ArrayList<OUTCOME_TYPE>(this.referenceOutcomes.elementSet());
+    List<OUTCOME_TYPE> outcomes = new ArrayList<>(this.referenceOutcomes.elementSet());
     if (outcomes.size() > 1) {
       Collections.sort(outcomes);
       for (OUTCOME_TYPE outcome : outcomes) {
@@ -437,7 +437,7 @@ public class AnnotationStatisticsCompact
 			"All",this.precision(),
 			"All",this.recall(),
 			"All",this.f1()));
-	List<OUTCOME_TYPE> outcomes = new ArrayList<OUTCOME_TYPE>(this.referenceOutcomes.elementSet());
+	List<OUTCOME_TYPE> outcomes = new ArrayList<>(this.referenceOutcomes.elementSet());
 	if (outcomes.size() > 1) {
 		Collections.sort(outcomes);
 		for (OUTCOME_TYPE outcome : outcomes) {

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java?rev=1639534&r1=1639533&r2=1639534&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java
Thu Nov 13 21:45:31 2014
@@ -219,7 +219,7 @@ public class MergeGoldViewFromOneCasInto
 	}
 
 	private static JCas getJcas(File f) {
-		List<File> list = new ArrayList<File>();
+		List<File> list = new ArrayList<>();
 		list.add(f);
 		CollectionReader cr;
 		AggregateBuilder builder;
@@ -241,7 +241,7 @@ public class MergeGoldViewFromOneCasInto
 			//SimplePipeline.runPipeline(cr, builder.createEngine());
 			AnalysisEngine engine = builder.createAggregate();
 
-			final List<ResourceMetaData> metaData = new ArrayList<ResourceMetaData>();
+			final List<ResourceMetaData> metaData = new ArrayList<>();
 			metaData.add(cr.getMetaData());
 			metaData.add(engine.getMetaData());
 			

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/XMIReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/XMIReader.java?rev=1639534&r1=1639533&r2=1639534&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/XMIReader.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/XMIReader.java
Thu Nov 13 21:45:31 2014
@@ -72,14 +72,11 @@ public class XMIReader extends JCasColle
 
 @Override
   public void getNext(JCas jCas) throws IOException, CollectionException {
-    FileInputStream inputStream = new FileInputStream(this.filesIter.next());
-    try {
+	try(FileInputStream inputStream = new FileInputStream(this.filesIter.next())){
       XmiCasDeserializer.deserialize(new BufferedInputStream(inputStream), jCas.getCas());
     } catch (SAXException e) {
-      inputStream.close();
       throw new CollectionException(e);
     }
-    inputStream.close();
     this.completed += 1;
   }
 



Mime
View raw message