ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1643472 - in /ctakes/branches/sent-detector-newline-fix/ctakes-core: .settings/ resources/launch/ src/main/java/org/apache/ctakes/core/ae/ src/main/java/org/apache/ctakes/core/cr/
Date Fri, 05 Dec 2014 23:34:10 GMT
Author: tmill
Date: Fri Dec  5 23:34:10 2014
New Revision: 1643472

URL: http://svn.apache.org/r1643472
Log:
Undo accidentally checked-in files not related to sentence issue.

Modified:
    ctakes/branches/sent-detector-newline-fix/ctakes-core/.settings/org.eclipse.core.resources.prefs
    ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector--train_a_new_model.launch
    ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector_annotator.launch
    ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/Tokenizer_annotator.launch
    ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CPE_GUI--core.launch
    ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CVD--core.launch
    ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/DocumentIdPrinterAnalysisEngine.java
    ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
    ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/cr/FilesInDirectoryCollectionReader.java

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/.settings/org.eclipse.core.resources.prefs
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/.settings/org.eclipse.core.resources.prefs?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/.settings/org.eclipse.core.resources.prefs
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/.settings/org.eclipse.core.resources.prefs
Fri Dec  5 23:34:10 2014
@@ -1,4 +1,5 @@
 eclipse.preferences.version=1
 encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
 encoding//src/test/java=UTF-8
 encoding/<project>=UTF-8

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector--train_a_new_model.launch
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector--train_a_new_model.launch?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector--train_a_new_model.launch
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector--train_a_new_model.launch
Fri Dec  5 23:34:10 2014
@@ -2,7 +2,7 @@
 <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
 <stringAttribute key="bad_container_name" value="\core\resources\launch\SentenceDetector
- argument checking"/>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SentenceDetector.java"/>
+<listEntry value="/ctakes-core/src/main/java/org/apache/ctakes/ctakes-core/ae/SentenceDetector.java"/>
 </listAttribute>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
 <listEntry value="1"/>
@@ -10,7 +10,7 @@
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.ctakes.core.ae.SentenceDetector"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="/home/tmill/mnt/rc-pub/resources/corpora/sentence-training/finished/all_finished.train&#13;&#10;../ctakes-core-res/src/main/resources/org/apache/ctakes/core/sentdetect/sample_sd.mod&#13;&#10;100&#13;&#10;5"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="data/test/sample_sd_training_sentences.txt&#13;&#10;resources/sentdetect/sample_sd.mod&#13;&#10;100&#13;&#10;5"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-core"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
 </launchConfiguration>

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector_annotator.launch
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector_annotator.launch?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector_annotator.launch
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/SentenceDetector_annotator.launch
Fri Dec  5 23:34:10 2014
@@ -11,5 +11,5 @@
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.uima.tools.cpm.CpmFrame"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-core"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms500M -Xmx500M"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms500M -Xmx3g"/>
 </launchConfiguration>

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/Tokenizer_annotator.launch
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/Tokenizer_annotator.launch?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/Tokenizer_annotator.launch
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/Tokenizer_annotator.launch
Fri Dec  5 23:34:10 2014
@@ -11,5 +11,5 @@
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.uima.tools.cpm.CpmFrame"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-core"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms500M -Xmx500M"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms500M -Xmx3g"/>
 </launchConfiguration>

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CPE_GUI--core.launch
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CPE_GUI--core.launch?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CPE_GUI--core.launch
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CPE_GUI--core.launch
Fri Dec  5 23:34:10 2014
@@ -24,5 +24,5 @@
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.uima.tools.cpm.CpmFrame"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-core"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms500M -Xmx500M"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms500M -Xmx3g"/>
 </launchConfiguration>

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CVD--core.launch
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CVD--core.launch?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CVD--core.launch
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/resources/launch/UIMA_CVD--core.launch
Fri Dec  5 23:34:10 2014
@@ -13,5 +13,5 @@
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.uima.tools.annot_view.Gladis"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-core"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="&quot;-Djava.util.logging.config.file=${env_var:UIMA_HOME}/Logger.properties&quot;
 -Xms500M -Xmx500M"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="&quot;-Djava.util.logging.config.file=${env_var:UIMA_HOME}/Logger.properties&quot;
 -Xms500M -Xmx3g"/>
 </launchConfiguration>

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/DocumentIdPrinterAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/DocumentIdPrinterAnalysisEngine.java?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/DocumentIdPrinterAnalysisEngine.java
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/DocumentIdPrinterAnalysisEngine.java
Fri Dec  5 23:34:10 2014
@@ -36,7 +36,7 @@ public class DocumentIdPrinterAnalysisEn
     String documentId = DocumentIDAnnotationUtil.getDocumentID(jcas);
     String logMessage = String.format("##### current file document id: \"%s\"", documentId);
     logger.info(logMessage);
-//    System.out.println(logMessage);
+    System.out.println(logMessage);
   }
 
 }

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
Fri Dec  5 23:34:10 2014
@@ -41,7 +41,6 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.refsem.Date;
 import org.apache.ctakes.typesystem.type.refsem.Event;
 import org.apache.ctakes.typesystem.type.refsem.EventProperties;
-import org.apache.ctakes.typesystem.type.refsem.LabDeltaFlag;
 import org.apache.ctakes.typesystem.type.refsem.LabReferenceRange;
 import org.apache.ctakes.typesystem.type.refsem.LabValue;
 import org.apache.ctakes.typesystem.type.refsem.MedicationDosage;
@@ -60,14 +59,10 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.relation.AspectualTextRelation;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.relation.ComplicatesDisruptsTextRelation;
-import org.apache.ctakes.typesystem.type.relation.ContraindicatesTextRelation;
 import org.apache.ctakes.typesystem.type.relation.DegreeOfTextRelation;
-import org.apache.ctakes.typesystem.type.relation.DiagnosesTextRelation;
-import org.apache.ctakes.typesystem.type.relation.IndicatesTextRelation;
 import org.apache.ctakes.typesystem.type.relation.LocationOfTextRelation;
 import org.apache.ctakes.typesystem.type.relation.ManagesTreatsTextRelation;
 import org.apache.ctakes.typesystem.type.relation.ManifestationOfTextRelation;
-import org.apache.ctakes.typesystem.type.relation.PreventsTextRelation;
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.relation.ResultOfTextRelation;
 import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
@@ -83,7 +78,6 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.textsem.GenericModifier;
 import org.apache.ctakes.typesystem.type.textsem.HistoryOfModifier;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
-import org.apache.ctakes.typesystem.type.textsem.LabDeltaFlagModifier;
 import org.apache.ctakes.typesystem.type.textsem.LabEstimatedModifier;
 import org.apache.ctakes.typesystem.type.textsem.LabInterpretationModifier;
 import org.apache.ctakes.typesystem.type.textsem.LabMention;
@@ -160,7 +154,7 @@ public class SHARPKnowtatorXMLReader ext
   /**
    * Get the URI that the text in this class was loaded from
    */
