wn.project

Wordnet and ILI Packages and Collections

wn.project.iterpackages(path)

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

Parameters:

path (str | Path)

Return type:

Iterator[Package]

wn.project.is_package_directory(path)

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

Parameters:

path (str | Path)

Return type:

bool

wn.project.is_collection_directory(path)

Return True if path appears to be a wordnet collection.

Parameters:

path (str | Path)

Return type:

bool

class wn.project.Package(path)

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

Parameters:

path (str | Path)

resource_file()

Return the path of the package's resource file.

Return type:

Path

readme()

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

Return type:

Path | None

license()

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

Return type:

Path | None

citation()

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

Return type:

Path | None

class wn.project.Collection(path)

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

Parameters:

path (str | Path)

packages()

Return the list of packages in the collection.

Return type:

list[Package]

readme()

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

Return type:

Path | None

license()

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

Return type:

Path | None

citation()

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

Return type:

Path | None