wn.validate

Wordnet lexicon validation.

This module is for checking whether the the contents of a lexicon are valid according to a series of checks. Those checks are:

Code

Message

E101

ID is not unique within the lexicon.

W201

Lexical entry has no senses.

W202

Redundant sense between lexical entry and synset.

W203

Redundant lexical entry with the same lemma and synset.

E204

Synset of sense is missing.

W301

Synset is empty (not associated with any lexical entries).

W302

ILI is repeated across synsets.

W303

Proposed ILI is missing a definition.

W304

Existing ILI has a spurious definition.

E401

Relation target is missing or invalid.

W402

Relation type is invalid for the source and target.

W403

Redundant relation between source and target.

W404

Reverse relation is missing.

W501

Synset's part-of-speech is different from its hypernym's.

W502

Relation is a self-loop.

wn.validate.validate(lex, select=('E', 'W'), progress_handler=<class 'wn.util.ProgressBar'>)

Check lex for validity and return a report of the results.

The select argument is a sequence of check codes (e.g., E101) or categories (E or W).

The progress_handler parameter takes a subclass of wn.util.ProgressHandler. An instance of the class will be created, used, and closed by this function.

Parameters
Return type

Dict[str, Dict[str, Union[str, Dict[str, Dict]]]]