当前位置: 首页>>代码示例>>Java>>正文


Java Preceding类代码示例

本文整理汇总了Java中org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding的典型用法代码示例。如果您正苦于以下问题:Java Preceding类的具体用法?Java Preceding怎么用?Java Preceding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Preceding类属于org.cleartk.ml.feature.extractor.CleartkExtractor包,在下文中一共展示了Preceding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
	super.initialize(context);

	// the token feature extractor: text, char pattern (uppercase, digits,
	// etc.), and part-of-speech
	this.extractor = new CombinedExtractor1<Token>(new CoveredTextExtractor<Token>(),
			new FeatureFunctionExtractor<Token>(new CoveredTextExtractor<Token>(),
					new CharacterCategoryPatternFunction<Token>(
							CharacterCategoryPatternFunction.PatternType.REPEATS_MERGED))
	/* , new TypePathExtractor(Token.class, "pos") */);

	// the context feature extractor: the features above for the 3 preceding
	// and 3 following tokens
	this.contextExtractor = new CleartkExtractor<Token, Token>(Token.class, this.extractor, new Preceding(3),
			new Following(3));

	// the chunking definition: Tokens will be combined to form Reason annotation
	this.chunking = new BioChunking<Token, Reason>(Token.class, Reason.class, null);
}
 
开发者ID:IE4OpenData,项目名称:Octroy,代码行数:21,代码来源:ReasonAnnotator.java

示例2: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
	super.initialize(context);

	// the token feature extractor: text, char pattern (uppercase, digits,
	// etc.), and part-of-speech
	this.extractor = new CombinedExtractor1<Token>(

			new FeatureFunctionExtractor<Token>(new CoveredTextExtractor<Token>(),
					new CharacterCategoryPatternFunction<Token>(PatternType.REPEATS_MERGED)),
			new TypePathExtractor<Token>(Token.class, "pos/PosValue"));

	// the context feature extractor: the features above for the 3 preceding
	// and 3 following tokens
	this.contextExtractor = new CleartkExtractor<Token, Token>(Token.class, this.extractor, new Preceding(2),
			new Following(1));

	// the chunking definition: Tokens will be combined to form
	// NamedEntityMentions, with labels
	// from the "mentionType" attribute so that we get B-location, I-person,
	// etc.
	this.chunking = new BioChunking<Token, FigureMention>(Token.class, FigureMention.class);
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:24,代码来源:ClearTkMentionAnnotator.java

示例3: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);

  // a feature extractor that creates features corresponding to the word, the word lower cased
  // the capitalization of the word, the numeric characterization of the word, and character ngram
  // suffixes of length 2 and 3.
  this.tokenFeatureExtractor = new FeatureFunctionExtractor<Token>(
      new CoveredTextExtractor<Token>(),
      new LowerCaseFeatureFunction(),
      new CapitalTypeFeatureFunction(),
      new NumericTypeFeatureFunction(),
      new CharacterNgramFeatureFunction(Orientation.RIGHT_TO_LEFT, 0, 2),
      new CharacterNgramFeatureFunction(Orientation.RIGHT_TO_LEFT, 0, 3));

  // a feature extractor that extracts the surrounding token texts (within the same sentence)
  this.contextFeatureExtractor = new CleartkExtractor<Token, Token>(
      Token.class,
      new CoveredTextExtractor<Token>(),
      new Preceding(2),
      new Following(2));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:22,代码来源:ExamplePosAnnotator.java

示例4: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);

  // the token feature extractor: text, char pattern (uppercase, digits, etc.), and part-of-speech
  this.extractor = new CombinedExtractor1<Token>(
      new FeatureFunctionExtractor<Token>(
          new CoveredTextExtractor<Token>(),
          new CharacterCategoryPatternFunction<Token>(PatternType.REPEATS_MERGED)),
      new TypePathExtractor<Token>(Token.class, "pos"));

  // the context feature extractor: the features above for the 3 preceding and 3 following tokens
  this.contextExtractor = new CleartkExtractor<Token, Token>(
      Token.class,
      this.extractor,
      new Preceding(3),
      new Following(3));

  // the chunking definition: Tokens will be combined to form NamedEntityMentions, with labels
  // from the "mentionType" attribute so that we get B-location, I-person, etc.
  this.chunking = new BioChunking<Token, NamedEntityMention>(
      Token.class,
      NamedEntityMention.class,
      "mentionType");
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:26,代码来源:NamedEntityChunker.java

示例5: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);

  // define chunking type
  this.chunking = new BioChunking<Token, Time>(Token.class, Time.class);

  // add features: word, character pattern, stem, pos
  this.tokenFeatureExtractors = Lists.newArrayList();
  this.tokenFeatureExtractors.add(new CoveredTextExtractor<Token>());
  NamedFeatureExtractor1<Token> ex = CharacterCategoryPatternFunction.createExtractor();
  this.tokenFeatureExtractors.add(ex);
  this.tokenFeatureExtractors.add(new TimeWordsExtractor<Token>());
  this.tokenFeatureExtractors.add(new TypePathExtractor<Token>(Token.class, "stem"));
  this.tokenFeatureExtractors.add(new TypePathExtractor<Token>(Token.class, "pos"));
      
  // add window of features before and after
  this.contextFeatureExtractors = Lists.newArrayList();
  for (FeatureExtractor1<Token> extractor : this.tokenFeatureExtractors) {
    this.contextFeatureExtractors.add(new CleartkExtractor<Token, Token>(Token.class, extractor, new Preceding(
        3), new Following(3)));
  }
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:24,代码来源:TimeAnnotator.java

示例6: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);

  // add features: word, stem, pos
  this.tokenFeatureExtractors = Lists.newArrayList();
  this.tokenFeatureExtractors.add(new CoveredTextExtractor<Token>());
  this.tokenFeatureExtractors.add(new TypePathExtractor<Token>(Token.class, "stem"));
  this.tokenFeatureExtractors.add(new TypePathExtractor<Token>(Token.class, "pos"));
  this.tokenFeatureExtractors.add(new ParentNodeFeaturesExtractor());

  // add window of features before and after
  this.contextExtractors = Lists.newArrayList();
  this.contextExtractors.add(new CleartkExtractor<Token, Token>(
      Token.class,
      new CoveredTextExtractor<Token>(),
      new Preceding(3),
      new Following(3)));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:20,代码来源:EventAnnotator.java

示例7: createXStream

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
public static XStream createXStream() {
	//define alias so the xml file can be read easier
	XStream xstream = new XStream();
	// org.cleartk.classifier.feature.*
	xstream.alias("TypePathExtractor", TypePathExtractor.class);
	xstream.alias("FeatureCollection", FeatureCollection.class);

	// org.cleartk.ml.feature.extractor.*
	xstream.alias("CleartkExtractor", CleartkExtractor.class);
	xstream.alias("CombinedExtractor1", CombinedExtractor1.class);
	xstream.alias("CoveredTextExtractor", CoveredTextExtractor.class);
	xstream.alias("DirectedDistanceExtractor", DirectedDistanceExtractor.class);
       xstream.alias("DistanceExtractor", DistanceExtractor.class);
       xstream.alias("FeatureExtractor1", FeatureExtractor1.class);
       xstream.alias("FeatureExtractor2", FeatureExtractor2.class);
       xstream.alias("NamedFeatureExtractor1", NamedFeatureExtractor1.class);
       xstream.alias("NamingExtractor1", NamingExtractor1.class);
       xstream.alias("RelativePositionExtractor", RelativePositionExtractor.class);
       xstream.alias("WhiteSpaceExtractor", WhiteSpaceExtractor.class);


	// within CleartkExtractor
	xstream.alias("Bag", Bag.class);
	xstream.alias("Preceding", Preceding.class);
	xstream.alias("Following", Following.class);
	xstream.alias("Covered", Covered.class);
	xstream.alias("FirstCovered", FirstCovered.class);
	xstream.alias("LastCovered", LastCovered.class);
	xstream.alias("Ngram", Ngram.class);

	xstream.alias("list", ArrayList.class);
	return xstream;
}
 
开发者ID:floschne,项目名称:NLP_ProjectNER,代码行数:34,代码来源:XStreamFactory.java

示例8: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);
  headWordExtractor = new HeadWordExtractor<Sentence>();
  shapeExtractor = new ShapeExtractor<Token>();
  whWordExtractor = new WHWordExtractor<Sentence>();
  ngramExtractor = new CleartkExtractor<Token, Token>(Token.class, new TypePathExtractor<Token>(Token.class, "lemma"),
      new Ngram(new Preceding(1), new Focus(), new Following(1)));
}
 
开发者ID:utk4rsh,项目名称:question-classifier,代码行数:10,代码来源:QuestionCategoryAnnotator.java

