本文整理汇总了Java中org.carrot2.text.linguistic.IStemmer类的典型用法代码示例。如果您正苦于以下问题:Java IStemmer类的具体用法?Java IStemmer怎么用?Java IStemmer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IStemmer类属于org.carrot2.text.linguistic包,在下文中一共展示了IStemmer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStemmer
import org.carrot2.text.linguistic.IStemmer; //导入依赖的package包/类
@Override
public IStemmer getStemmer(LanguageCode language) {
switch (language) {
case ARABIC:
return ArabicStemmerFactory.createStemmer();
case CHINESE_SIMPLIFIED:
return IdentityStemmer.INSTANCE;
default:
/*
* For other languages, try to use snowball's stemming.
*/
return SnowballStemmerFactory.createStemmer(language);
}
}
示例2: createStemmer
import org.carrot2.text.linguistic.IStemmer; //导入依赖的package包/类
/**
* Create and return an {@link IStemmer} adapter for a
* {@link SnowballProgram} for a given language code. An identity stemmer is
* returned for unknown languages.
*/
public static IStemmer createStemmer(LanguageCode language) {
final Class<? extends SnowballProgram> stemmerClazz = snowballStemmerClasses
.get(language);
if (stemmerClazz == null) {
logger.warn("No Snowball stemmer class for: " + language.name()
+ ". Quality of clustering may be degraded.");
return IdentityStemmer.INSTANCE;
}
try {
return new SnowballStemmerAdapter(stemmerClazz.newInstance());
} catch (Exception e) {
logger.warn("Could not instantiate snowball stemmer"
+ " for language: " + language.name()
+ ". Quality of clustering may be degraded.", e);
return IdentityStemmer.INSTANCE;
}
}
示例3: getStemmer
import org.carrot2.text.linguistic.IStemmer; //导入依赖的package包/类
@Override
public IStemmer getStemmer(LanguageCode language) {
return new IStemmer() {
@Override
public CharSequence stem(CharSequence word) {
return word.toString() + word.toString();
}
};
}