本文整理汇总了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);
}
示例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);
}
示例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));
}
示例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");
}
示例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)));
}
}
示例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)));
}
示例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;
}
示例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)));
}
示例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;
}
示例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))));
}
示例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)));
}
示例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();
}
示例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))));
}
示例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))));
}
示例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)));
}