ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1637161 - in /ctakes/trunk: ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/polarity/sharpi2b2mipacqnegex/ ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/uncertainty/ ctakes-assertion/...
Date Thu, 06 Nov 2014 17:13:52 GMT
Author: tmill
Date: Thu Nov  6 17:13:52 2014
New Revision: 1637161

URL: http://svn.apache.org/r1637161
Log:
Modified assertion to use sentence-bounded feautres. Checked in polarity and uncertainty models
for this feature organization.

Modified:
    ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/polarity/sharpi2b2mipacqnegex/model.jar
    ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/uncertainty/model.jar
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java

Modified: ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/polarity/sharpi2b2mipacqnegex/model.jar
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/polarity/sharpi2b2mipacqnegex/model.jar?rev=1637161&r1=1637160&r2=1637161&view=diff
==============================================================================
Binary files - no diff available.

Modified: ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/uncertainty/model.jar
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/models/uncertainty/model.jar?rev=1637161&r1=1637160&r2=1637161&view=diff
==============================================================================
Binary files - no diff available.

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java?rev=1637161&r1=1637160&r2=1637161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java
Thu Nov  6 17:13:52 2014
@@ -396,23 +396,30 @@ public abstract class AssertionCleartkAn
           instance.addAll(extractor.extract(identifiedAnnotationView, entityMention));
         }
         */
+      List<Sentence> sents = new ArrayList<>(JCasUtil.selectCovering(jCas, Sentence.class,
entityOrEventMention.getBegin(), entityOrEventMention.getEnd()));
+      Sentence coveringSent = null;
+      if(sents.size() > 0){
+        coveringSent = sents.get(0);
+      }
       
       // only use extract this version if not doing domain adaptation 
       if (ffDomainAdaptor==null) {
     	  for (CleartkExtractor<IdentifiedAnnotation, BaseToken> extractor : this.tokenCleartkExtractors)
{
-    		  //instance.addAll(extractor.extractWithin(identifiedAnnotationView, entityMention,
sentence));
-    		  instance.addAll(extractor.extract(identifiedAnnotationView, entityOrEventMention));
+//    		  instance.addAll(extractor.extractWithin(identifiedAnnotationView, entityMention,
sentence));
+    		  if(coveringSent != null){
+    			  instance.addAll(extractor.extractWithin(identifiedAnnotationView, entityOrEventMention,
coveringSent));
+    		  }else{
+    			  instance.addAll(extractor.extract(identifiedAnnotationView, entityOrEventMention));
+    		  }
     	  }
       }
       
