本文整理汇总了Java中kr.co.shineware.nlp.komoran.core.Komoran类的典型用法代码示例。如果您正苦于以下问题:Java Komoran类的具体用法?Java Komoran怎么用?Java Komoran使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Komoran类属于kr.co.shineware.nlp.komoran.core包,在下文中一共展示了Komoran类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzing
import kr.co.shineware.nlp.komoran.core.Komoran; //导入依赖的package包/类
private static void analyzing(Map<String, String> argMap) throws Exception {
Komoran komoran = new Komoran(argMap.get("-model"));
if(argMap.containsKey("-userDic")){
komoran.setUserDic(argMap.get("-userDic"));
}
if(argMap.containsKey("-fwd")){
komoran.setFWDic(argMap.get("-fwd"));
}
BufferedReader br = new BufferedReader(new FileReader(argMap.get("-in")));
BufferedWriter bw = new BufferedWriter(new FileWriter(argMap.get("-out")));
String line = null;
while((line = br.readLine()) != null){
line = line.trim();
if(line.length() == 0){
continue;
}
bw.write(komoran.analyze(line).getPlainText());
bw.newLine();
}
bw.close();
br.close();
}
示例2: KomoranTokenizerFactory
import kr.co.shineware.nlp.komoran.core.Komoran; //导入依赖的package包/类
public KomoranTokenizerFactory(IndexSettings indexSettings, String name, Settings settings, String pluginPath) {
super(indexSettings, name, settings);
String models = settings.get("models");
if(models == null) {
models = KomoranTokenizer.defaultModels;
}
models = pluginPath + File.separator + KomoranTokenizer.name + File.separator + models;
this.komoran = new Komoran(models);
}
示例3: KomoranTokenizer
import kr.co.shineware.nlp.komoran.core.Komoran; //导入依赖的package包/类
public KomoranTokenizer(Komoran komoran) {
this.komoran = komoran;
tokens = null;
idx = 0;
this.charTermAttribute = addAttribute(CharTermAttribute.class);
this.typeAttribute = addAttribute(TypeAttribute.class);
}
示例4: main
import kr.co.shineware.nlp.komoran.core.Komoran; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Komoran komoran = new Komoran("models_full");
komoran.setFWDic("user_data/fwd.user");
komoran.setUserDic("user_data/dic.user");
String input = "밀리언 달러 베이비랑 바람과 함께 사라지다랑 뭐가 더 재밌었어?";
KomoranResult analyzeResultList = komoran.analyze(input);
List<Token> tokenList = analyzeResultList.getTokenList();
//print each tokens by getTokenList()
System.out.println("==========print 'getTokenList()'==========");
for (Token token : tokenList) {
System.out.println(token);
System.out.println(token.getMorph()+"/"+token.getPos()+"("+token.getBeginIndex()+","+token.getEndIndex()+")");
System.out.println();
}
//print nouns
System.out.println("==========print 'getNouns()'==========");
System.out.println(analyzeResultList.getNouns());
System.out.println();
System.out.println("==========print 'getPlainText()'==========");
System.out.println(analyzeResultList.getPlainText());
System.out.println();
System.out.println("==========print 'getList()'==========");
System.out.println(analyzeResultList.getList());
}
示例5: loadModel
import kr.co.shineware.nlp.komoran.core.Komoran; //导入依赖的package包/类
public void loadModel(String modelType) {
komoran = ("full".equals(modelType.toLowerCase())) ? new Komoran(DEFAULT_MODEL.FULL) : new Komoran(DEFAULT_MODEL.LIGHT);
}
示例6: KomoranCallable
import kr.co.shineware.nlp.komoran.core.Komoran; //导入依赖的package包/类
public KomoranCallable(Komoran komoran, String input){
this.komoran = komoran;
this.input = input;
}