β¨ Common#
- exception text_machina.src.common.exceptions.CombinedEmptyExtractors[source]#
Bases:
TextMachinaError
Raised when combined extractor is called without a list of extractors.
- exception text_machina.src.common.exceptions.DatasetGenerationError(msg)[source]#
Bases:
TextMachinaError
Raised when an error ocurrs in dataset generators.
- exception text_machina.src.common.exceptions.ExtractorEmptyColumns(extractor, field)[source]#
Bases:
TextMachinaError
Raised when an extractor returns empty lists in any field.
- exception text_machina.src.common.exceptions.ExtractorInvalidArgs(extractor, extractor_args)[source]#
Bases:
TextMachinaError
Raised when mandatory arguments for an extractor are invalid or not provided.
- exception text_machina.src.common.exceptions.InvalidExtractor(extractor)[source]#
Bases:
TextMachinaError
Raised when an extractor is not allowed.
- exception text_machina.src.common.exceptions.InvalidInferenceServer(inference_server, allowed)[source]#
Bases:
TextMachinaError
Raised when an inference server type is not valid for the InferenceServerModel.
- exception text_machina.src.common.exceptions.InvalidLanguage[source]#
Bases:
TextMachinaError
Raised when a language is not a valid ISO 639-1 code.
- exception text_machina.src.common.exceptions.InvalidMetric(metric)[source]#
Bases:
TextMachinaError
Raised when a metric is not allowed.
- exception text_machina.src.common.exceptions.InvalidModelParam(msg)[source]#
Bases:
TextMachinaError
Raised when a parameter for a text generation model is invalid.
- exception text_machina.src.common.exceptions.InvalidProvider(provider)[source]#
Bases:
TextMachinaError
Raised when a provider is not allowed.
- exception text_machina.src.common.exceptions.InvalidSpacyModel(language)[source]#
Bases:
TextMachinaError
Raised when an Spacy model does not exist for a language.
- exception text_machina.src.common.exceptions.InvalidTaskTypeForMetric(metric, task_type)[source]#
Bases:
TextMachinaError
Raised when a metric canβt be used due to inadequate task type.
- exception text_machina.src.common.exceptions.MissingIntegrationError(integration)[source]#
Bases:
TextMachinaError
Raised when an integration canβt be used due to missing dependencies.
- exception text_machina.src.common.exceptions.MissingMetricError(metric)[source]#
Bases:
TextMachinaError
Raised when a metric canβt be used due to missing dependencies.
- exception text_machina.src.common.exceptions.TextMachinaError[source]#
Bases:
Exception
Base class for TextMachina exceptions.
- exception text_machina.src.common.exceptions.UnsupportedMetricParam(param_name, metric_name)[source]#
Bases:
TextMachinaError
Raised when a metric param cannot be used.
This is not for cases where an incorrect parameter name is provided, rather when a parameter is correct but cannot be used.
See ..metrics.mauve.MAUVEMetric for an example.
- text_machina.src.common.logging.get_logger(module_name)[source]#
Returns the logger used across TextMachina modules.
- Parameters:
module_name (str) β name of the module.
- Returns:
the logger.
- Return type:
- text_machina.src.common.utils.get_cache_path()[source]#
Get the TextMachina folder for caching intermediate results.
- Returns:
cache path.
- Return type:
Path
- text_machina.src.common.utils.get_instantiation_args(fn, args, accepted_params=None)[source]#
Extracts the arguments from args that match the parameters of the fn function.
- Parameters:
fn (Callable) β a function.
args (Dict) β a dictionary of arguments.
accepted_params (Optional[List[str]]) β if known, the list of params accepted by fn. If accepted_params is provided, the fn argument will not be used to infer the accepted parameters.
- Returns:
arguments in args that match the fn parameters.
- Return type:
Dict