+      if(coveringSent != null){
 //      List<Feature> cuePhraseFeatures = null;
 //          cuePhraseInWindowExtractor.extract(jCas, entityOrEventMention);
           //cuePhraseInWindowExtractor.extractWithin(jCas, entityMention, firstCoveringSentence);
 //      List<Sentence> sents = new ArrayList<Sentence>(coveringSents.get(entityOrEventMention));
-      List<Sentence> sents = new ArrayList<>(JCasUtil.selectCovering(jCas, Sentence.class,
entityOrEventMention.getBegin(), entityOrEventMention.getEnd()));
-      if(sents.size() > 0){
-        Sentence sentence = sents.get(0);
-        List<AssertionCuePhraseAnnotation> cues = JCasUtil.selectCovered(AssertionCuePhraseAnnotation.class,
sentence);
+        List<AssertionCuePhraseAnnotation> cues = JCasUtil.selectCovered(AssertionCuePhraseAnnotation.class,
coveringSent);
         int closest = Integer.MAX_VALUE;
         AssertionCuePhraseAnnotation closestCue = null;
         for(AssertionCuePhraseAnnotation cue : cues){

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java?rev=1637161&r1=1637160&r2=1637161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java
Thu Nov  6 17:13:52 2014
@@ -71,7 +71,7 @@ public class PolarityCleartkAnalysisEngi
 		
 		if(featConfig == FEATURE_CONFIG.PTK_FRAGS || featConfig == FEATURE_CONFIG.DEP_REGEX_FRAGS
|| featConfig == FEATURE_CONFIG.ALL_SYN){
 //	     ptk frags feature:
-		  this.entityFeatureExtractors.add(new DependencyWordsFragmentExtractor("DW_Polarity",
"org/apache/ctakes/assertion/models/jbi_paper_polarity_dw_frags.txt"));		  
+//		  this.entityFeatureExtractors.add(new DependencyWordsFragmentExtractor("DW_Polarity",
"org/apache/ctakes/assertion/models/jbi_paper_polarity_dw_frags.txt"));		  
 		}
 
 		if(featConfig == FEATURE_CONFIG.DEP_REGEX || featConfig == FEATURE_CONFIG.DEP_REGEX_FRAGS
|| featConfig == FEATURE_CONFIG.ALL_SYN){

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java?rev=1637161&r1=1637160&r2=1637161&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java
Thu Nov  6 17:13:52 2014
@@ -18,13 +18,13 @@
  */
 package org.apache.ctakes.assertion.medfacts.cleartk;
 
+import static org.apache.ctakes.assertion.medfacts.cleartk.AssertionCleartkAnalysisEngine.FEATURE_CONFIG.ALL_SYN;
 import static org.apache.ctakes.assertion.medfacts.cleartk.AssertionCleartkAnalysisEngine.FEATURE_CONFIG.PTK;
 import static org.apache.ctakes.assertion.medfacts.cleartk.AssertionCleartkAnalysisEngine.FEATURE_CONFIG.PTK_FRAGS;
 import static org.apache.ctakes.assertion.medfacts.cleartk.AssertionCleartkAnalysisEngine.FEATURE_CONFIG.STK;
 import static org.apache.ctakes.assertion.medfacts.cleartk.AssertionCleartkAnalysisEngine.FEATURE_CONFIG.STK_FRAGS;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.net.URI;
 import java.util.ArrayList;
 
@@ -34,7 +34,6 @@ import org.apache.ctakes.assertion.medfa
 import org.apache.ctakes.assertion.medfacts.cleartk.extractors.AssertionAboveLeftTreeExtractor;
 import org.apache.ctakes.assertion.medfacts.cleartk.extractors.AssertionDependencyTreeExtractor;
 import org.apache.ctakes.assertion.medfacts.cleartk.extractors.ContextWordWindowExtractor;
-import org.apache.ctakes.assertion.medfacts.cleartk.extractors.DependencyPathRegexpFeatureExtractor;
 import org.apache.ctakes.assertion.medfacts.cleartk.extractors.DependencyWordsFragmentExtractor;
 import org.apache.ctakes.assertion.medfacts.cleartk.extractors.UncertaintyFeatureExtractor;
 import org.apache.ctakes.typesystem.type.constants.CONST;
@@ -52,7 +51,7 @@ public class UncertaintyCleartkAnalysisE
 	@Override
 	public void initialize(UimaContext context) throws ResourceInitializationException {
 		super.initialize(context);
-		probabilityOfKeepingADefaultExample = 0.5;
+		probabilityOfKeepingADefaultExample = 0.25;
 		if(this.entityFeatureExtractors == null){
 			this.entityFeatureExtractors = new ArrayList<>();
 		}
@@ -132,7 +131,7 @@ public class UncertaintyCleartkAnalysisE
   public static AnalysisEngineDescription createAnnotatorDescription(String modelPath) throws
ResourceInitializationException {
     return AnalysisEngineFactory.createEngineDescription(UncertaintyCleartkAnalysisEngine.class,
         AssertionCleartkAnalysisEngine.PARAM_FEATURE_CONFIG,
-        AssertionCleartkAnalysisEngine.FEATURE_CONFIG.DEP_REGEX,
+        AssertionCleartkAnalysisEngine.FEATURE_CONFIG.ALL_SYN,
         GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH,
         modelPath);
   }



Mime
View raw message