庖丁解牛 dic home should not be a file, but a directory!
来源:互联网 发布:绿盟数据库审计 编辑:程序博客网 时间:2024/05/16 18:44
最近一个项目,用到了paoding分词器。
在开发阶段我将词库放到了src目录,配置文件使用了classpath:dic,目的是为了增加可移植性。
发现问题:在启动服务器的时候抛出 net.paoding.analysis.exception.PaodingAnalysisException: dic home should not be a file, but a directory!
分析问题:这是因为PaodingMaker.getFile()方法中采用了老版本的java.net.URL.getFile(),不能够识别中文或者空格,只有采用URL.toURI().getPath()才能识别汉字与空格。
解决问题:需要修改一下Paoding中的代码了。找到PaodingMaker.java的setDicHomeProperties方法,修改File dicHomeFile = getFile(dicHome);为
- File dicHomeFile2 = getFile(dicHome);
- String path="";
- try {
- path = URLDecoder.decode(dicHomeFile2.getPath(),"UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- File dicHomeFile = new File(path);
- 庖丁解牛 dic home should not be a file, but a directory!
- Not To Be A Crazy Downloader But A Crazy Coder
- AIDL interface XXX should be declared in a file
- A file with the correct name was found in this directory, but it is not the correct one.
- Activiti 报错 A delegated task cannot be completed, but should be resolved instead
- Warning the selected directory is not a valid tomcat home
- 安装pnp4nagios时出现Pango-WARNING **: error opening config file '/home/www/.pangorc': Not a directory错误
- 'Basic' attribute type should not be a persistence entity/a container
- please set a system env PAODING_DIC_HOME or Config paoding.dic.home in paoding-dic-home.properties p
- You can list a directory containing 8 million files! But not with ls..
- interface xxx should be declared in a file called xxx.aidl
- AS-->AIDL: xxx should be declared in a file called xxx
- hadoop启动错误:Path /XXX should be specified as a URI in configuration file
- Class"X" is public, should be declared in a file named "X.java"
- cannot be read or is not a valid ZIP file
- cannot be read or is not a valid ZIP file
- cannot be read or is not a valid ZIP file
- How hard a start should be?
- 在ASP.NET 3.5中使用新的ListView控件
- (2010-08-22)关于用ASP.NET建网站时登录验证的总结
- strcpy的实现
- c#.net多线程编程教学(2):Thread类
- 完全最短路径问题Floyd算法 pku 1125 Stockbroker Grapevine
- 庖丁解牛 dic home should not be a file, but a directory!
- c#.net多线程编程教学(3):线程同步
- 我的网络家园记述
- 使用Lucene+Paoding构建SSH系统的站内搜索
- 关于取消Windows 2003关机事件跟踪器
- Lucene 中文引擎,庖丁解牛的辞典参数配置方法
- 复位SDRAM未清空导致热启动失败
- security in computing
- 解决一例监控摄像图像发绿的问题