You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by st...@apache.org on 2013/01/29 04:51:14 UTC
svn commit: r1439742 -
/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java
Author: stevenbethard
Date: Tue Jan 29 03:51:13 2013
New Revision: 1439742
URL: http://svn.apache.org/viewvc?rev=1439742&view=rev
Log:
Allows relation extraction feature extractors to be overridden in subclasses
Modified:
incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java
Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java?rev=1439742&r1=1439741&r2=1439742&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java (original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java Tue Jan 29 03:51:13 2013
@@ -50,6 +50,8 @@ import org.apache.ctakes.typesystem.type
import org.apache.ctakes.typesystem.type.textspan.Sentence;
import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+import com.google.common.collect.Lists;
+
public abstract class RelationExtractorAnnotator extends CleartkAnnotator<String> {
public static final String NO_RELATION_CATEGORY = "-NONE-";
@@ -72,17 +74,24 @@ public abstract class RelationExtractorA
protected Random coin = new Random(0);
+ private List<RelationFeaturesExtractor> featureExtractors = this.getFeatureExtractors();
+
/**
- * The list of feature extractors used by the classifier.
+ * Defines the list of feature extractors used by the classifier.
+ * Subclasses may override this method to provide a different set of feature extractors.
+ *
+ * @return The list of feature extractors to use.
*/
- protected List<RelationFeaturesExtractor> featureExtractors = Arrays.<RelationFeaturesExtractor> asList(
- new TokenFeaturesExtractor(),
- new PartOfSpeechFeaturesExtractor(),
- new PhraseChunkingExtractor(),
- new NamedEntityFeaturesExtractor(),
- new DependencyTreeFeaturesExtractor(),
- new DependencyPathFeaturesExtractor()
- );
+ protected List<RelationFeaturesExtractor> getFeatureExtractors() {
+ return Lists.newArrayList(
+ new TokenFeaturesExtractor(),
+ new PartOfSpeechFeaturesExtractor(),
+ new PhraseChunkingExtractor(),
+ new NamedEntityFeaturesExtractor(),
+ new DependencyTreeFeaturesExtractor(),
+ new DependencyPathFeaturesExtractor()
+ );
+ }
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {