本文整理汇总了Java中org.cleartk.ml.feature.extractor.CleartkExtractor类的典型用法代码示例。如果您正苦于以下问题:Java CleartkExtractor类的具体用法?Java CleartkExtractor怎么用?Java CleartkExtractor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CleartkExtractor类属于org.cleartk.ml.feature.extractor包,在下文中一共展示了CleartkExtractor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createAllFeatureExtractors
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
/**
* Creates all the features extractors that will be used. To remove code redundancy the method is public static and
* therefore accessible in the Features2Xml class
*
* @return the list of feature extractors
*/
public static List<FeatureExtractor1<Token>> createAllFeatureExtractors() throws IOException {
//create all feature extractors
List<FeatureExtractor1<Token>> allFeatureExtractors = new ArrayList<>();
TypePathExtractor<Token> stemExtractor = FeatureExtractorFactory.createTokenTypePathExtractors();
FeatureExtractor1<Token> tokenFeatureExtractor = FeatureExtractorFactory.createTokenFeatureExtractors();
CleartkExtractor<Token, Token> contextFeatureExtractor = FeatureExtractorFactory.createTokenContextExtractors();
FeatureFunctionExtractor nameListExtractors = FeatureExtractorFactory.createNameListExtractors();
FeatureFunctionExtractor cityListExtractors = FeatureExtractorFactory.createCityListExtractors();
FeatureFunctionExtractor countryListExtractors = FeatureExtractorFactory.createCountryListExtractors();
FeatureFunctionExtractor miscListExtractors = FeatureExtractorFactory.createMiscListExtractors();
FeatureFunctionExtractor orgListExtractors = FeatureExtractorFactory.createOrgListExtractors();
FeatureFunctionExtractor locListExtractors = FeatureExtractorFactory.createLocListExtractors();
allFeatureExtractors.add(stemExtractor);
allFeatureExtractors.add(tokenFeatureExtractor);
allFeatureExtractors.add(contextFeatureExtractor);
allFeatureExtractors.add(nameListExtractors);
allFeatureExtractors.add(cityListExtractors);
allFeatureExtractors.add(countryListExtractors);
allFeatureExtractors.add(miscListExtractors);
allFeatureExtractors.add(orgListExtractors);
allFeatureExtractors.add(locListExtractors);
return allFeatureExtractors;
}
开发者ID:floschne,项目名称:NLP_ProjectNER,代码行数:31,代码来源:FeatureExtractorFactory.java
示例2: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例3: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例4: defaultExtractors
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
public static List<FeatureExtractor1> defaultExtractors(int leftContextSize,
int rightContextSize) {
List<FeatureExtractor1> feList = Lists.newLinkedList();
feList.addAll(com.textocat.textokit.ml.DefaultFeatureExtractors.currentTokenExtractors());
List<FeatureExtractor1> ctxTokenFeatureExtractors = com.textocat.textokit.ml.DefaultFeatureExtractors.contextTokenExtractors();
if (leftContextSize < 0 || rightContextSize < 0) {
throw new IllegalStateException("context size < 0");
}
if (leftContextSize == 0 && rightContextSize == 0) {
throw new IllegalStateException("left & right context sizes == 0");
}
List<Context> contexts = Lists.newArrayList();
if (leftContextSize > 0) {
contexts.add(new CleartkExtractor.Preceding(leftContextSize));
}
if (rightContextSize > 0) {
contexts.add(new CleartkExtractor.Following(rightContextSize));
}
feList.add(new CleartkExtractor(Token.class,
new CombinedExtractor1(ctxTokenFeatureExtractors),
contexts.toArray(new Context[contexts.size()])));
return feList;
}
开发者ID:textocat,项目名称:textokit-core,代码行数:26,代码来源:DefaultFeatureExtractors.java
示例5: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例6: initCentroidTfIdfSimilarityExtractor
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
private CentroidTfidfSimilarityExtractor<String, DocumentAnnotation> initCentroidTfIdfSimilarityExtractor()
throws IOException {
CleartkExtractor<DocumentAnnotation, Token> countsExtractor = new CleartkExtractor<DocumentAnnotation, Token>(
Token.class,
new CoveredTextExtractor<Token>(),
new CleartkExtractor.Count(new CleartkExtractor.Covered()));
CentroidTfidfSimilarityExtractor<String, DocumentAnnotation> simExtractor = new CentroidTfidfSimilarityExtractor<String, DocumentAnnotation>(
DocumentClassificationAnnotator.CENTROID_TFIDF_SIM_EXTRACTOR_KEY,
countsExtractor);
if (this.tfIdfCentroidSimilarityUri != null) {
simExtractor.load(this.tfIdfCentroidSimilarityUri);
}
return simExtractor;
}
开发者ID:ClearTK,项目名称:cleartk,代码行数:17,代码来源:DocumentClassificationAnnotator.java
示例7: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例8: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
super.initialize(context);
List<FeatureExtractor1<Event>> extractors = Lists.newArrayList();
extractors.add(new TypePathExtractor<Event>(Event.class, "tense"));
extractors.add(new TypePathExtractor<Event>(Event.class, "aspect"));
extractors.add(new TypePathExtractor<Event>(Event.class, "eventClass"));
extractors.add(new SyntacticFirstChildOfGrandparentOfLeafExtractor<Event>());
this.setSourceExtractors(extractors);
this.setTargetExtractors(extractors);
List<FeatureExtractor2<Anchor, Anchor>>btweenExtractors = Lists.newArrayList();
btweenExtractors.add(new SyntacticLeafToLeafPathPartsExtractor<Anchor, Anchor>());
btweenExtractors.add(new CleartkExtractor<Anchor, Token>(Token.class, new CoveredTextExtractor<Token>(), new Bag(new Covered())));
this.setBetweenExtractors(btweenExtractors);
}
开发者ID:ClearTK,项目名称:cleartk,代码行数:19,代码来源:TemporalLinkEventToSubordinatedEventAnnotator.java
示例9: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例10: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例11: createTokenCountsExtractor
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
private FeatureExtractor1<Sentence> createTokenCountsExtractor() {
FeatureExtractor1<Token> tokenFieldExtractor = new CoveredTextExtractor<Token>();
switch (this.tokenField) {
case COVERED_TEXT:
tokenFieldExtractor = new CoveredTextExtractor<Token>();
break;
case STEM:
tokenFieldExtractor = new TypePathExtractor<Token>(Token.class, "stem");
break;
case LEMMA:
tokenFieldExtractor = new TypePathExtractor<Token>(Token.class, "lemma");
break;
}
CleartkExtractor<Sentence, Token> countsExtractor = new CleartkExtractor<Sentence, Token>(
Token.class,
new StopwordRemovingExtractor<Token>(this.stopwords, tokenFieldExtractor),
new CleartkExtractor.Count(new CleartkExtractor.Covered()));
return countsExtractor;
}
开发者ID:ClearTK,项目名称:cleartk,代码行数:22,代码来源:SumBasicAnnotator.java
示例12: testCleartkExtractor2
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
@Test
public void testCleartkExtractor2() throws Exception {
CleartkExtractor<Chunk, Token> extractor = new CleartkExtractor<Chunk, Token>(
Token.class,
new TypePathExtractor<Token>(Token.class, "pos"),
new Following(3));
this.tokenBuilder.buildTokens(
this.jCas,
"The quick brown fox jumped over the lazy dog.",
"The quick brown fox jumped over the lazy dog .",
"DT JJ JJ NN VBD IN DT JJ NN .");
Chunk chunk = new Chunk(this.jCas, 20, 31);
chunk.addToIndexes();
Assert.assertEquals("jumped over", chunk.getCoveredText());
List<Feature> features = extractor.extract(this.jCas, chunk);
assertEquals(3, features.size());
assertFeature("Following_0_3_0_TypePath(Pos)", "DT", features.get(0));
assertFeature("Following_0_3_1_TypePath(Pos)", "JJ", features.get(1));
assertFeature("Following_0_3_2_TypePath(Pos)", "NN", features.get(2));
}
开发者ID:ClearTK,项目名称:cleartk,代码行数:25,代码来源:FeatureExtractionTutorialTest.java
示例13: process
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
@Override
public void process(JCas jCas) throws AnalysisEngineProcessException {
for (Sentence sentence : select(jCas, Sentence.class)) {
List<Instance<String>> instances = new ArrayList<>();
List<Token> tokens = selectCovered(jCas, Token.class, sentence);
for (Token token : tokens) {
Instance<String> instance = new Instance<>();
for (FeatureExtractor1<Token> extractor : this.featureExtractors) {
if (extractor instanceof CleartkExtractor) {
instance.addAll((((CleartkExtractor) extractor).extractWithin(jCas, token, sentence)));
}
else {
instance.addAll(extractor.extract(jCas, token));
}
}
try {
instance.setOutcome(selectCovered(jCas, GoldAspectTarget.class, token).get(0).getAspectTargetType());
} catch (IndexOutOfBoundsException e) {
//e.printStackTrace();
}
instances.add(instance);
}
if (this.isTraining()) {
this.dataWriter.write(instances);
} else {
List<String> labels = this.classify(instances);
Iterator<Token> tokensIter = tokens.iterator();
for (String label : labels) {
Token t = tokensIter.next();
AspectTarget target = new AspectTarget(jCas, t.getBegin(), t.getEnd());
target.setAspectTargetType(label);
target.addToIndexes();
}
}
}
}
开发者ID:uhh-lt,项目名称:LT-ABSA,代码行数:37,代码来源:AspectAnnotator.java
示例14: createTokenContextExtractors
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
public static CleartkExtractor<Token, Token> createTokenContextExtractors() {
// create a feature extractor that extracts the surrounding token texts (within the same sentence)
return new CleartkExtractor<>(Token.class,
// the FeatureExtractor that takes the token annotation from the JCas and produces the covered text
new CoveredTextExtractor<>(),
// also include the two preceding words
new CleartkExtractor.Preceding(2),
// and the two following words
new CleartkExtractor.Following(2));
}
开发者ID:floschne,项目名称:NLP_ProjectNER,代码行数:11,代码来源:FeatureExtractorFactory.java
示例15: createXStream
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例16: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例17: createXStream
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例18: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的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
示例19: initialize
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
public void initialize(UimaContext context) throws ResourceInitializationException {
super.initialize(context);
// Create an extractor that gives word counts for a document
this.extractor = new CleartkExtractor<DocumentAnnotation, Token>(
Token.class,
new CoveredTextExtractor<Token>(),
new Count(new Covered()));
}
开发者ID:ClearTK,项目名称:cleartk,代码行数:10,代码来源:BasicDocumentClassificationAnnotator.java
示例20: initTfIdfExtractor
import org.cleartk.ml.feature.extractor.CleartkExtractor; //导入依赖的package包/类
private TfidfExtractor<String, DocumentAnnotation> initTfIdfExtractor() throws IOException {
CleartkExtractor<DocumentAnnotation, Token> countsExtractor = new CleartkExtractor<DocumentAnnotation, Token>(
Token.class,
new CoveredTextExtractor<Token>(),
new CleartkExtractor.Count(new CleartkExtractor.Covered()));
TfidfExtractor<String, DocumentAnnotation> tfIdfExtractor = new TfidfExtractor<String, DocumentAnnotation>(
DocumentClassificationAnnotator.TFIDF_EXTRACTOR_KEY,
countsExtractor);
if (this.tfIdfUri != null) {
tfIdfExtractor.load(this.tfIdfUri);
}
return tfIdfExtractor;
}
开发者ID:ClearTK,项目名称:cleartk,代码行数:16,代码来源:DocumentClassificationAnnotator.java
注:本文中的org.cleartk.ml.feature.extractor.CleartkExtractor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论