示例9: createXStream

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
public static XStream createXStream()
{
    // define alias so the xml file can be read easier
    XStream xstream = new XStream();
    xstream.alias("list", ArrayList.class);

    xstream.alias("TypePathExtractor", TypePathExtractor.class);
    xstream.alias("FeatureCollection", FeatureCollection.class);


    xstream.alias("Bag", Bag.class);
    xstream.alias("Preceding", Preceding.class);
    xstream.alias("Following", Following.class);
    xstream.alias("Covered", Covered.class);
    xstream.alias("FirstCovered", FirstCovered.class);
    xstream.alias("LastCovered", LastCovered.class);
    xstream.alias("Ngram", Ngram.class);

    xstream.alias("CleartkExtractor", CleartkExtractor.class);
    xstream.alias("Covered", Covered.class);
    xstream.alias("Following", Following.class);
    xstream.alias("Preceding", Preceding.class);
    xstream.alias("CoveredTextExtractor", CoveredTextExtractor.class);
    xstream.alias("FeatureExtractor1", FeatureExtractor1.class);
    xstream.alias("TypePathExtractor", TypePathExtractor.class);
    xstream.alias("CapitalTypeFeatureFunction", CapitalTypeFeatureFunction.class);
    xstream.alias("CharacterNgramFeatureFunction", CharacterNgramFeatureFunction.class);
    xstream.alias("FeatureFunctionExtractor", FeatureFunctionExtractor.class);
    xstream.alias("LowerCaseFeatureFunction", LowerCaseFeatureFunction.class);
    xstream.alias("NumericTypeFeatureFunction", NumericTypeFeatureFunction.class);

    return xstream;
}
 
开发者ID:tudarmstadt-lt,项目名称:GermaNER,代码行数:34,代码来源:XStreamFactory.java

示例10: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
public void initialize(UimaContext context) throws ResourceInitializationException {
  simpleExtractors = Lists.newArrayList();

  FeatureExtractor1<Token> wordExtractor = new CoveredTextExtractor<Token>();

  CharacterNgramFeatureFunction.Orientation fromLeft = CharacterNgramFeatureFunction.Orientation.LEFT_TO_RIGHT;
  CharacterNgramFeatureFunction.Orientation fromRight = CharacterNgramFeatureFunction.Orientation.RIGHT_TO_LEFT;
  simpleExtractors.add(new FeatureFunctionExtractor<Token>(
      wordExtractor,
      new LowerCaseFeatureFunction(),
      new CapitalTypeFeatureFunction(),
      new NumericTypeFeatureFunction(),
      new CharacterNgramFeatureFunction(fromLeft, 0, 1),
      new CharacterNgramFeatureFunction(fromLeft, 0, 2),
      new CharacterNgramFeatureFunction(fromLeft, 0, 3),
      new CharacterNgramFeatureFunction(fromRight, 0, 1),
      new CharacterNgramFeatureFunction(fromRight, 0, 2),
      new CharacterNgramFeatureFunction(fromRight, 0, 3),
      new CharacterNgramFeatureFunction(fromRight, 0, 4),
      new CharacterNgramFeatureFunction(fromRight, 0, 5),
      new CharacterNgramFeatureFunction(fromRight, 0, 6)));

  windowExtractors = Lists.newArrayList();
  windowExtractors.add(new CleartkExtractor<Token, Token>(
      Token.class,
      wordExtractor,
      new Preceding(2),
      new Following(2)));

  windowNGramExtractors = Lists.newArrayList();
  windowNGramExtractors.add(new CleartkExtractor<Token, Token>(Token.class, wordExtractor, new Ngram(
      new Preceding(2)), new Ngram(new Following(2))));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:34,代码来源:DefaultFeatureExtractor.java

示例11: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);

  // a list of feature extractors that require only the token
  this.tokenFeatureExtractors = Lists.newArrayList();

  // a list of feature extractors that require the token and the sentence
  this.tokenSentenceFeatureExtractors = Lists.newArrayList();

  // basic feature extractors for word, stem and part-of-speech
  FeatureExtractor1<Token> wordExtractor, stemExtractor;
  wordExtractor = new CoveredTextExtractor<Token>();
  stemExtractor = new TypePathExtractor<Token>(Token.class, "stem");

  // aliases for NGram feature parameters
  CharacterNgramFeatureFunction.Orientation fromRight = CharacterNgramFeatureFunction.Orientation.RIGHT_TO_LEFT;

  // add the feature extractor for the word itself
  // also add proliferators which create new features from the word text
  this.tokenFeatureExtractors.add(new FeatureFunctionExtractor<Token>(
      wordExtractor,
      new LowerCaseFeatureFunction(),
      new CapitalTypeFeatureFunction(),
      new NumericTypeFeatureFunction(),
      new CharacterNgramFeatureFunction(fromRight, 0, 2),
      new CharacterNgramFeatureFunction(fromRight, 0, 3)));

  // add the feature extractors for the stem and part of speech
  this.tokenFeatureExtractors.add(stemExtractor);

  // add 2 stems to the left and right
  this.tokenSentenceFeatureExtractors.add(new CleartkExtractor<Token, Token>(
      Token.class,
      stemExtractor,
      new Preceding(2),
      new Following(2)));

}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:39,代码来源:NonSequenceExamplePosAnnotator.java

