Dico |
|
GNU Dictionary Server |
Sergey Poznyakoff |
7.1 Single Query Mode
The simplest way to use dico
utility is to invoke it with
a word as an argument, e.g.:
$ dico entdeckung
In the example above, the utility will search definitions of the word ‘entdeckung’ using its default server name and database. The default server name is read from the initialization file (see Initialization File). If it is not present, a predefined value specified at configuration time (see Default Server) is used. The default database is ‘!’, which means “search in all available databases until a match is found, and then display all matches in that database”.
There are two ways to change these defaults. First, you can use command line options. Secondly, you can use a DICT URL. Which method to use depends on your preferences. Both methods provide the same functionality for querying word definitions. However, command line options allow the user to query additional data from the server, which is impossible using URLs.
7.1.1 Dico Command Line Options
To connect to a particular dictionary server, use the --host option, for example:
$ dico --host dico.org entdeckung
To search in a particular database, use the --database (-d) option. For example, to display definitions from all databases:
$ dico --database '*' entdeckung
Note single quotes around the asterisk.
To get a list of databases offered by the server, use the --dbs (-D) option. In this case you may not give any non-option arguments. For example:
$ dico --dbs
If you wish to get a list of matches, instead of definitions, use the --match (-m) option. For example, the following invocation will display all matches from all the databases:
$ dico --database '*' --match entdeckung
The match mode uses ‘.’ strategy by default (see strategy), which means a server-dependent default strategy, which suits best for interactive spell checking. To select another strategy, use the --strategy (-s) option.
If the remote server supports ‘xlev’ experimental capability (see XLEV, you may use the --levdist (--levenshtein-distance) option to set maximum Levenshtein distance, for example:
$ dico --levdist 2 --match entdeckung
Note that setting the distance too high is impractical and may imply unnecessary strain on the server.
To get a list of available matching strategies, with descriptions, use the --strategies (-S) option.
7.1.2 DICT URL
Another way to specify data for a query is by using URL, instead of a word to search, as in the example below:
$ dico dict://gnu.org.ua/d:entdeckung
A DICT URL consists of the following parts:
dict://user;pass@host:port/d:word:database:n dict://user;pass@host:port/m:word:database:strat:n
The ‘/d’ syntax requests the definition of word, whereas the ‘/m’ syntax queries for matches, and is similar to the --match option. Some or all of ‘user;pass@’, ‘:port’, database, strat, and and n may be omitted. The meaning of all URL parts and their default values (if appropriate) are explained in the table below:
- user
The user name to use in authentication. Similar to the --user option. If user is omitted and cannot be retrieved by other means, no authentication is attempted. See Autologin, for a detailed description of authentication procedure and sources which are used to obtain authentication credentials.
- pass
A shared key (password) for that user. This part is similar to the --key command line option.
For compatibility with other URLs,
dico
tolerates a colon (instead of semicolon) as a delimiter between user and pass.If user is given, but pass is not,
dico
will ask you to supply a password interactively (see Autologin).- host
Host name, IPv4 address, or IPv6 address (in square brackets) of the server to query. Same as the --host command line option.
- port
Port number or service name (from /etc/services). If it is not present, the default of 2628 is used.
Same as the --port command line option.
- word
The word to look for.
- database
The database to search in. If not given, ‘!’ is assumed.
Same as the --database command line option.
- strat
The matching strategy to use. If omitted, ‘.’ is assumed.
Same as the --strategy command line option.
- n
Extract and display the nth definition of the word. If omitted, all definitions are displayed.
There is no command line option equivalent for this parameter, because it is used rarely.
Trailing colons may be omitted. For example, the following URLs might specify definitions or matches:
dict://dict.org/d:shortcake: dict://dict.org/d:shortcake:* dict://dict.org/d:shortcake:wordnet: dict://dict.org/d:shortcake:wordnet:1 dict://dict.org/d:abcdefgh dict://dict.org/d:sun dict://dict.org/d:sun::1 dict://dict.org/m:sun dict://dict.org/m:sun::soundex dict://dict.org/m:sun:wordnet::1 dict://dict.org/m:sun::soundex:1 dict://dict.org/m:sun:::
This document was generated on September 4, 2020 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.