1. 程式人生 > >庖丁解牛 dic home should not be a file, but a directory!

庖丁解牛 dic home should not be a file, but a directory!

最近一個專案,用到了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 dicHomeFile = getFile(dicHome);
String path="";
try {
	path = URLDecoder.decode(dicHomeFile.getPath(),"UTF-8");
} catch (UnsupportedEncodingException e) {
	e.printStackTrace();
}
dicHomeFile = new File(path);

相關推薦

庖丁解牛 dic home should not be a file, but a directory!

最近一個專案,用到了paoding分詞器。 在開發階段我將詞庫放到了src目錄,配置檔案使用了classpath:dic,目的是為了增加可移植性。 發現問題:在啟動伺服器的時候丟擲 net.paod

String literals should not be duplicated

def pda exec one con warning ann ted make Duplicated string literals make the process of refactoring error-prone, since you must be sure

不應直接存儲或返回可變成員 Mutable members should not be stored or returned directly

via 調用 ets check 解決 store 而是 更改 instance Mutable objects are those whose state can be changed. For instance, an array is mutable, but a

Android問題集錦(十四)- The option 'android.enableAapt2' is deprecated and should not be used anymore.

今天在升級到Android studio3.1後,編譯執行程式報以下異常: 在Java compiler已經有很明顯的警告提示了: WARNING: The option 'android.enableAapt2' is depreca

Linux程式設計時使用gcc編譯.c出現以下問題warning: the `gets' function is dangerous and should not be used.

Linux程式設計時使用gcc編譯.c出現以下問題 [[email protected] final1]# gcc -pthread client.c /tmp/ccSuK4v5.o: In function `writedata': client.c:(.text+0xb2a): w

內網編譯安裝net-snmp,提示relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a share

    公司需要在內網環境下(不能訪問外網),通用原始檔編譯安裝net-snmp,監控內網伺服器的引數資訊,但是在編譯,即make的情況下,出現了Error,因為對linux的深度使用不是很熟悉,所以經過幾天的測試才找到解決辦法,下面是錯誤:    /usr/bin/l

Decentralization should NOT be the primary goal of your crypto project

The blockchain entrepreneur I recently talked with over the phone was excited, speaking energetically about what set his product apart from the rest and bo

can not be used when making a shared object; recompile with -fPIC

錯誤資訊 /usr/bin/ld: crypto/libraven_crypto.a(crypto_libraven_crypto_a-blake.o): relocation R_X86_64_32 against `.rodata' can not be used when making a

Build error: relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared obje

編譯 opencv with ffmpeg 出錯: 能用 make 儘量別用 ,make -j8 開多執行緒 不然出錯都不知道哪出錯 進入 ffmpeg/: I had to recompile

logcat 總是報: W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1

 這個問題出現的原因是因為xml程式碼裡面設定了: android:ellipsize="end" android:lines="1" 如果你設定成: android:ellipsize="end" android:singleLine="true" 就會不報了,

The option 'android.enableAapt2' is deprecated and should not be used anymore.

AndroidStudio升級到3.1時候遇到了這個問題,提示Use 'android.enableAapt2=true' to remove this warning.然而gradle.propert

java.util.concurrent.ExecutionException 'android.enableAapt2' is deprecated and should not be use

話說每次studio版本更新一次,都要搗鼓一天處理各種錯誤,我們很感恩google一直在快速更新,真是忙壞了那群大爺大媽。這次更新到了3.1也不例外。先說說這個錯:如果你的配置是這樣的:並且有如下的錯Error: java.util.concurrent.ExecutionE

學習筆記:relocation R_X86_64_32 against `.rodata' can not be used when making a shared object;

解決多個.a靜態庫,連結成一個.so動態庫出現:  relocation R_X86_64_32 against `.rodata' can not be used when making a s

Eclipse is running in a JRE, but a JDK is required Some Maven plugins may not work when importing projects or updating source folders.

efault rtu 文件屬性 lean file default 快捷方式 pro port 安裝Maven後每次啟動出現警告信息: Eclipse is running in a JRE, but a JDK is requiredSome Maven plugins

Android — Writing a file as a JSON object

Android — Writing a file as a JSON objectThere are certain use cases in android where you need to store and retrieve the data as a JSON(JavaScript Object N

Eclipse is running in a JRE, but a JDK is required 解決方法

            安裝Maven後每次啟動出現警告資訊: Eclipse is running in a JRE, but a JDK is required Some Maven plugins may not work when importing proje

eclipse 運行 mapreduce程序報錯 No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String).

ads 不變 load style 程序 ble .class loader val 報錯信息 17/07/06 17:00:27 WARN mapred.JobClient: Use GenericOptionsParser for parsing the argumen

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP

統一 apple col convert rstp stp line methods gree <?php class Car { var $color = "add"; function Car($color="green") {

MySQL server PID file could not be found!

blog 做的 所有 寫的權限 如果 rate data 重啟 一個個 重啟mysql提示MySQL server PID file could not be found! Starting MySQL...The server quit without updating

spring-boot 啟動時候 出現異常:The bean 'xxx' could not be injected as a 'xx.xxxx' because it is a JDK dynamic proxy that implements:

ng- for sed AC 存在 cti 解決方法 sid 失敗 The bean ‘xxxService‘ could not be injected as a ‘AaaXxxService‘ because it is a JDK dynamic proxy tha