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 (Union[str, pathlib.Path]) –

Return type

Iterator[wn.project.Package]

wn.project.is_package_directory(path)

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

Parameters

path (Union[str, pathlib.Path]) –

Return type

bool

wn.project.is_collection_directory(path)

Return True if path appears to be a wordnet collection.

Parameters

path (Union[str, pathlib.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 (Union[str, pathlib.Path]) –

resource_file()

Return the path of the package's resource file.

Return type

pathlib.Path

readme()

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

Return type

Optional[pathlib.Path]

license()

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

Return type

Optional[pathlib.Path]

citation()

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

Return type

Optional[pathlib.Path]

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 (Union[str, pathlib.Path]) –

packages()

Return the list of packages in the collection.

Return type

List[wn.project.Package]

readme()

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

Return type

Optional[pathlib.Path]

license()

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

Return type

Optional[pathlib.Path]

citation()

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

Return type

Optional[pathlib.Path]