星期五, 元月 12, 2007

文字介面線上字典 Script

在 BBS 看到有人寫幾行的 script, 做的事情就是把參數傳給 Yahoo! 字典, 然後把抓回來的資料去掉 html, 就是很清楚的查詢結果, 給 Leeym 長輩看了後, 長輩給了另一個 Perl 版本的 scrtip, 除了清楚的查詢結果外, 還有詞性 + 顏色, 而且還有 spell check(Y! 字典提供的修正).

順便推薦作者講的 sed 好站: SED 單行 script 快速參考, 作者就是抄這邊把html濾掉的.

下述此為 reborn2266 (帥哥一枚) 的 script 轉載, 只有簡單幾行即達成需求:

不過, 因為在 bbs 很難轉載(找不到 ulr link 可以貼), 在此就只能附上作者名字和文章資訊, 如下:

作者: reborn2266 (帥哥一枚) 看板: shell
標題: 簡單的文字介面線上字典script
時間: Wed Dec  6 10:04:15 2006

下述為 Leeym 長輩的 Script:

兩者用法都很簡單, 只要抓回去後, chmod +x filename, 再 ./filename book 就可以查到 book 的單字意思.

沒想到 彥明長輩的超人氣程式, 馬上帶來不得了的效果, 瞬間出了 ruby 版, 進化版(sh), java 版... 等. 做個記錄:

相關標籤

this is comment icon 用yahoo dict的java application [回覆]

與文字介面的不同在於可以查詢過去查詢了那些單字, 並且可以輸出成文字檔, 自己寫的, 第一次發佈

http://moon.cse.yzu.edu.tw/~s912356/pub/dict.zip

執行方式: java -jar dict.jar

Comment by wulawu (01/12/2007 15:35)

this is comment icon 回 wulawu [回覆]

感謝提供, 只不過我執行會出現 Exception in thread "main" java.lang.UnsupportedClassVersionError: fcwu/dict/MyCtrlMain (Unsupported major.minor version 49.0) 這種 error 耶.. XD
小的再想辦法研究看看好了~~ :)

Comment by Tsung (01/12/2007 22:15)

this is comment icon [回覆]

reborn2266 的 script , 有亂碼的問題 ~

Comment by jumbler (01/15/2007 09:57)

this is comment icon 回 jumbler [回覆]

我試的結果是, 在 bsd 上會有 div 結尾沒濾乾淨的問題, linux 上一切正常, 你說的亂碼是指?? 某些字還是說是全部?
某些字的話能列出來一下嗎?, 我查查看..
若是全部我猜有可能是 UTF-8(Y!字典是 UTF-8) 的問題, 您可以在 script 後面用 iconv 轉一下看看 :)

Comment by Tsung (01/15/2007 10:02)

this is comment icon [回覆]

各位前輩好,我是 reborn2266,沒想到隨手寫的一個 script 真的會有人去看呀...

我的 script 的確會有亂碼問題...只能說...我太天真了~嘿嘿

Comment by reborn2266 (02/16/2007 08:32)

this is comment icon 回 reborn2266 [回覆]

沒想到作者出來回應了, 之前沒有查到作者有 Blog 實在是失敬 Orz...

Comment by Tsung (02/16/2007 11:02)

this is comment icon [回覆]

我的 script 也會有亂碼問題.

Comment by 宴會攝影 (09/24/2007 12:05)

this is comment icon 回 宴會攝影 [回覆]

您是用 UTF-8 的?

Comment by Tsung (09/25/2007 10:59)

this is comment icon java版查google [回覆]

用java版查詢"google"這個字的時候會一直searching
用perl版查詢同一個字則可以正確查到解釋
同時用PCMan的GNetdict,也可以查到
到yahoo和google的字典網頁上(都是Dr.eye)也可以查到

我猜,問題是不是出在音標上面,這個字沒音標

Comment by iosian (10/26/2008 01:55)

this is comment icon 回 iosian [回覆]

厄, java 版不是我寫的, 可能得問問原作者耶. Orz..
建議用 perl 版的~ :P

Comment by Tsung (10/26/2008 02:45)

this is comment icon 亂碼 [回覆]

請問在linux上面語系要設成什麼呢 ?
我也出現亂碼了 謝謝

Comment by ryan (11/11/2008 20:44)

this is comment icon 回 ryan [回覆]

UTF-8

Comment by Tsung (11/11/2008 22:04)
Add this page to del.icio.us Add this page to Yahoo Taiwan's bookmark Add this page to MyShare

發表迴響

標題

內容 (限制 1000 字)

暱稱

電子郵件

個人網頁


 authimage


PS: 若無法留言, 請先確認是否有打開 JavaScript, 造成您的困擾, 實在萬分對不起 Orz...(如果無法留言, 勞煩可以發信給我好嗎? 謝謝.)
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~