ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1632103 - in /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk: ./ extractors/
Date Wed, 15 Oct 2014 16:02:45 GMT
Author: tmill
Date: Wed Oct 15 16:02:45 2014
New Revision: 1632103

URL: http://svn.apache.org/r1632103
Log:
Corrected a bunch of type issues in assertion inherited from parent class.

Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/GenericCleartkAnalysisEngine.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/HistoryCleartkAnalysisEngine.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/PolarityFedaCleartkAnalysisEngine.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ExtractorListFeatureFunctionConverter.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/NegationDependencyFeatureExtractor.java

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/GenericCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/GenericCleartkAnalysisEngine.java?rev=1632103&r1=1632102&r2=1632103&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/GenericCleartkAnalysisEngine.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/GenericCleartkAnalysisEngine.java
Wed Oct 15 16:02:45 2014
@@ -65,7 +65,7 @@ public class GenericCleartkAnalysisEngin
 //				new CleartkExtractor(
 //						IdentifiedAnnotation.class, new GenericFeaturesExtractor()) );
 		if(this.entityFeatureExtractors == null){
-			this.entityFeatureExtractors = new ArrayList<FeatureExtractor1>();
+			this.entityFeatureExtractors = new ArrayList<>();
 		}
 		this.entityFeatureExtractors.add(new ContextWordWindowExtractor("org/apache/ctakes/assertion/models/generic.txt"));
 		this.entityFeatureExtractors.add(new GenericFeaturesExtractor());

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/HistoryCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/HistoryCleartkAnalysisEngine.java?rev=1632103&r1=1632102&r2=1632103&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/HistoryCleartkAnalysisEngine.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/HistoryCleartkAnalysisEngine.java
Wed Oct 15 16:02:45 2014
@@ -67,7 +67,7 @@ public class HistoryCleartkAnalysisEngin
 //						IdentifiedAnnotation.class, new HistoryFeaturesExtractor()) );
 //		
 		if(this.entityFeatureExtractors == null){
-			this.entityFeatureExtractors = new ArrayList<FeatureExtractor1>();
+			this.entityFeatureExtractors = new ArrayList<>();
 		}
 		this.entityFeatureExtractors.add(new ContextWordWindowExtractor("org/apache/ctakes/assertion/models/history.txt"));
 		this.entityFeatureExtractors.add(new HistoryFeaturesExtractor());

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=1632103&r1=1632102&r2=1632103&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
Wed Oct 15 16:02:45 2014
@@ -54,7 +54,7 @@ public class PolarityCleartkAnalysisEngi
 		probabilityOfKeepingADefaultExample = 1.0; //0.1;
 		
 		if(this.entityFeatureExtractors == null){
-			this.entityFeatureExtractors = new ArrayList<FeatureExtractor1>();
+			this.entityFeatureExtractors = new ArrayList<>();
 		}
 		
 		// polarity keyword list:
@@ -64,7 +64,8 @@ public class PolarityCleartkAnalysisEngi
 		
 		// stk frags feature:
 		if(featConfig == FEATURE_CONFIG.STK_FRAGS || featConfig == FEATURE_CONFIG.ALL_SYN){
-		  this.entityFeatureExtractors.add(new AboveLeftFragmentExtractor("AL_Polarity","org/apache/ctakes/assertion/models/jbi_paper_polarity_sems_frags.txt"));
+//		  this.entityFeatureExtractors.add(new AboveLeftFragmentExtractor("AL_Polarity","org/apache/ctakes/assertion/models/jbi_paper_polarity_sems_frags.txt"));
+		  this.entityFeatureExtractors.add(new AboveLeftFragmentExtractor("AL_Polarity","org/apache/ctakes/assertion/models/sharpPolarityFrags.txt"));
 //		  this.entityFeatureExtractors.add(new ConceptModifierPETFragmentExtractor("NegRel",
"org/apache/ctakes/assertion/models/polarityRelnFragsStrat.txt"));
 		}
 		

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityFedaCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityFedaCleartkAnalysisEngine.java?rev=1632103&r1=1632102&r2=1632103&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityFedaCleartkAnalysisEngine.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityFedaCleartkAnalysisEngine.java
Wed Oct 15 16:02:45 2014
@@ -34,22 +34,18 @@ import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.cleartk.ml.Instance;
-import org.cleartk.ml.feature.extractor.FeatureExtractor1;
 import org.cleartk.ml.feature.function.FeatureFunctionExtractor;
 
 
 public class PolarityFedaCleartkAnalysisEngine extends PolarityCleartkAnalysisEngine {
 
-	public static final String NEGATED = "NEGATED";
-	public static final String NOT_NEGATED = "NOT_NEGATED";
-
 	@Override
 	public void initialize(UimaContext context) throws ResourceInitializationException {
 		super.initialize(context);
 		probabilityOfKeepingADefaultExample = 1.0; //0.1;
 
 		if(this.entityFeatureExtractors == null){
-			this.entityFeatureExtractors = new ArrayList<FeatureExtractor1>();
+			this.entityFeatureExtractors = new ArrayList<>();
 		}
 		this.entityFeatureExtractors.add(new NegationDependencyFeatureExtractor());
 		this.entityFeatureExtractors.add(new ContextWordWindowExtractor("org/apache/ctakes/assertion/models/polarity.txt"));
@@ -96,7 +92,7 @@ public class PolarityFedaCleartkAnalysis
 	      }
 	}
 	public static FeatureSelection<String> createFeatureSelection(double threshold) {
-		return new Chi2FeatureSelection<String>(AssertionCleartkAnalysisEngine.FEATURE_SELECTION_NAME,
threshold, false);
+		return new Chi2FeatureSelection<>(AssertionCleartkAnalysisEngine.FEATURE_SELECTION_NAME,
threshold, false);
 		//		  return new MutualInformationFeatureSelection<String>(AssertionCleartkAnalysisEngine.FEATURE_SELECTION_NAME);
 	}
 