示例12: VerbClauseTemporalAnnotator

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
public VerbClauseTemporalAnnotator() {
  this.eventID = 1;

  FeatureExtractor1<Token> precedingAuxiliaries = new CleartkExtractor<Token, Token>(
      Token.class,
      new TokenTextForSelectedPosExtractor("MD", "TO", "IN", "VB", "RB"),
      new Preceding(3));
  FeatureExtractor1<Token> tokenStemExtractor = new TypePathExtractor<Token>(Token.class, "stem");
  FeatureExtractor1<Token> tokenPOSExtractor = new TypePathExtractor<Token>(Token.class, "pos");

  this.sourceFeatureExtractors = Lists.newArrayList();
  this.sourceFeatureExtractors.add(new NamingExtractor1<Token>("Source", new CoveredTextExtractor<Token>()));
  this.sourceFeatureExtractors.add(new NamingExtractor1<Token>("Source", tokenPOSExtractor));
  this.sourceFeatureExtractors.add(new NamingExtractor1<Token>("Source", tokenStemExtractor));
  this.sourceFeatureExtractors.add(new NamingExtractor1<Token>("Source", precedingAuxiliaries));

  this.targetFeatureExtractors = Lists.newArrayList();
  this.targetFeatureExtractors.add(new NamingExtractor1<Token>("Target", new CoveredTextExtractor<Token>()));
  this.targetFeatureExtractors.add(new NamingExtractor1<Token>("Target", tokenPOSExtractor));
  this.targetFeatureExtractors.add(new NamingExtractor1<Token>("Target", tokenStemExtractor));
  this.targetFeatureExtractors.add(new NamingExtractor1<Token>("Target", precedingAuxiliaries));

  this.betweenAnchorsFeatureExtractors = new ArrayList<FeatureExtractor1<Annotation>>();
  this.betweenAnchorsFeatureExtractors.add(new NamingExtractor1<Annotation>(
      "WordsBetween",
      new CleartkExtractor<Annotation, Token>(Token.class, new CoveredTextExtractor<Token>(), new Bag(new Covered()))));
  this.pathExtractor = new TargetPathExtractor();
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:29,代码来源:VerbClauseTemporalAnnotator.java

示例13: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);
  this.eventFeatureExtractors.add(new CleartkExtractor<Event, Token>(Token.class, new TypePathExtractor<Token>(
      Token.class,
      "pos"), new Bag(new Covered())));

  this.contextExtractors.add(new CleartkExtractor<Event, Token>(
      Token.class,
      new TokenTextForSelectedPosExtractor("VB"),
      new Bag(new Preceding(3))));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:13,代码来源:EventAspectAnnotator.java

示例14: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);
  this.contextExtractors.add(new CleartkExtractor<Event, Token>(
      Token.class,
      new TokenTextForSelectedPosExtractor("RB", "MD", "TO", "IN"),
      new Bag(new Preceding(3))));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:9,代码来源:EventModalityAnnotator.java

示例15: initialize

import org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
  super.initialize(context);
  this.eventFeatureExtractors.add(new TextSliceExtractor<Event>(-2));
  this.eventFeatureExtractors.add(new CleartkExtractor<Event, Token>(Token.class, new TypePathExtractor<Token>(
      Token.class,
      "pos"), new Bag(new Covered())));

  this.contextExtractors.add(new CleartkExtractor<Event, Token>(
      Token.class,
      new TokenTextForSelectedPosExtractor("MD", "TO", "IN", "VB"),
      new Preceding(3)));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:14,代码来源:EventTenseAnnotator.java


注:本文中的org.cleartk.ml.feature.extractor.CleartkExtractor.Preceding类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。