org.ansj.dic.DicReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ansj_seg Show documentation
Show all versions of ansj_seg Show documentation
best java chinese word seg !
package org.ansj.dic;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
/**
* 加载词典用的类
* @author ansj
*/
public class DicReader {
public static BufferedReader getReader(String name){
//maven工程修改词典加载方式
InputStream in = DicReader.class.getResourceAsStream("/" + name) ;
try {
return new BufferedReader(new InputStreamReader(in,"UTF-8")) ;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null ;
}
public static InputStream getInputStream(String name){
//maven工程修改词典加载方式
InputStream in = DicReader.class.getResourceAsStream("/" + name) ;
return in ;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy