describe-word - Display a dictionary definition of a word
describe-word "word"
describe-word can be used to interface to an external dictionary to get a definition of a given word. The interface has two modes of interface, the first simply launches an external program which provides the definition in its own user interface, e.g. MS Bookshelf. The second interface launches an external program which prints out the definition to stdout, MicroEmacs can then pull out the definition and display it in describe-word's own GUI.
When executed describe-word will use the current word under the cursor as the initial word or will prompt the user if the cursor is not in a word.
When describe-word's dialog is used the information presented is defined as follows:
Word
Insert
Exit
Main definition box
describe-word is a macro implemented in word.emf.
Due to the size and availability of dictionaries etc. MicroEmacs is released without describe-word set up, the user must setup it up.
describe-word must be setup for each required language as follows:
1)
A () The first letter of the English... Aam (n.) A Dutch and German measure of liquids... Aardvark (n.) An edentate mammal... . .
The grep command-line interface required to look-up the word "aardvark" would be:
grep -i "^aardvark (" words.txt
The output produced from this will be the single line giving the required definition. A second common interface would be executing an external dictionary program typically using a command-line option to specify the word to define, e.g.:
mydict -d "aardvark"
2)
3)
set-variable .describe-word.american-command ... ... "grep -i \"^%s (\" /tmp/words.txt"
For the second example:
set-variable .describe-word.american-command "mydict -d \"%s (\""
4)
The variable .describe-word.<language>-search must be set to a regex search pattern which will match the required definition(s) in the command out put, the first group ("\(...\)") must enclose the required definition, again "%s" can be used in place of the word and "%%" for a single "%". describe-word simply uses search-buffer(2) repeatedly to find all definitions of the current word, it then uses the value of the variable @s1(4) to get the individual definitions. For example for the first example the following is required:
set-variable .describe-word.american-search "^\(%s (.*\)\n"
Note that the word being defined should be kept in the definition if possible as the spell rules are used to look-up base words when a derivitive of a word is not found, therefore the word being defined may not be clear (e.g. deactivate can be derived from activate but their meanings are very different). Also long text lines are automatically wrapped by the GUI.
The required variables should be added to the user setup file.
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12