@@ -106,20 +102,20 @@ public class PolarityFedaCleartkAnalysis
 
 	private void initializeDomainAdaptation() {
 		// Do domain adaptation
-		featureFunctionExtractors = new ArrayList<FeatureFunctionExtractor>();
+		featureFunctionExtractors = new ArrayList<>();
 		//			FedaFeatureFunction ff = new FedaFeatureFunction(new ArrayList<String>(trainFileToDomain.values()));
 		featureFunctionExtractors.addAll(ExtractorListFeatureFunctionConverter.convert(contextFeatureExtractors,
ffDomainAdaptor));
 		featureFunctionExtractors.addAll(ExtractorListFeatureFunctionConverter.convert(tokenContextFeatureExtractors,
ffDomainAdaptor));
 		featureFunctionExtractors.addAll(ExtractorListFeatureFunctionConverter.convert(tokenCleartkExtractors,
ffDomainAdaptor));
 		featureFunctionExtractors.addAll(ExtractorListFeatureFunctionConverter.convert(entityFeatureExtractors,
ffDomainAdaptor));
-		featureFunctionExtractors.add(new FeatureFunctionExtractor(cuePhraseInWindowExtractor,
ffDomainAdaptor));
+		featureFunctionExtractors.add(new FeatureFunctionExtractor<>(cuePhraseInWindowExtractor,
ffDomainAdaptor));
 	}
 	@Override
 	protected void initializeFeatureSelection() throws ResourceInitializationException {
 	    if (featureSelectionThreshold == 0) {
 	    	this.featureSelection = null;
 	    } else {
-	    	this.featureSelection = this.createFeatureSelection(this.featureSelectionThreshold);
+	    	this.featureSelection = createFeatureSelection(this.featureSelectionThreshold);
 
 //	    	if ( (new File(this.featureSelectionURI)).exists() ) {
 //	    		try {

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ExtractorListFeatureFunctionConverter.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ExtractorListFeatureFunctionConverter.java?rev=1632103&r1=1632102&r2=1632103&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ExtractorListFeatureFunctionConverter.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ExtractorListFeatureFunctionConverter.java
Wed Oct 15 16:02:45 2014
@@ -21,18 +21,19 @@ package org.apache.ctakes.assertion.medf
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.ml.feature.extractor.FeatureExtractor1;
 import org.cleartk.ml.feature.function.FeatureFunction;
 import org.cleartk.ml.feature.function.FeatureFunctionExtractor;
 
 public class ExtractorListFeatureFunctionConverter {
-	public static List<FeatureFunctionExtractor> convert( List<? extends FeatureExtractor1>
extractors, FeatureFunction ff ) {
+	public static <T extends Annotation> List<FeatureFunctionExtractor<T>>
convert( List<? extends FeatureExtractor1<T>> extractors, FeatureFunction ff )
{
 
-		List<FeatureFunctionExtractor> featureFunctionExtractors = new ArrayList<FeatureFunctionExtractor>();
+		List<FeatureFunctionExtractor<T>> featureFunctionExtractors = new ArrayList<>();
 		if (null!=extractors) {
-			for (FeatureExtractor1 extractor : extractors) {
+			for (FeatureExtractor1<T> extractor : extractors) {
 				featureFunctionExtractors.add(
-						new FeatureFunctionExtractor(extractor,ff)
+						new FeatureFunctionExtractor<>(extractor,ff)
 						);
 			}
 		}

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/NegationDependencyFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/NegationDependencyFeatureExtractor.java?rev=1632103&r1=1632102&r2=1632103&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/NegationDependencyFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/NegationDependencyFeatureExtractor.java
Wed Oct 15 16:02:45 2014
@@ -24,16 +24,16 @@ import java.util.List;
 import org.apache.ctakes.assertion.util.NegationManualDepContextAnalyzer;
 import org.apache.ctakes.dependency.parser.util.DependencyUtility;
 import org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.feature.extractor.CleartkExtractorException;
 import org.cleartk.ml.feature.extractor.FeatureExtractor1;
 
 public class NegationDependencyFeatureExtractor implements
-		FeatureExtractor1 {
+		FeatureExtractor1<IdentifiedAnnotation> {
 
 	NegationManualDepContextAnalyzer conAnal = null;
 
@@ -42,9 +42,9 @@ public class NegationDependencyFeatureEx
 	}
 	
 	@Override
-	public List<Feature> extract(JCas jcas, Annotation focusAnnotation)
+	public List<Feature> extract(JCas jcas, IdentifiedAnnotation focusAnnotation)
 			throws CleartkExtractorException {
-		List<Feature> feats = new ArrayList<Feature>();
+		List<Feature> feats = new ArrayList<>();
 		Sentence sent = null;
 		
 		List<Sentence> sents = JCasUtil.selectCovering(jcas, Sentence.class, focusAnnotation.getBegin(),
focusAnnotation.getEnd());



Mime
View raw message