Skip to content

CLI Reference

odict [OPTIONS] <COMMAND>

The ODict CLI is the primary tool for creating, compiling, and querying ODict dictionaries.

Option Description
-q, --quiet Silence any non-important output
-h, --help Print help
-V, --version Print version

Manage dictionary aliases.

odict alias <COMMAND>

Attempts to create a new dictionary alias, failing if one already exists with the given name.

odict alias add [OPTIONS] <NAME> <PATH>
Argument Required Description
name Yes Name of the alias
path Yes Dictionary path
Flag Description
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Creates or updates an existing dictionary alias.

odict alias set [OPTIONS] <NAME> <PATH>
Argument Required Description
name Yes Name of the alias
path Yes Dictionary path
Flag Description
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Deletes an alias with the given name if it exists.

odict alias delete <NAME>
Argument Required Description
name Yes Name of the alias

Compiles a dictionary from ODXML.

odict compile [OPTIONS] <INPUT>
Argument Required Description
input Yes Path to ODXML file
Flag Description
-o <OUTPUT> Output path of compiled dictionary
-q <QUALITY> Brotli compression level (between 0 and 11) (default: 8)
-w <WINDOW_SIZE> Brotli large window size (between 0 and 22) (default: 22)

Downloads a dictionary from the remote registry.

odict download [OPTIONS] <DICTIONARY>
Argument Required Description
dictionary Yes Dictionary to download (e.g., ‘wiktionary/eng’)
Flag Description
-o <OUTPUT>, --output <OUTPUT> Directory to download the dictionary to (defaults to config directory)
--no-cache Disable caching (always download fresh copy)
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Outputs a dictionary in a human-readable format.

odict dump [OPTIONS] <INPUT>
Argument Required Description
input Yes Path to a compile dictionary
Flag Description
-f <FORMAT> Format in which to dump the dictionary. (default: xml)
-o <OUTPUT> Output path of the dump. Defaults to stdout.
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Creates a full-text index of a compiled dictionary.

odict index [OPTIONS] <DICTIONARY>
Argument Required Description
dictionary Yes Path to a compiled dictionary or an alias
Flag Description
-d <DIRECTORY> Custom directory to store the index
-f Whether to overwrite the index if it already exists
-m <MEMORY> Memory arena per thread in bytes. Must be above 15MB (default: 15000000)
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Prints the metadata info for a dictionary file.

odict info [OPTIONS] <DICTIONARY_PATH>
Argument Required Description
dictionary_path Yes Path to a compiled dictionary
Flag Description
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Lists all words defined in a dictionary.

odict lexicon [OPTIONS] <DICTIONARY>
Argument Required Description
dictionary Yes Path to a compiled dictionary
Flag Description
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Looks up an entry in a compiled dictionary without indexing.

odict lookup [OPTIONS] <DICTIONARY_PATH> <QUERIES>...
Argument Required Description
dictionary_path Yes Path to a compiled dictionary
queries Yes Words to look up
Flag Description
-f <FORMAT>, --format <FORMAT> Output format of the entries (default: print)
-F, --follow Follow see_also redirects until finding an entry with etymologies
-s <SPLIT>, --split <SPLIT> If a definition cannot be found, attempt to split the query into words of at least length S and look up each word separately. Can be relatively slow. (default: 0)
-i, --insensitive Perform case-insensitive lookups
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Merge entries from multiple dictionaries into a destination dictionary.

odict merge [OPTIONS] <DESTINATION> <SOURCES>...
Argument Required Description
destination Yes Path of the dictionary to merge into (unless –output is specified)
sources Yes Paths of dictionaries to merge
Flag Description
-o <OUTPUT>, --output <OUTPUT> Separate output path for the compiled dictionary
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Scaffolds a new ODict XML dictionary.

odict new [OPTIONS] <FILE_NAME>
Argument Required Description
file_name Yes Name of your new dictionary file
Flag Description
-n <NAME> Name attribute of the dictionary element

Run a full-text query on a compiled dictionary.

odict search [OPTIONS] <DICTIONARY> <QUERY>
Argument Required Description
dictionary Yes Path to a compiled dictionary or an alias
query Yes Search query
Flag Description
-f <FORMAT>, --format <FORMAT> Format in which to print the results (default: json)
--index Creates a new index if one doesn’t already exist
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Start a local web server to serve one or several dictionaries.

odict serve [OPTIONS] [DICTIONARIES]...
Argument Required Description
dictionaries No Dictionary files or directories containing .odict files
Flag Description
-p <PORT> Port to listen on (default: 5005)
-c <CAPACITY>, --capacity <CAPACITY> Maximum number of dictionaries to keep in memory (default: 5)
-l <LEVEL>, --level <LEVEL> Log level (trace, debug, info, warn, or error)

When running serve, the following REST endpoints become available. All return JSON.

Parameter Type Required Description
q string Yes Term or comma-separated terms to look up
follow boolean No Follow see cross-references
split number No Minimum character length for fallback splitting
Parameter Type Required Description
q string Yes Full-text search query
limit number No Maximum number of results
Parameter Type Required Description
q string Yes Term or comma-separated terms to split
follow boolean No Follow see cross-references
min_length number No Minimum character length for each segment
Parameter Type Required Description
text string Yes Text to tokenize
follow boolean No Follow see cross-references for matched tokens

Splits text into component dictionary words without attempting a whole-word lookup first.

odict split [OPTIONS] <DICTIONARY_PATH> <QUERIES>...
Argument Required Description
dictionary_path Yes Path to a compiled dictionary
queries Yes Text to split into dictionary words
Flag Description
-f <FORMAT>, --format <FORMAT> Output format of the entries (default: print)
-F, --follow Follow see_also redirects until finding an entry with etymologies
-m <MIN_LENGTH>, --min-length <MIN_LENGTH> Minimum character length of each split segment (default: 1)
-i, --insensitive Perform case-insensitive lookups
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)

Tokenize text and find dictionary entries for each token.

odict tokenize [OPTIONS] <DICTIONARY_PATH> <TEXT>
Argument Required Description
dictionary_path Yes Path to a compiled dictionary
text Yes Text to tokenize
Flag Description
-f <FORMAT>, --format <FORMAT> Output format of the entries (default: print)
-F, --follow Follow see_also redirects until finding an entry with etymologies
-i, --insensitive Perform case-insensitive lookups when matching tokens
-r <RETRIES>, --retries <RETRIES> Number of times to retry loading the dictionary (remote-only) (default: 3)