• 大小: 4.17MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-12
  • 语言: Java
  • 标签: jieba分词  

资源简介

jieba分词java版项目,解压文件后,用eclipse导入项目后,执行run包下的test程序即可。

资源截图

代码片段和文件信息

package com.huaban.analysis.jieba;

import java.util.regex.Pattern;


public class CharacterUtil {
    public static Pattern reSkip = Pattern.compile(“(\\d+\\.\\d+|[a-zA-Z0-9]+)“);
    private static final char[] connectors = new char[] { ‘+‘ ‘#‘ ‘&‘ ‘.‘ ‘_‘ ‘-‘ };


    public static boolean isChineseLetter(char ch) {
        if (ch >= 0x4E00 && ch <= 0x9FA5)
            return true;
        return false;
    }


    public static boolean isEnglishLetter(char ch) {
        if ((ch >= 0x0041 && ch <= 0x005A) || (ch >= 0x0061 && ch <= 0x007A))
            return true;
        return false;
    }


    public static boolean isDigit(char ch) {
        if (ch >= 0x0030 && ch <= 0x0039)
            return true;
        return false;
    }


    public static boolean isConnector(char ch) {
        for (char connector : connectors)
            if (ch == connector)
                return true;
        return false;
    }


    public static boolean ccFind(char ch) {
        if (isChineseLetter(ch))
            return true;
        if (isEnglishLetter(ch))
            return true;
        if (isDigit(ch))
            return true;
        if (isConnector(ch))
            return true;
        return false;
    }


    /**
     * 全角 to 半角大写 to 小写
     * 
     * @param input
     *            输入字符
     * @return 转换后的字符
     */
    public static char regularize(char input) {
        if (input == 12288) {
            return 32;
        }
        else if (input > 65280 && input < 65375) {
            return (char) (input - 65248);
        }
        else if (input >= ‘A‘ && input <= ‘Z‘) {
            return (input += 32);
        }
        return input;
    }

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-02-08 15:00  jieba\
     文件         301  2018-02-08 14:59  jieba\.classpath
     文件         381  2018-02-08 14:29  jieba\.project
     目录           0  2018-02-08 14:29  jieba\.settings\
     文件         598  2018-02-08 14:35  jieba\.settings\org.eclipse.jdt.core.prefs
     目录           0  2018-02-08 14:59  jieba\bin\
     目录           0  2018-02-08 14:59  jieba\bin\com\
     目录           0  2018-02-08 14:59  jieba\bin\com\huaban\
     目录           0  2018-02-08 14:59  jieba\bin\com\huaban\analysis\
     目录           0  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\
     文件        1546  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\CharacterUtil.class
     文件        5503  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\DictSegment.class
     文件        1703  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\Hit.class
     文件        1226  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\Jiebasegmenter$SegMode.class
     文件        8447  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\Jiebasegmenter.class
     文件         467  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\Node.class
     文件        1104  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\Pair.class
     文件         842  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\SegToken.class
     目录           0  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\viterbi\
     文件        9018  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\viterbi\FinalSeg.class
     文件        7621  2018-02-08 14:59  jieba\bin\com\huaban\analysis\jieba\WordDictionary.class
     文件     5071839  2016-05-20 20:30  jieba\bin\dict.txt
     文件       35530  2016-05-20 20:30  jieba\bin\jieba.java.code.style.xml
     文件      665440  2016-05-20 20:30  jieba\bin\prob_emit.txt
     目录           0  2018-02-08 14:59  jieba\bin\run\
     文件         853  2018-02-08 14:59  jieba\bin\run\test.class
     目录           0  2018-02-08 14:54  jieba\src\
     目录           0  2018-02-08 14:31  jieba\src\com\
     目录           0  2018-02-08 14:31  jieba\src\com\huaban\
     目录           0  2018-02-08 14:31  jieba\src\com\huaban\analysis\
     目录           0  2018-02-08 14:31  jieba\src\com\huaban\analysis\jieba\
............此处省略15个文件信息

评论

共有 条评论