这是我的源码,我用的paoding-analysis4.2.0.jar,为什么运行之后会报这个错误?
package myTest; import java.io.StringReader; //import net.paoding.analysis.analyzer.PaodingAnalyzer; import net.paoding.analysis.analyzer.PaodingAnalyzer; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.TermAttribute; import org.wltea.analyzer.lucene.IKAnalyzer; /** * 中文分词 * @author zhh * 极易分词不支持Lucene3 不作测试 * */ public class ChineseAnalyzer { public static void main(String[] args) throws Exception{ ReadFileUtils rf = new ReadFileUtils(); String s = "我是一名开发人员"; // s = rf.readWORD2007("C:\\Users\\Crazy.J\\Desktop\\test.docx"); String strZH = s; // Analyzer analyzer01 = new IKAnalyzer(true); //当为true时,分词器进行智能切分 Analyzer analyzer02 = new PaodingAnalyzer(); // showAnalyzerResult(analyzer01, strZH); showAnalyzerResult(analyzer02, strZH); } public static void showAnalyzerResult(Analyzer analyzer, String str) throws Exception { long start = System.currentTimeMillis(); System.out.println("\n" + analyzer.getClass().getSimpleName()); StringReader reader = new StringReader(str); TokenStream ts = analyzer.tokenStream("", reader); TermAttribute termAttribute =ts.getAttribute(TermAttribute.class); long end = System.currentTimeMillis(); long time = end - start; System.out.println("耗时:" + time + "ms"); while (ts.incrementToken()) { System.out.print(termAttribute.term() + "|"); } } }
报了这个错
Exception in thread "main" net.paoding.analysis.exception.PaodingAnalysisException: please set a system env PAODING_DIC_HOME or Config paoding.dic.home in paoding-dic-home.properties point to the dictionaries! at net.paoding.analysis.knife.PaodingMaker.setDicHomeProperties(PaodingMaker.java:329) at net.paoding.analysis.knife.PaodingMaker.getDicHome(PaodingMaker.java:270) at net.paoding.analysis.knife.PaodingMaker.loadProperties(PaodingMaker.java:198) at net.paoding.analysis.knife.PaodingMaker.loadProperties(PaodingMaker.java:237) at net.paoding.analysis.knife.PaodingMaker.loadProperties(PaodingMaker.java:237) at net.paoding.analysis.knife.PaodingMaker.getProperties(PaodingMaker.java:135) at net.paoding.analysis.analyzer.PaodingAnalyzer.init(PaodingAnalyzer.java:70) at net.paoding.analysis.analyzer.PaodingAnalyzer.<init>(PaodingAnalyzer.java:59) at net.paoding.analysis.analyzer.PaodingAnalyzer.<init>(PaodingAnalyzer.java:52) at myTest.ChineseAnalyzer.main(ChineseAnalyzer.java:31)
让你设置PAODING_DIC_HOME 这个环境变量呢