⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simplealgorithm.java

📁 基于词库的中文分词组件
💻 JAVA
字号:
/**
 * 
 */
package org.solol.mmseg.internal;

import org.solol.mmseg.core.AlgorithmException;
import org.solol.mmseg.core.DictionaryFactory;
import org.solol.mmseg.core.IChunk;
import org.solol.mmseg.core.IWord;

/**
 * 
 * @author solo L
 * 
 */
public final class SimpleAlgorithm extends AbstractAlgorithm {
	
	public SimpleAlgorithm() throws AlgorithmException {
		super();
	}

	public SimpleAlgorithm(DictionaryFactory dictionaryFactory) {
		super(dictionaryFactory);
	}	

	protected IChunk[] createChunks(char[] chars, int index) {

		IWord[] words = findMatchWords(chars, index);

		IChunk[] chunks = new IChunk[words.length];
		for (int i = 0; i < words.length; i++) {
			chunks[i] = new Chunk(new IWord[] { words[i] });
		}
		return chunks;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -