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


Java Komoran类代码示例

本文整理汇总了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();
}
 
开发者ID:shin285,项目名称:KOMORAN,代码行数:26,代码来源:KomoranConsoleRunner.java

示例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);
}
 
开发者ID:sungtaek,项目名称:komoran-elasticsearch,代码行数:11,代码来源:KomoranTokenizerFactory.java

示例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);
}
 
开发者ID:sungtaek,项目名称:komoran-elasticsearch,代码行数:10,代码来源:KomoranTokenizer.java

示例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());
	}
 
开发者ID:shin285,项目名称:KOMORAN,代码行数:28,代码来源:KomoranTest.java

示例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);
}
 
开发者ID:9bow,项目名称:KOMORANPoSTagger,代码行数:4,代码来源:KOMORANWrapper.java

示例6: KomoranCallable

import kr.co.shineware.nlp.komoran.core.Komoran; //导入依赖的package包/类
public KomoranCallable(Komoran komoran, String input){
	this.komoran = komoran;
	this.input = input;
}
 
开发者ID:shin285,项目名称:KOMORAN,代码行数:5,代码来源:KomoranCallable.java


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