Skip to content

CLI Reference

odict [OPTIONS] <COMMAND>

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

OptionDescription
-q, --quietSilence any non-important output
-h, --helpPrint help
-V, --versionPrint 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>
ArgumentRequiredDescription
nameYesName of the alias
pathYesDictionary path
FlagDescription
-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>
ArgumentRequiredDescription
nameYesName of the alias
pathYesDictionary path
FlagDescription
-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>
ArgumentRequiredDescription
nameYesName of the alias

Compiles a dictionary from ODXML.

odict compile [OPTIONS] <INPUT>
ArgumentRequiredDescription
inputYesPath to ODXML file
FlagDescription
-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>
ArgumentRequiredDescription
dictionaryYesDictionary to download (e.g., ‘wiktionary/eng’)
FlagDescription
-o <OUTPUT>, --output <OUTPUT>Directory to download the dictionary to (defaults to config directory)
--no-cacheDisable 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>
ArgumentRequiredDescription
inputYesPath to a compile dictionary
FlagDescription
-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>
ArgumentRequiredDescription
dictionaryYesPath to a compiled dictionary or an alias
FlagDescription
-d <DIRECTORY>Custom directory to store the index
-fWhether 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>
ArgumentRequiredDescription
dictionary_pathYesPath to a compiled dictionary
FlagDescription
-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>
ArgumentRequiredDescription
dictionaryYesPath to a compiled dictionary
FlagDescription
-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>...
ArgumentRequiredDescription
dictionary_pathYesPath to a compiled dictionary
queriesYesWords to look up
FlagDescription
-f <FORMAT>, --format <FORMAT>Output format of the entries (default: print)
-F, --followFollow 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, --insensitivePerform 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>...
ArgumentRequiredDescription
destinationYesPath of the dictionary to merge into (unless —output is specified)
sourcesYesPaths of dictionaries to merge
FlagDescription
-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>
ArgumentRequiredDescription
file_nameYesName of your new dictionary file
FlagDescription
-n <NAME>Name attribute of the dictionary element

Run a full-text query on a compiled dictionary.

odict search [OPTIONS] <DICTIONARY> <QUERY>
ArgumentRequiredDescription
dictionaryYesPath to a compiled dictionary or an alias
queryYesSearch query
FlagDescription
-f <FORMAT>, --format <FORMAT>Format in which to print the results (default: json)
--indexCreates 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]...
ArgumentRequiredDescription
dictionariesNoDictionary files or directories containing .odict files
FlagDescription
-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.

ParameterTypeRequiredDescription
qstringYesTerm or comma-separated terms to look up
followbooleanNoFollow see cross-references
splitnumberNoMinimum character length for fallback splitting
ParameterTypeRequiredDescription
qstringYesFull-text search query
limitnumberNoMaximum number of results
ParameterTypeRequiredDescription
qstringYesTerm or comma-separated terms to split
followbooleanNoFollow see cross-references
min_lengthnumberNoMinimum character length for each segment
ParameterTypeRequiredDescription
textstringYesText to tokenize
followbooleanNoFollow 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>...
ArgumentRequiredDescription
dictionary_pathYesPath to a compiled dictionary
queriesYesText to split into dictionary words
FlagDescription
-f <FORMAT>, --format <FORMAT>Output format of the entries (default: print)
-F, --followFollow 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, --insensitivePerform 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>
ArgumentRequiredDescription
dictionary_pathYesPath to a compiled dictionary
textYesText to tokenize
FlagDescription
-f <FORMAT>, --format <FORMAT>Output format of the entries (default: print)
-F, --followFollow see_also redirects until finding an entry with etymologies
-i, --insensitivePerform case-insensitive lookups when matching tokens
-r <RETRIES>, --retries <RETRIES>Number of times to retry loading the dictionary (remote-only) (default: 3)