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

📄 dicttree.java

📁 这是关于中文分词的有关程序
💻 JAVA
字号:
/*
 * Copyright 2002-2005 the original author or authors.
 * 
 * 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.
 */
/*
 * Created on 2005-12-30
 * author 谢骋超
 * 
 */
package cn.edu.zju.dartsplitter;

import java.util.List;
import java.util.Map;
import java.util.Set;

import cn.edu.zju.dartsplitter.data.DictNode;
import cn.edu.zju.dartsplitter.data.DictValue;

/**
 * 整个分词系统的核心主类,它本身表示了整个树状词库内容
 * 同时它有与树状词库相关的职责
 * @author xiecc
 * @email xieccy@gmail.com xieccy@yahoo.com
 * homepage:  http://blog.itpub.net/xiecc
 * projectpage: http://ccnt.zju.edu.cn/projects
 */
public interface DictTree {

	/**
	 * 建好以某个词为首字的节点和下面的所有子节点
	 * @param strPrefix 词的首字
	 * @return 该首字所对应的节点
	 */
    public DictNode buildSubNodes(String strPrefix);
    
    /**
     * 取到以某个词为首子的
     * @param strPrefix
     * @return
     */
    public DictNode getRootNode(String strPrefix);

    /**
     * 从某个词的首字获得节点
     * 如果词库没有load,就load一下词库
     * @param strPrefix 某个词的首字
     * @param parentNode 暂没有用,因此现在没有做rebuild
     * @return
     */
    public DictNode buildOrGetSubNodes(String strPrefix,
            DictNode parentNode);
    
    /**
     * 将整个关系统数据库词库序列化到树状词库中的接口
     *
     */
    public void saveDictMap();
    
    /**
     * 将整个词库load到内存中
     * @return 首字构成的HashMap
     */
    public Map<String,DictNode> loadDictMap();
    
    /**
     * 从关系数据库中取到以某字为首的所有词的集合
     * @param strPrefix 某个词的首字
     * @return 所有的
     */
    public List<DictValue> getDictValues(String strPrefix);
    
    /**
     * 
     * @return 所有词的首字的集合
     */
    public Set<String> getAllPrefixes();
 
}

⌨️ 快捷键说明

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