[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-users:33451] How to use dictionary databases (was: [Translate] Debian Weekly News 2002/6/18)



In message [debian-doc:02917], on Sun, 23 Jun 2002,
Tatsuya Kinoshita <tats@xxxxxxxxxx> wrote:

> FOLDOC (dict-foldoc)では次のように書かれています。
> 
> | beamer
> | 
> |         <hardware, jargon> A video projector that can be connected to
> |         a computer instead of, or as well as, a {monitor}, and used
> |         for making presentations.

参考までに、dict-foldocの使い方を紹介しておきます。

  # apt-get install dictd dict dict-foldoc
    (/etc/dictd.confと/etc/dict.confの内容を確認。必要に応じて変更)
  $ dict beamer

dict-foldoc以外にも、dict-jargon, dict-wnなどの辞書が同様に利用
できます。

  $ apt-cache show dictd
  $ apt-cache search ^dict-
  # apt-get install dict-jargon
  $ dict "free software"

Emacsen上での検索にはlookup-elが使えます。

  # apt-get install lookup-el

-- ~/.lookup -- 
(setq lookup-search-agents 
      '((ndic "/usr/share/dictd")))
---- 

M-x lookup f beamer RETで「beamer」を検索できます。

また個人的には下記のような設定により、C-c lでカーソル位置の単語を、
C-u C-c lでリージョンを検索対象にしています。

-- ~/.emacs -- 
(autoload 'my-lookup-word "lookup" nil t)
(global-set-key "\C-cl" 'my-lookup-word)
(setq lookup-enable-splash nil)
---- 

-- ~/.lookup -- 
;;; .lookup  -*- Mode: Emacs-Lisp -*-
;; This file is written by Tatsuya Kinoshita.  Copyright is disclaimed.

(defun my-lookup-word (&optional arg)
  (interactive "P")
  (if arg
      (my-lookup-region)
    (my-lookup-read-from-minibuffer (lookup-current-word))))

(defun my-lookup-region ()
  (interactive)
  (my-lookup-read-from-minibuffer
   (buffer-substring-no-properties (or (mark) (point)) (point))))

(defun my-lookup-read-from-minibuffer (&optional string)
  (if (null string) (setq string ""))
  (while (string-match "[\n\t]+" string)
    (setq string (replace-match " " nil t string)))
  (while (string-match "  +" string)
    (setq string (replace-match " " nil t string)))
  (while (string-match "\\(^ \\| $\\)" string)
    (setq string (replace-match "" nil t string)))
  (lookup-pattern (read-from-minibuffer "Lookup: " string)))

(setq lookup-default-method 'prefix) ;; 'exact
(setq lookup-default-dictionary-options '((:stemmer .  stem-english)))

(setq lookup-search-agents 
      '(
	(ndic "/usr/share/dictd")
	;;(ndic "/usr/local/share/dictd")
	;;(ndtp "localhost")
	))

(setq lookup-search-modules
      '(
	("normal"
	 "ndic+/usr/share/dictd:"
	 ;;"ndic+/usr/local/share/dictd:"
	 ;;"ndtp+localhost:jargon/jargon"
	 )
	("all" "")
	))

;;; .lookup ends here
---- 

-- 
木下達也