ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1814762 - in /ctakes/trunk: ctakes-core/src/main/java/org/apache/ctakes/core/patient/ ctakes-coreference/src/main/java/org/apache/ctakes/coreference/eval/ ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/
Date Thu, 09 Nov 2017 18:19:48 GMT
Author: tmill
Date: Thu Nov  9 18:19:47 2017
New Revision: 1814762

URL: http://svn.apache.org/viewvc?rev=1814762&view=rev
Log:
WIP: Fixes compiler error but coref eval still not working.

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/PatientNoteStore.java
    ctakes/trunk/ctakes-coreference/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfEventCoreference.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/PatientNoteStore.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/PatientNoteStore.java?rev=1814762&r1=1814761&r2=1814762&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/PatientNoteStore.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/PatientNoteStore.java
Thu Nov  9 18:19:47 2017
@@ -55,7 +55,7 @@ public enum PatientNoteStore {
     */
    synchronized public Collection<String> getCompletedPatientIds() {
       return _wantedDocCounts.entrySet().stream()
-            .filter( e -> _storedDocCounts.get( e.getKey() ).equals( e.getValue() ) )
+            .filter( e -> _storedDocCounts.getOrDefault( e.getKey(), 0 ).equals( e.getValue()
) )
             .map( Map.Entry::getKey )
             .collect( Collectors.toList() );
    }

Modified: ctakes/trunk/ctakes-coreference/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfEventCoreference.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-coreference/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfEventCoreference.java?rev=1814762&r1=1814761&r2=1814762&view=diff
==============================================================================
--- ctakes/trunk/ctakes-coreference/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfEventCoreference.java
(original)
+++ ctakes/trunk/ctakes-coreference/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfEventCoreference.java
Thu Nov  9 18:19:47 2017
@@ -27,6 +27,7 @@ import org.apache.ctakes.core.config.Con
 import org.apache.ctakes.core.patient.AbstractPatientConsumer;
 import org.apache.ctakes.core.patient.PatientNoteCollector;
 import org.apache.ctakes.core.patient.PatientNoteStore;
+import org.apache.ctakes.core.patient.PatientViewUtil;
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
 import org.apache.ctakes.core.resource.FileLocator;
 import org.apache.ctakes.core.util.DocumentIDAnnotationUtil;
@@ -1027,7 +1028,7 @@ public class EvaluationOfEventCoreferenc
     @Override
     protected void processPatientCas(JCas patientJcas) throws AnalysisEngineProcessException
{
 //      scorer.process(patientJcas);
-      for(JCas docView : notes.getDocumentViews(notes.getPreviousPatientName())){
+      for(JCas docView : PatientViewUtil.getDocumentViews(patientJcas)){
         scorer.process(docView);
       }
     }
@@ -1073,7 +1074,7 @@ public class EvaluationOfEventCoreferenc
 
     @Override
     protected void processPatientCas(JCas patientJcas) throws AnalysisEngineProcessException
{
-      for(JCas docView : notes.getDocumentViews(notes.getPreviousPatientName())){
+      for(JCas docView : PatientViewUtil.getDocumentViews(patientJcas)){
         delegate.process(docView);
       }
     }

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java?rev=1814762&r1=1814761&r2=1814762&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
Thu Nov  9 18:19:47 2017
@@ -61,6 +61,7 @@ import org.apache.ctakes.contexttokenize
 import org.apache.ctakes.core.ae.OverlapAnnotator;
 import org.apache.ctakes.core.ae.SentenceDetector;
 import org.apache.ctakes.core.ae.TokenizerAnnotatorPTB;
+import org.apache.ctakes.core.patient.PatientNoteStore;
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
 import org.apache.ctakes.core.resource.FileLocator;
 import org.apache.ctakes.dependency.parser.ae.ClearNLPDependencyParserAE;
@@ -87,6 +88,7 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Segment;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.ctakes.utils.struct.CounterMap;
 import org.apache.log4j.Logger;
 import org.apache.uima.UIMAException;
 import org.apache.uima.UimaContext;
@@ -127,6 +129,7 @@ import org.xml.sax.SAXException;
 import com.google.common.collect.Lists;
 import com.google.common.io.CharStreams;
 import com.lexicalscope.jewel.cli.Option;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
 
 //import org.apache.ctakes.core.cleartk.ae.SentenceDetectorAnnotator;
 //import org.threeten.bp.temporal.TemporalUnit;
@@ -437,23 +440,19 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 	protected CollectionReader getCollectionReader( List<Integer> patientSets ) throws
Exception {
 		List<File> collectedFiles = this.getFilesFor( patientSets );
 		Collections.sort(collectedFiles);
-		//      for(File file : collectedFiles){
-		//    	  System.err.println(file.getName());
-		//      }
-		/**
-       if(isTraining){
-       final Collection<File> filesToRemove = new HashSet<>();
-       for ( File xmiFile : collectedFiles ) {
-       String fname =  xmiFile.getName();
-       if(this.badNotes.contains(fname)){
-       LOGGER.error("Find Bad XMI file: "+fname);
-       filesToRemove.add( xmiFile );
-       }
-       }
-       collectedFiles.removeAll( filesToRemove );
-       }
-       isTraining = false;
-		 */
+
+		CounterMap<String> docCounts = new CounterMap<>();
+		for(File f : collectedFiles){
+			String ptidPrefix = null;
+			if(this.subcorpus == Subcorpus.Colon || this.subcorpus == Subcorpus.Brain){
+				ptidPrefix = f.getName().split("_")[0];
+			}else{
+				throw new UnsupportedOperationException("No prefix extraction method implemented in Evaluation_ImplBase
collection reader getter.");
+			}
+			docCounts.add(ptidPrefix);
+		}
+		docCounts.forEach((k,v) -> PatientNoteStore.getInstance().setDocCount(k, v));
+
 		return UriCollectionReader.getCollectionReaderFromFiles( collectedFiles );
 	}
 



Mime
View raw message