Skip to content

exceptions

Custom exceptions for the CLTK library.

CLTKException

Bases: Exception

Base exception class for CLTK.

Examples:

from cltk.core.exceptions import CLTKException

raise CLTKException()

UnimplementedAlgorithmError

Bases: CLTKException

Raised when a language is supported but a specific algorithm is missing.

Examples:

from cltk.core.exceptions import UnimplementedAlgorithmError

raise UnimplementedAlgorithmError()

UnknownLanguageError

Bases: CLTKException

Raised when a user requests a language unknown or not implemented.

All known languages at cltk.languages.glottolog.py. Implemented languages include those at cltk.languages.pipelines and some miscellaneously implemented throughout the library.

Examples:

from cltk.core.exceptions import UnknownLanguageError

raise UnknownLanguageError()

CorpusImportError

Bases: Exception

Raised when something goes wrong importing corpora.

OpenAIInferenceError

Bases: CLTKException

Raised when OpenAI inference fails or returns an invalid response.

MistralInferenceError

Bases: CLTKException

Raised when Mistral inference fails or returns an invalid response.