Command Line Interface

Some of Wn's functionality is exposed via the command line.

Global Options

-d DIR, --dir DIR

Change to use DIR as the data directory prior to invoking any commands.

Subcommands

download

Download and add projects to the database given one or more project specifiers or URLs.

$ python -m wn download oewn:2021 omw:1.4 cili
$ python -m wn download https://en-word.net/static/english-wordnet-2021.xml.gz
--index FILE

Use the index at FILE to resolve project specifiers.

$ python -m wn download --index my-index.toml mywn
--no-add

Download and cache the remote file, but don't add it to the database.

lexicons

The lexicons subcommand lets you quickly see what is installed:

$ python -m wn lexicons
omw-en       1.4     [en]    OMW English Wordnet based on WordNet 3.0
omw-sk       1.4     [sk]    Slovak WordNet
omw-pl       1.4     [pl]    plWordNet
omw-is       1.4     [is]    IceWordNet
omw-zsm      1.4     [zsm]   Wordnet Bahasa (Malaysian)
omw-sl       1.4     [sl]    sloWNet
omw-ja       1.4     [ja]    Japanese Wordnet
...
-l LG, --lang LG
--lexicon SPEC

The --lang or --lexicon option can help you narrow down the results:

$ python -m wn lexicons --lang en
oewn      2021    [en]    Open English WordNet
omw-en    1.4     [en]    OMW English Wordnet based on WordNet 3.0
$ python -m wn lexicons --lexicon "omw-*"
omw-en    1.4     [en]    OMW English Wordnet based on WordNet 3.0
omw-sk    1.4     [sk]    Slovak WordNet
omw-pl    1.4     [pl]    plWordNet
omw-is    1.4     [is]    IceWordNet
omw-zsm   1.4     [zsm]   Wordnet Bahasa (Malaysian)

projects

The projects subcommand lists all known projects in Wn's index. This is helpful to see what is available for downloading.

$ python -m wn projects
ic      cili    1.0     [---]   Collaborative Interlingual Index
ic      oewn    2025+   [en]    Open English WordNet
ic      oewn    2025    [en]    Open English WordNet
ic      oewn    2024    [en]    Open English WordNet
ic      oewn    2023    [en]    Open English WordNet
ic      oewn    2022    [en]    Open English WordNet
ic      oewn    2021    [en]    Open English WordNet
ic      ewn     2020    [en]    Open English WordNet
ic      ewn     2019    [en]    Open English WordNet
ic      odenet  1.4     [de]    Open German WordNet
i-      odenet  1.3     [de]    Open German WordNet
ic      omw     2.0     [mul]   Open Multilingual Wordnet
ic      omw     1.4     [mul]   Open Multilingual Wordnet
...

validate

Given a path to a WN-LMF XML file, check the file for structural problems and print a report.

$ python -m wn validate english-wordnet-2021.xml
--select CHECKS

Run the checks with the given comma-separated list of check codes or categories.

$ python -m wn validate --select E W201 W204 deWordNet.xml
--output-file FILE

Write the report to FILE as a JSON object instead of printing the report to stdout.