autointent.modules.regex.SimpleRegex#
- class autointent.modules.regex.SimpleRegex#
Bases:
autointent.modules.base.BaseRegex
Regular expressions based intent detection module.
A module that uses regular expressions to detect intents in text utterances. Supports both full and partial pattern matching.
- name = 'simple'#
Name of the module.
- supports_multiclass = True#
Whether the module supports multiclass classification
- supports_multilabel = True#
Whether the module supports multilabel classification
- supports_oos = False#
Whether the module supports oos data
- classmethod from_context(context)#
Initialize from context.
- Parameters:
context (autointent.Context) – Context object containing configuration
- Returns:
Initialized SimpleRegex instance
- Return type:
- fit(intents)#
Fit the model with intent patterns.
- Parameters:
intents (list[autointent.schemas.Intent]) – List of intents to fit the model with
- Return type:
None
- predict(utterances)#
Predict intents for given utterances.
- predict_with_metadata(utterances)#
Predict intents for utterances with pattern matching metadata.
- score_ho(context, metrics)#
Score the model using holdout validation.
- score_cv(context, metrics)#
Score the model in cross-validation mode.
- score_metrics_cv(metrics_dict, cv_iterator, intents)#
Score metrics using cross-validation.
- Parameters:
metrics_dict (dict[str, Any]) – Dictionary of metrics to compute
cv_iterator (collections.abc.Iterable[tuple[list[str], autointent.custom_types.ListOfLabels, list[str], autointent.custom_types.ListOfLabels]]) – Cross-validation iterator
intents (list[autointent.schemas.Intent]) – intents from the dataset
- Returns:
Tuple of metrics dictionary and predictions
- Return type:
tuple[dict[str, float], list[autointent.custom_types.ListOfGenericLabels] | list[numpy.typing.NDArray[Any]]]
- clear_cache()#
Clear cached regex patterns.
- Return type:
None
- get_assets()#
Get model assets.
- Returns:
Empty Artifact object
- Return type:
- dump(path)#
Dump all data needed for inference.
- Parameters:
path (str) – Path to dump
- Return type:
None
- load(path, embedder_config=None, cross_encoder_config=None)#
Load data from file system.
- Parameters:
path (str) – Path to load
embedder_config (autointent.configs.EmbedderConfig | None) – one can override presaved settings
cross_encoder_config (autointent.configs.CrossEncoderConfig | None) – one can override presaved settings
- Return type:
None