一套中文與英文的 dictd 字典檔資料庫,所以必須搭配使用。 而 chinese/dictd 則是修正特殊中文字的問題, 如果想要正常使用漢英字典(Cedict),那麼就必須安裝此修正過的 port。
裡面目前包含四個字典檔,moecomp 和 netterm 都是英漢字典檔, 而 pydict 則是英漢、漢英字典檔,目前只有做英漢的部分, cedict 則也是英漢、漢英字典檔,不過目前只有做漢英的部分。
在安裝完後,必須先修改 /usr/local/etc/dictd.conf ,這個檔案是給 net/dictd-database 使用的,如果不打算用英英字典,那麼就全部換成以下的內容來符合 chinese/dictd-database 的要求。
database moecomp { data "/usr/local/lib/dict/moecomp.dict.dz" index "/usr/local/lib/dict/moecomp.index" } database netterm { data "/usr/local/lib/dict/netterm.dict.dz" index "/usr/local/lib/dict/netterm.index" } database pydict { data "/usr/local/lib/dict/pydict.dict.dz" index "/usr/local/lib/dict/pydict.index" } database cedict { data "/usr/local/lib/dict/cedict.dict.dz" index "/usr/local/lib/dict/cedict.index" }
然後就可以啟動 /usr/local/etc/rc.d/dictd.sh start 。
接著在去 /usr/ports/textproc/dict 安裝 dict,這是一個可以用來存取 DICT 伺服器的用戶端,只能用命令列模式。
用法範例如下:
% dict -h localhost -D Databases available: moecomp Taiwan MOE computer dictionary netterm Network Terminology pydict pydict data % dict -h localhost -d moecomp hello | less 1 definition found From Taiwan MOE computer dictionary [moecomp]: hello 呼叫 % dict -h localhost 成功 1 definition found From Chinese to English dictionary [cedict]: 成功 [cheng2 gong1] success to succeed
在 /usr/ports/net/dictd-database 還有其他的字典檔資料庫,可以參考看看是否需要。
筆者通常都會安裝 /usr/ports/net/dictd-database ,然後將所有的資料庫都寫入 /usr/local/etc/dictd.conf,然後用 dict -h localhost hello 來對所有的資料庫查詢, 在查單字的時候蠻方便的。
cedict: CEDICT: Chinese-English Dictionary
dict: http://www.dict.org/