wn.project

Wordnet and ILI Packages and Collections

wn.project.iterpackages(path: str | Path) Iterator[Package]

Yield any wordnet or ILI packages found at path.

The path argument can point to one of the following:
  • a lexical resource file or ILI file

  • a wordnet package directory

  • a wordnet collection directory

  • a tar archive containing one of the above

  • a compressed (gzip or lzma) resource file or tar archive

wn.project.is_package_directory(path: str | Path) bool

Return True if path appears to be a wordnet or ILI package.

wn.project.is_collection_directory(path: str | Path) bool

Return True if path appears to be a wordnet collection.

class wn.project.Package(path: str | Path)

This class represents a wordnet or ILI package – a directory with a resource file and optional metadata.

resource_file() Path

Return the path of the package's resource file.

readme() Path | None

Return the path of the README file, or None if none exists.

license() Path | None

Return the path of the license, or None if none exists.

citation() Path | None

Return the path of the citation, or None if none exists.

class wn.project.Collection(path: str | Path)

This class represents a wordnet or ILI collection – a directory with one or more wordnet/ILI packages and optional metadata.

packages() list[Package]

Return the list of packages in the collection.

readme() Path | None

Return the path of the README file, or None if none exists.

license() Path | None

Return the path of the license, or None if none exists.

citation() Path | None

Return the path of the citation, or None if none exists.