检索中文工具(SearchZhUtil)
来源:互联网 发布:淘宝网络电话 编辑:程序博客网 时间:2024/05/16 19:11
static Long COUNT = 0L;
static String OUT_FILE_NAME = "D:/zhang_zchao/workspace5.5/test/src/memo.2.txt";
static String CODE_PATH = "D:/zhang_zchao/workspace5.5/test/src";
/**
* 检索一个目录或文件的中文
*/
public static void main(String[] args) {
// System.out.println(args[0]);
searchFile(CODE_PATH);
System.out.println("over");
}
public static void countTotal(String directory) {
File f = new File(directory);
if (f.isFile()) {
countZH(f);
} else {
File[] fs = f.listFiles();
for (File file : fs) {
countTotal(file.getPath());
}
}
}
public static void searchFile(String directory) {
File f = new File(directory);
if (f.isFile()) {
comileFile(f);
} else {
File[] fs = f.listFiles();
for (File file : fs) {
searchFile(file.getPath());
}
}
}
private static long countZH(File f) {
String filename = f.getPath();
if (!filename.contains("i18n")) {
return 0L;
}
System.out.println(filename);
long count = 0L;
List<String> users = readFile(f.getPath());
for (String content : users) {
// System.out.println(content);
if (content == null || "".equals(content.trim())) {
continue;
}
content = content.trim();
for (int i = 0; i < content.length(); i++) {
String ss = content.substring(i, i + 1);
if (ss.getBytes().length == 2) {
count++;
}
}
}
System.out.println(count);
COUNT += count;
return count;
}
- 检索中文工具(SearchZhUtil)
- 检索中文工具(SearchZhUtil)2
- 检索中文工具(SearchZhUtil)3
- oracle检索中文日期(varchar2)方法
- Oracle 全文检索 中文检索
- lucene是个全文检索工具 IKAnalyzer是个分词包 可以用来做中文的检索
- dspace不能检索中文
- Mysql 中文全文检索
- Dspace之中文检索
- Coreseek中文检索引擎
- solr中文全文检索
- MySQL中文全文检索
- 《信息检索》第十讲 中文数据库使用 及 相关工具详解
- 信息检索工具库
- sphinx全文检索工具
- javascript全文检索工具
- Lucene:全文检索工具
- elasticSearch 全文检索工具
- 今天新加入,非常高兴
- 【第6章】丰富中断处理程序
- 好久没来了
- JNDI
- 《冒号课堂》连载之七——声明范式:目标决定行动
- 检索中文工具(SearchZhUtil)
- 检索中文工具(SearchZhUtil)2
- 检索中文工具(SearchZhUtil)3
- 【MLDN_李兴华】JAVA学习攻略+新书导读
- Java基础:第十二讲 循环结构
- DateTool(1)
- DateTool(2)
- DateTool(3)
- DateTool(4)