|
@@ -2,6 +2,8 @@ package org.diagbot.nlp.participle.cfg;
|
|
|
|
|
|
import org.diagbot.nlp.participle.word.Segment;
|
|
|
import org.diagbot.pub.utils.security.EncrypDES;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.io.*;
|
|
@@ -11,6 +13,7 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
public class DefaultConfig implements Configuration {
|
|
|
+ Logger logger = LoggerFactory.getLogger(DefaultConfig.class);
|
|
|
private static final String DEFAULT_PATH = "tc.dict";
|
|
|
private List<Character[]> contents = new ArrayList<Character[]>();
|
|
|
|
|
@@ -21,6 +24,7 @@ public class DefaultConfig implements Configuration {
|
|
|
|
|
|
public Segment loadMainDict(String path) {
|
|
|
List<String> fileContents = readFileContents(path);
|
|
|
+ logger.info("读取文件" + path + "结果:" + fileContents.size() + "行");
|
|
|
return loadMainDict(fileContents);
|
|
|
}
|
|
|
|
|
@@ -82,15 +86,22 @@ public class DefaultConfig implements Configuration {
|
|
|
if (is == null) {
|
|
|
throw new RuntimeException(path + ".......文件未找到!!");
|
|
|
}
|
|
|
+
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"), 512);
|
|
|
|
|
|
EncrypDES encrypDES = new EncrypDES();
|
|
|
String theWord = null;
|
|
|
+ int i = 0;
|
|
|
do {
|
|
|
theWord = br.readLine();
|
|
|
if (theWord != null && !"".equals(theWord.trim())) {
|
|
|
+ if (i == 5) {
|
|
|
+ logger.info("读取文件第六行解密前:" + theWord.trim());
|
|
|
+ logger.info("读取文件第六行解密后:" + new String(encrypDES.decryptor(theWord.trim())));
|
|
|
+ }
|
|
|
fileContents.add(new String(encrypDES.decryptor(theWord.trim())));
|
|
|
}
|
|
|
+ i++;
|
|
|
} while (theWord != null);
|
|
|
} catch (Exception ioe) {
|
|
|
System.err.println("读取文件" + path + "出错.......................");
|