collector.java

来自「paoding的中文分词程序,效果还可以.这个可以作为一些基本应用的分词.」· Java 代码 · 共 49 行

JAVA
49
字号
/**
 * Copyright 2007 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.paoding.analysis.knife;

/**
 * Collector接收Knife切割文本得到的词语。
 * <p>
 * 
 * @author Zhiliang Wang [qieqie.wang@gmail.com]
 * 
 * @see Knife
 * 
 * @since 1.0
 * 
 */
public interface Collector {

	/**
	 * 当Knife从文本流中获取一个词语时,本方法被调用。 <br>
	 * 调用的顺序与词语在文本流中的顺序是否一致视不同实现可能有不同的策略。
	 * <p>
	 * 
	 * 如当Knife收到“中国当代社会现象”文本流中的“社会”时,传入的参数分别将是:(“社会”, 4, 6)
	 * 
	 * @param word
	 *            接收到的词语
	 * @param offset
	 *            该词语在文本流中的偏移位置
	 * @param end
	 *            该词语在文本流中的结束位置(词语不包括文本流end位置的字符),end-offset是为word的长度
	 * 
	 *         
	 */
	public void collect(String word, int offset, int end);
}

⌨️ 快捷键说明

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