ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1517832 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
Date Tue, 27 Aug 2013 14:39:06 GMT
Author: dligach
Date: Tue Aug 27 14:39:06 2013
New Revision: 1517832

URL: http://svn.apache.org/r1517832
Log:
using jcas directly instead of system view

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java?rev=1517832&r1=1517831&r2=1517832&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
Tue Aug 27 14:39:06 2013
@@ -1,21 +1,3 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 package org.apache.ctakes.temporal.data.analysis;
 
 import java.io.File;
@@ -30,13 +12,10 @@ import java.util.Map;
 import org.apache.ctakes.relationextractor.eval.XMIReader;
 import org.apache.ctakes.typesystem.type.structured.DocumentID;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
-import org.apache.ctakes.typesystem.type.syntax.TreebankNode;
 import org.apache.ctakes.typesystem.type.textsem.SignSymptomMention;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.cas.CAS;
-import org.apache.uima.cas.CASException;
 import org.apache.uima.collection.CollectionReader;
 import org.apache.uima.jcas.JCas;
 import org.cleartk.util.Options_ImplBase;
@@ -52,7 +31,7 @@ import com.google.common.base.Functions;
 import com.google.common.collect.Ordering;
 
 /**
- * ...
+ * Extract durations of signs/symptoms.
  * 
  * @author dmitriy dligach
  */
@@ -89,24 +68,18 @@ public class SignSymptomDurations {
     @Override
     public void process(JCas jCas) throws AnalysisEngineProcessException {
 
-      JCas systemView;
-      try {
-        systemView = jCas.getView(CAS.NAME_DEFAULT_SOFA);
-      } catch (CASException e) {
-        throw new AnalysisEngineProcessException(e);
-      }   
-
-      Collection<DocumentID> ids = JCasUtil.select(systemView, DocumentID.class);
+      Collection<DocumentID> ids = JCasUtil.select(jCas, DocumentID.class);
       String fileName = ids.iterator().next().getDocumentID();
       String signSymptomText = fileName.split("\\.")[0]; // e.g. "smoker.txt"
 
-      for(SignSymptomMention signSymptomMention : JCasUtil.select(systemView, SignSymptomMention.class))
{
+      for(SignSymptomMention signSymptomMention : JCasUtil.select(jCas, SignSymptomMention.class))
{
 
         if(signSymptomMention.getCoveredText().equals(signSymptomText)) {
+          // distances to time expressions from this sign/symptom
           Map<TimeMention, Integer> distances = new HashMap<TimeMention, Integer>();
 
-          for(TimeMention timeMention : JCasUtil.selectFollowing(systemView, TimeMention.class,
signSymptomMention, 1)) {
-            int distance = JCasUtil.selectBetween(systemView, BaseToken.class, signSymptomMention,
timeMention).size();
+          for(TimeMention timeMention : JCasUtil.selectFollowing(jCas, TimeMention.class,
signSymptomMention, 1)) {
+            int distance = JCasUtil.selectBetween(jCas, BaseToken.class, signSymptomMention,
timeMention).size();
             distances.put(timeMention, distance);
           }
 



Mime
View raw message