-  protected URI getTextURI(JCas jCas) {
+  protected URI getTextURI(JCas jCas) throws AnalysisEngineProcessException {
     String textPath = JCasUtil.selectSingle(jCas, DocumentID.class).getDocumentID();
     if (this.textDirectory != null) {
       textPath = this.textDirectory + File.separator + textPath;
@@ -182,18 +176,13 @@ public class SHARPKnowtatorXMLReader ext
    * @throws URISyntaxException 
    */
   protected URI getKnowtatorURI(JCas jCas) throws AnalysisEngineProcessException {
-    File textURI = new File(this.getTextURI(jCas));
-    String filename = textURI.getName().replace(".txt", "");
-    
-    File xmlPath = new File(textURI.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile(),
"by-document/" + filename + "/" + filename + ".umls.knowtator.xml");
-    
-//    String xmlURI = textURI.replaceAll("Knowtator[/\\\\]text", "Knowtator_XML") + ".knowtator.xml";
-//    File fileTest = new File(URI.create(xmlURI));
-//    if(!fileTest.exists()){
-//      xmlURI = xmlURI.replace("_XML", " XML");
-//    }
-//    return URI.create(xmlPath.getAbsolutePath());
-    return UriUtils.create("file:" + xmlPath.getAbsolutePath());
+    String textURI = this.getTextURI(jCas).toString();
+    String xmlURI = textURI.replaceAll("Knowtator[/\\\\]text", "Knowtator_XML") + ".knowtator.xml";
+    File fileTest = new File(URI.create(xmlURI));
+    if(!fileTest.exists()){
+      xmlURI = xmlURI.replace("_XML", " XML");
+    }
+    return UriUtils.create(xmlURI);
   }
 
   /**
@@ -240,7 +229,6 @@ public class SHARPKnowtatorXMLReader ext
     entityRelationTypes.add("location_of");
     entityRelationTypes.add("manages/treats");
     entityRelationTypes.add("manifestation_of"); // note the misspelling
-    entityRelationTypes.add("prevents");
     entityRelationTypes.add("result_of");
     Set<String> eventRelationTypes = new HashSet<String>();
     eventRelationTypes.add("TLINK");
@@ -286,7 +274,6 @@ public class SHARPKnowtatorXMLReader ext
         AnatomicalSiteMention mention = new AnatomicalSiteMention(jCas, coveringSpan.begin,
coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_ANATOMICAL_SITE,
@@ -294,8 +281,7 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
         KnowtatorAnnotation bodyLaterality = annotationSlots.remove("body_laterality");
         delayedFeatures.add(new DelayedFeature(mention, "bodyLaterality", bodyLaterality));
         KnowtatorAnnotation bodySide = annotationSlots.remove("body_side");
@@ -305,7 +291,6 @@ public class SHARPKnowtatorXMLReader ext
         EventMention mention = new EventMention(jCas, coveringSpan.begin, coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_CLINICAL_ATTRIBUTE,
@@ -313,18 +298,12 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
 
       } else if ("Devices".equals(annotation.type)) {
-        if(coveringSpan.begin < 0 || coveringSpan.end < 0){
-          LOGGER.error(String.format("Device annotation (id=%s) has invalid span [%d,%d]",
annotation.id, coveringSpan.begin, coveringSpan.end)); 
-          continue;
-        }
         EntityMention mention = new EntityMention(jCas, coveringSpan.begin, coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_DEVICE,
@@ -332,14 +311,12 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
 
       } else if ("Disease_Disorder".equals(annotation.type)) {
         DiseaseDisorderMention mention = new DiseaseDisorderMention(jCas, coveringSpan.begin,
coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_DISORDER,
@@ -347,8 +324,7 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
         KnowtatorAnnotation alleviatingFactor = annotationSlots.remove("alleviating_factor");
         delayedFeatures.add(DelayedRelationFeature.forArg2(
             mention,
@@ -400,7 +376,6 @@ public class SHARPKnowtatorXMLReader ext
         LabMention mention = new LabMention(jCas, coveringSpan.begin, coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_LAB,
@@ -408,8 +383,7 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
         KnowtatorAnnotation ordinal = annotationSlots.remove("ordinal_interpretation");
         delayedFeatures.add(DelayedRelationFeature.forArg1(
             mention,
@@ -426,13 +400,11 @@ public class SHARPKnowtatorXMLReader ext
             labValue,
             ResultOfTextRelation.class,
             LabValueModifier.class));
-        KnowtatorAnnotation deltaFlag = annotationSlots.remove("delta_flag");
-        delayedFeatures.add(new DelayedFeature(mention, "deltaFlag", deltaFlag));
+
       } else if ("Medications/Drugs".equals(annotation.type)) {
         MedicationMention mention = new MedicationMention(jCas, coveringSpan.begin, coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_DRUG,
@@ -440,8 +412,7 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
         KnowtatorAnnotation allergy = annotationSlots.remove("allergy_indicator");
         delayedFeatures.add(new DelayedFeature(mention, "medicationAllergy", allergy));
         KnowtatorAnnotation changeStatus = annotationSlots.remove("change_status_model");
@@ -458,8 +429,6 @@ public class SHARPKnowtatorXMLReader ext
         delayedFeatures.add(new DelayedFeature(mention, "medicationRoute", route));
         KnowtatorAnnotation startDate = annotationSlots.remove("start_date");
         delayedFeatures.add(new DelayedFeature(mention, "startDate", startDate));
-        KnowtatorAnnotation endDate = annotationSlots.remove("end_date");
-        delayedFeatures.add(new DelayedFeature(mention, "endDate", endDate));
         KnowtatorAnnotation strength = annotationSlots.remove("strength_model");
         delayedFeatures.add(new DelayedFeature(mention, "medicationStrength", strength));
 
@@ -467,7 +436,6 @@ public class SHARPKnowtatorXMLReader ext
         EventMention mention = new EventMention(jCas, coveringSpan.begin, coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_PHENOMENA,
@@ -475,14 +443,12 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
 
       } else if ("Procedure".equals(annotation.type)) {
         ProcedureMention mention = new ProcedureMention(jCas, coveringSpan.begin, coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_PROCEDURE,
@@ -490,8 +456,7 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
         KnowtatorAnnotation bodyLaterality = annotationSlots.remove("body_laterality");
         delayedFeatures.add(new DelayedFeature(mention, "bodyLaterality", bodyLaterality));
         KnowtatorAnnotation bodyLocation = annotationSlots.remove("body_location");
@@ -512,7 +477,6 @@ public class SHARPKnowtatorXMLReader ext
         SignSymptomMention mention = new SignSymptomMention(jCas, coveringSpan.begin, coveringSpan.end);
         addIdentifiedAnnotationFeatures(
             annotation,
-            knowtatorURI,
             mention,
             jCas,
             CONST.NE_TYPE_ID_FINDING,
@@ -520,8 +484,7 @@ public class SHARPKnowtatorXMLReader ext
             booleanSlots,
             annotationSlots,
             idAnnotationMap,
-            delayedFeatures,
-            delayedRelations);
+            delayedFeatures);
         KnowtatorAnnotation alleviatingFactor = annotationSlots.remove("alleviating_factor");
         delayedFeatures.add(DelayedRelationFeature.forArg2(
             mention,
@@ -882,16 +845,7 @@ public class SHARPKnowtatorXMLReader ext
         modifier.setNormalizedForm(attribute);
         modifier.addToIndexes();
         idAnnotationMap.put(annotation.id, modifier);
-      } else if ("delta_flag_indicator".equals(annotation.type)) {
-        String value = stringSlots.remove("delta_flag_normalization");
-        LabDeltaFlagModifier modifier = new LabDeltaFlagModifier(jCas, coveringSpan.begin,
coveringSpan.end);
-        LabDeltaFlag attribute = new LabDeltaFlag(jCas);
-        attribute.setValue(value);
-        attribute.addToIndexes();
-//        modifier.setValue(value)
-        modifier.setNormalizedForm(attribute);
-        modifier.addToIndexes();
-        idAnnotationMap.put(annotation.id, modifier);
+
       } else if ("Value".equals(annotation.type)) {
         KnowtatorAnnotation unit = annotationSlots.remove("value_unit");
         KnowtatorAnnotation number = annotationSlots.remove("value_number");
@@ -1016,23 +970,18 @@ public class SHARPKnowtatorXMLReader ext
         KnowtatorAnnotation unit = annotationSlots.remove("strength_unit");
         KnowtatorAnnotation number = annotationSlots.remove("strength_number");
         MedicationStrength attribute = new MedicationStrength(jCas);
-        int spanStart=text.length()-1,spanEnd=0;  // the strength annotation is spanless
so we get the modifier span by its components
         if (unit != null) {
           KnowtatorAnnotation.Span unitSpan = unit.getCoveringSpan();
           String unitString = text.substring(unitSpan.begin, unitSpan.end);
           attribute.setUnit(unitString);
-          if(unitSpan.begin < spanStart) spanStart = unitSpan.begin;
-          if(unitSpan.end > spanEnd) spanEnd = unitSpan.end;
         }
         if (number != null) {
           KnowtatorAnnotation.Span numberSpan = number.getCoveringSpan();
           String numberString = text.substring(numberSpan.begin, numberSpan.end);
           attribute.setNumber(numberString);
-          if(numberSpan.begin < spanStart) spanStart = numberSpan.begin;
-          if(numberSpan.end > spanEnd) spanEnd = numberSpan.end;
         }
         attribute.addToIndexes();
-        MedicationStrengthModifier modifier = new MedicationStrengthModifier(jCas, spanStart,
spanEnd);
+        MedicationStrengthModifier modifier = new MedicationStrengthModifier(jCas, coveringSpan.begin,
coveringSpan.end);
         modifier.setNormalizedForm(attribute);
         modifier.addToIndexes();
         idAnnotationMap.put(annotation.id, modifier);
@@ -1074,11 +1023,9 @@ public class SHARPKnowtatorXMLReader ext
       } else if ("Date".equals(annotation.type)) {
         String month = stringSlots.remove("month");
         String day = stringSlots.remove("day");
-        String year = stringSlots.remove("year");
         Date date = new Date(jCas);
         date.setMonth(month);
         date.setDay(day);
-        date.setYear(year);
         date.addToIndexes();
         TimeMention mention = new TimeMention(jCas, coveringSpan.begin, coveringSpan.end);
         mention.setDate(date);
@@ -1139,12 +1086,7 @@ public class SHARPKnowtatorXMLReader ext
 
     // all mentions should be added, so add features that required other annotations
     for (DelayedFeature delayedFeature : delayedFeatures) {
-      try{
       delayedFeature.setValueFrom(idAnnotationMap);
-      }catch(Exception e){
-        System.err.println("Exception reading input: " + e.getMessage());
-        e.printStackTrace(System.err);
-      }
     }
   }
   
@@ -1158,22 +1100,8 @@ public class SHARPKnowtatorXMLReader ext
     return String.format("%s(%s)", ann.getClass().getSimpleName(), result);
   }
   
-//  private static void addIdentifiedAnnotationFeatures(
-//      KnowtatorAnnotation annotation,
-//      final IdentifiedAnnotation mention,
-//      JCas jCas,
-//      int typeID,
-//      Map<String, String> stringSlots,
-//      Map<String, Boolean> booleanSlots,
-//      Map<String, KnowtatorAnnotation> annotationSlots,
-//      Map<String, TOP> idAnnotationMap,
-//      List<DelayedFeature> delayedFeatures) {
-//    addIdentifiedAnnotationFeatures(annotation, null, mention, jCas, typeID, stringSlots,
booleanSlots, annotationSlots, idAnnotationMap, delayedFeatures, null);
-//  }
-
   private static void addIdentifiedAnnotationFeatures(
       KnowtatorAnnotation annotation,
-      URI knowtatorURI,
       final IdentifiedAnnotation mention,
       JCas jCas,
       int typeID,
@@ -1181,8 +1109,7 @@ public class SHARPKnowtatorXMLReader ext
       Map<String, Boolean> booleanSlots,
       Map<String, KnowtatorAnnotation> annotationSlots,
       Map<String, TOP> idAnnotationMap,
-      List<DelayedFeature> delayedFeatures,
-      List<DelayedRelation> delayedRelations) {
+      List<DelayedFeature> delayedFeatures) {
     mention.setTypeID(typeID);
     mention.setConfidence(1.0f);
     mention.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);
@@ -1202,15 +1129,6 @@ public class SHARPKnowtatorXMLReader ext
     delayedFeatures.add(new DelayedFeatureFromFeature(mention, "historyOf", historyOf));
     KnowtatorAnnotation negationIndicator = annotationSlots.remove("negation_indicator_CU");
     delayedFeatures.add(new DelayedFeatureFromFeature(mention, "polarity", negationIndicator));
-    if(negationIndicator != null){
-      DelayedRelation polRel = new DelayedRelation();
-      polRel.source = negationIndicator;
-      polRel.target = annotation;
-      polRel.type = "polarityModifier";
-      polRel.sourceFile = knowtatorURI;
-      if(delayedRelations != null) delayedRelations.add(polRel);
-    }
-//    delayedFeatures.add(DelayedRelationFeature.forArg2(mention, "polarityModifier", negationIndicator,
BinaryTextRelation.class, PolarityModifier.class));
     KnowtatorAnnotation subject = annotationSlots.remove("subject_CU");
     delayedFeatures.add(new DelayedFeatureFromFeature(mention, "subject", subject) {
       @Override
@@ -1367,26 +1285,15 @@ public class SHARPKnowtatorXMLReader ext
       
       // add the relation to the CAS
       BinaryTextRelation relation = null;
-      if(this.annotation == null){
-        relation = new BinaryTextRelation(jCas);
-      } else if ("affects".equals(this.annotation.type)) {
+      if ("affects".equals(this.annotation.type)) {
         this.assertTypes(sourceMention, EventMention.class, targetMention, IdentifiedAnnotation.class);
         relation = new AffectsTextRelation(jCas);
       } else if ("complicates/disrupts".equals(this.annotation.type)) {
         this.assertTypes(sourceMention, EventMention.class, targetMention, EventMention.class);
         relation = new ComplicatesDisruptsTextRelation(jCas);
-      } else if ("contraindicates".equals(this.annotation.type)) {
-        this.assertTypes(sourceMention, IdentifiedAnnotation.class, targetMention, EventMention.class);
-        relation = new ContraindicatesTextRelation(jCas);
       } else if ("degree_of".equals(this.annotation.type)) {
         this.assertTypes(sourceMention, EventMention.class, targetMention, Modifier.class);
         relation = new DegreeOfTextRelation(jCas);
-      } else if ("diagnoses".equals(this.annotation.type)) {
-        this.assertTypes(sourceMention, EventMention.class, targetMention, IdentifiedAnnotation.class);
-        relation = new DiagnosesTextRelation(jCas);
-      } else if ("indicates".equals(this.annotation.type)) {
-        this.assertTypes(sourceMention, EventMention.class, targetMention, EventMention.class);
-        relation = new IndicatesTextRelation(jCas);
       } else if ("location_of".equals(this.annotation.type)) {
         if (!(targetMention instanceof AnatomicalSiteMention) && (sourceMention instanceof
AnatomicalSiteMention)) {
           // fix reversed arguments in manual annotations
@@ -1407,15 +1314,9 @@ public class SHARPKnowtatorXMLReader ext
         this.assertTypes(sourceMention, EventMention.class, targetMention, EventMention.class);
         relation = new ManifestationOfTextRelation(jCas);
         relation.setCategory("manifestation_of"); // fix typo in Knowtator type system
-      } else if ("prevents".equals(this.annotation.type)) {
-        this.assertTypes(sourceMention, EventMention.class, targetMention, EventMention.class);
-        relation = new PreventsTextRelation(jCas);
       } else if ("result_of".equals(this.annotation.type)) {
         this.assertTypes(sourceMention, EventMention.class, targetMention, IdentifiedAnnotation.class);
         relation = new ResultOfTextRelation(jCas);
-//      } else if ("prevents".equals(this.annotation.type)) {
-//        this.assertTypes(sourceMention, expectedSourceClass, targetMention, expectedTargetClass);
-//        relation = new PreventsTextRelation(jCas);
       } else if ("TLINK".equals(this.annotation.type)) {
         relation = new TemporalTextRelation(jCas);
         relation.setCategory(this.type);
@@ -1428,11 +1329,7 @@ public class SHARPKnowtatorXMLReader ext
       
       // set the relation cateory (if not already set)
       if (relation.getCategory() == null) {
-        if(this.type != null){
-          relation.setCategory(this.type);
-        }else{
-          relation.setCategory(this.annotation.type);
-        }
+        relation.setCategory(this.annotation.type);
       }
       
       // link the relation to its arguments and add it to the CAS
@@ -1447,7 +1344,7 @@ public class SHARPKnowtatorXMLReader ext
       relation.addToIndexes();
     
       // add the relation to the map so it can be used in features of other annotations
-      if(this.annotation != null) idAnnotationMap.put(this.annotation.id, relation);
+      idAnnotationMap.put(this.annotation.id, relation);
     }
     
     private void assertTypes(Annotation sourceMention, Class<? extends Annotation>
expectedSourceClass, Annotation targetMention, Class<? extends Annotation> expectedTargetClass)
{

Modified: ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/cr/FilesInDirectoryCollectionReader.java
URL: http://svn.apache.org/viewvc/ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/cr/FilesInDirectoryCollectionReader.java?rev=1643472&r1=1643471&r2=1643472&view=diff
==============================================================================
--- ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/cr/FilesInDirectoryCollectionReader.java
(original)
+++ ctakes/branches/sent-detector-newline-fix/ctakes-core/src/main/java/org/apache/ctakes/core/cr/FilesInDirectoryCollectionReader.java
Fri Dec  5 23:34:10 2014
@@ -138,7 +138,7 @@ public class FilesInDirectoryCollectionR
 	    	File[] files = directory.listFiles();
 	    	for (int i = 0; i < files.length; i++)
 	    	{
-	    		if (!files[i].isDirectory() && hasValidExtension(files[i]) && !files[i].isHidden())
+	    		if (!files[i].isDirectory() && hasValidExtension(files[i]))
 	    		{
 	    			iv_files.add(files[i]);  
 	    		}



Mime
View raw message