|
@@ -28,18 +28,26 @@ public class Compose {
|
|
|
System.out.println("程序开始时间:" + df.format(new Date()));// new
|
|
|
// Date()为获取当前系统时间
|
|
|
new Compose().getComposeName();
|
|
|
-// new Compose().countNum(resultUrl);
|
|
|
+ new Compose().countNum(resultUrl);
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
System.out.println("程序结束时间:" + df.format(new Date()));// new
|
|
|
// Date()为获取当前系统时间
|
|
|
System.out.println("总耗时" + TimeHelper.getTimeDiff(startTime, endTime));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param resultUrl
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
private void countNum(String resultUrl) throws Exception {
|
|
|
TextHelper textHelper = new TextHelper();
|
|
|
String allChinese = textHelper.readTextByLine(dataUrl);
|
|
|
char[] chars = allChinese.toCharArray();
|
|
|
String[] result2 = new String[30];
|
|
|
+ //初始化空字符
|
|
|
+ for (int i = 0; i < result2.length; i++) {
|
|
|
+ result2[i] = "";
|
|
|
+ }
|
|
|
for (int i = 0; i < chars.length; i++) {
|
|
|
int length = HanDict.getBH(chars[i]).length();
|
|
|
switch (length) {
|
|
@@ -133,12 +141,12 @@ public class Compose {
|
|
|
}
|
|
|
}
|
|
|
for (int i = 0; i < 24; i++) {
|
|
|
- System.out.println((i + 1) + "笔画数: " + result2[i].substring(4));
|
|
|
+ System.out.println((i + 1) + "笔画数: " + result2[i]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * getComposeName:(组合双词). <br/>
|
|
|
+ * getComposeName:(组合双词), output:data/result.txt. <br/>
|
|
|
*
|
|
|
* @author liuyuqi
|
|
|
* @throws Exception
|
|
@@ -164,8 +172,7 @@ public class Compose {
|
|
|
flag++;
|
|
|
TextHelper.writeText(resultUrl, result);
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
- System.out
|
|
|
- .println("当前耗时:" + TimeHelper.getTimeDiff(startTime, endTime));
|
|
|
+ System.out.println("当前耗时:" + TimeHelper.getTimeDiff(startTime, endTime));
|
|
|
System.out.println(flag);
|
|
|
}
|
|
|
}
|