CLI Overview

The unimorph command-line tool provides access to UniMorph morphological data through a set of intuitive subcommands.

Command Structure

unimorph [OPTIONS] <COMMAND> [ARGS]

Global Options

OptionDescription
-v, --verboseEnable debug output (-vv for trace)
-q, --quietSuppress non-essential output
-d, --data-dir <PATH>Custom data directory
-h, --helpPrint help
-V, --versionPrint version

Commands at a Glance

CommandAliasDescription
downloaddlDownload a language dataset
listlsList available/cached languages
inflectiLook up all forms of a lemma
analyzeaAnalyze a surface form (reverse lookup)
searchsSearch entries with flexible filtering
statsstShow dataset statistics
infoinShow detailed info about a language
exportxExport dataset to file
updateupUpdate cached datasets
featuresfExplore morphological features
deletermDelete a cached dataset
repairRepair or reset data store
configcfgManage configuration
completionsGenerate shell completions

Common Workflows

First-Time Setup

# See what languages are available
unimorph list --available

# Download a language
unimorph download heb

# Set as default (optional)
export UNIMORPH_LANG=heb

Looking Up Words

# All forms of a lemma
unimorph inflect -l heb כתב

# What lemma does this form come from?
unimorph analyze -l heb כתבתי

Searching

# By features
unimorph search -l heb --contains PL,MASC

# By part of speech
unimorph search -l heb --pos V --limit 20

# By lemma pattern
unimorph search -l heb --lemma "כת%"

Data Management

# Check for updates
unimorph update --all --check

# Update a specific language
unimorph update heb

# Export for external use
unimorph export -l heb -o hebrew.tsv

Output Formats

Most commands support multiple output formats:

FlagFormatUse Case
(default)TableHuman reading in terminal
--jsonJSONMachine parsing, APIs
--tsvTSVPiping to other tools

Examples

# Pretty table output
unimorph inflect -l heb כתב

# JSON for parsing
unimorph inflect -l heb כתב --json | jq '.[0]'

# TSV for piping
unimorph inflect -l heb כתב --tsv | cut -f2 | sort -u

Piping and Scripting

When output is piped (not a terminal), unimorph automatically uses pipe-friendly formats:

# Get all cached language codes
unimorph list | while read lang; do
  echo "Processing $lang..."
  unimorph stats "$lang"
done

# Export to stdout and filter
unimorph export -l heb -o - | grep "FUT" > future_forms.tsv

# Count forms per lemma
unimorph search -l heb --pos V --tsv --limit 1000 | cut -f1 | sort | uniq -c | sort -rn | head

Error Handling

Commands provide helpful error messages:

$ unimorph inflect כתב
Error: No language specified.

Provide a language code as an argument, or set a default:

  export UNIMORPH_LANG=heb

Or in ~/.config/unimorph/config.toml:

  default_lang = "heb"

Run 'unimorph list --available' to see available languages.

Getting Help

# General help
unimorph --help

# Command-specific help
unimorph inflect --help
unimorph search --help