autointent.modules.regexp.RegExp#

class autointent.modules.regexp.RegExp#

Bases: autointent.modules.abc.Module

Regular expressions based intent detection module.

classmethod from_context(context)#

Initialize from context.

Parameters:

context (autointent.Context)

Return type:

RegExp

fit(intents)#

Fit the model.

Parameters:

intents (list[dict[str, Any]]) – Intents to fit

Return type:

None

predict(utterances)#

Predict intents for utterances.

Parameters:

utterances (list[str]) – Utterances to predict

Return type:

list[autointent.custom_types.LabelType]

predict_with_metadata(utterances)#

Predict intents for utterances with metadata.

Parameters:

utterances (list[str]) – Utterances to predict

Return type:

tuple[list[autointent.custom_types.LabelType], list[dict[str, Any]] | None]

score(context, split, metric_fn)#

Calculate metric on test set and return metric value.

Parameters:
Return type:

float

clear_cache()#

Clear cache.

Return type:

None

get_assets()#

Get assets.

Return type:

autointent.context.optimization_info.Artifact

load(path)#

Load data from dump.

Parameters:

path (str) – Path to load

Return type:

None

dump(path)#

Dump all data needed for inference.

Parameters:

path (str) – Path to dump

Return type:

None