# deeppavlov.models.intent_catcher¶

class deeppavlov.models.intent_catcher.intent_catcher.IntentCatcher(save_path: Union[str, pathlib.Path], load_path: Union[str, pathlib.Path], embeddings: str = 'use', limit: int = 10, multilabel: bool = False, number_of_layers: int = 0, number_of_intents: int = 1, hidden_dim: int = 256, mode: str = 'train', **kwargs)[source]

Class for IntentCatcher Chainer’s pipeline components.

__init__(save_path: Union[str, pathlib.Path], load_path: Union[str, pathlib.Path], embeddings: str = 'use', limit: int = 10, multilabel: bool = False, number_of_layers: int = 0, number_of_intents: int = 1, hidden_dim: int = 256, mode: str = 'train', **kwargs)None[source]

Initializes IntentCatcher model.

This model is mainly used for user intent detection in conversational systems. It provides some BERT-based embeddings for start and then fits a number of dense layers upon them for labels prediction. The main feature is that the user can provide regular expressions instead of actual phrases, and the model will derive phrases from it, thus making construction of the dataset easy and fast. The number of phrases generated from regexp is control by limit parameter.

Parameters
• save_path – Path to a directory with pretrained classifier and regexps for IntentCatcher.

• load_path – Path to a directory with pretrained classifier and regexps for IntentCatcher.

• embeddings – Input embeddings type. Provided embeddings are: USE and USE Large.

• limit – Maximum number of phrases, that are generated from input regexps.

• multilabel – Whether the task should be multilabel prediction or multiclass.

• number_of_layers – Number of hidden dense layers, that come after embeddings.

• number_of_intents – Number of output labels.

• hidden_dim – Dimension of hidden dense layers, that come after embeddings.

• mode – Train or infer mode. If infer - tries to load data from load_path.

• **kwargs – Additional parameters whose names will be logged but otherwise ignored.

__call__(x: List[str]) → List[int][source]

Predict probabilities.

Parameters

x – list of input sentences.

Returns

list of probabilities.