emacs中查詢英漢字典

2021-07-02 20:26:56 字數 922 閱讀 2858

在用emacs查閱文件或上網的時候時常會遇到不認識的英文單詞,若老是要切換到xdict查尋單詞再切回emacs則顯得太過繁瑣。所幸,使用dict/dictd工具和dictionary.el可以實現直接在emacs中查詢英文單詞的釋義。

1. 安裝dict/dictd

ubuntu下可以直接用apt-get安裝

sudo apt-get install dict dictd
2. 安裝英文-中文字典

sudo apt-get install dict-xdict dict-stardic
3. 安裝dictionary.el外掛程式

在emacs中執行m-x package-list-packages

在列出的package中搜尋dictionary

按i表示安裝,按x表示執行安裝,就自動把dictionary.el安裝到emacs中了

4. 配置

預設dictionary.el會把dictd伺服器位址配置為dict.org。由於我們是在本地搭建了dictd伺服器,因此需要修改配置資訊,指定dictd伺服器為localhost。另外為了方便使用,也可以配置一些快捷鍵。

在.emacs中輸入配置

(global-set-key [mouse-3] 'dictionary-mouse-popup-matching-words)

(global-set-key [(control c)(d)] 'dictionary-lookup-definition)

(global-set-key [(control c)(s)] 'dictionary-search)

(global-set-key [(control c)(m)] 'dictionary-match-words)

(setq dictionary-server "localhost")

Python爬蟲之自製英漢字典

針對上述過程,對於熟悉爬蟲的讀者來說,是不難完成將輸入的單詞的中文意思從網頁中提取出來的。筆者的 如下 import requests from bs4 import beautifulsoup get word from command line word input enter a word e...

7 5 英漢字典之 初級版

任務描述在這裡插入 片 請設計乙個簡單的英漢字典實現從英文到漢語的翻譯。輸入第一行包含乙個數字n 1 n 100 表示字典中詞條的數目。每個詞條的第乙個空格前是乙個英文單詞,其後為中文解釋。英文單詞的字母個數不超過50個。中文解釋的長度不超過200個漢字 包括標點和空格 緊接著乙個整數k 1 k n...

Delphi中實現漢字拼音聲母查詢

delphi中實現漢字拼音聲母查詢,unit 如下 unit unit1 inte ce uses windows,messages,sysutils,classes,graphics,controls,forms,dialogs,stdctrls type tform1 class tform l...