This repo is not currently supported as intent classifier became a part of DeepPavlov open-source library.

Try it here.

Neural Networks for Intent Classifier

In this repo one can find code for training and infering intent classification that is presented as shallow-and-wide Convolutional Neural Network[1].

Currently considered fasttext version in this repo does not works on Windows correctly.

Also this repo contains pre-trained model for intent classification on SNIPS dataset

SNIPS dataset considers the following intents: AddToPlaylist, BookRestaurant, GetWeather, PlayMusic, RateBook, SearchCreativeWork, SearchScreeningEvent.

Test results on SNIPS dataset

Test results for other intent recognition services are from

How to install

First of all, one have to download this repo:

git clone

cd intent_classifier

The next step is to install requirements:

pip install -r requirements.txt

How to use pre-trained model (SNIPS)

Now one is able to infer pre-trained model:

./ ./snips_pretrained/snips_config.json

The script loads pre-trained model, if necessary downloads pre-trained fastText embedding model [2], and then it is ready to predict class and probability of given phrase to belong with this class.


./ ./snips_pretrained/snips_config.json
>I want you to add 'I love you, baby' to my playlist
>(0.99986315, 'AddToPlaylist')

How to train on your own data

The repo contains script for training multilabel classifier.
Training data file should be presented in the following data.csv form:

request class_0 class_1 class_2 class_3 ...
text_0 1 0 0 0 ...
text_1 0 0 1 0 ...
text_2 0 1 0 0 ...
text_3 1 0 0 0 ...
... ... ... ... ... ...

Then one is ready to run that includes reading data, tokenization, constructing data, building dataset, initializing and training model with given parameters on dataset from data.csv:

./ config.json data.csv 

The model will be trained using parameters from config.json file. There is a description of several parameters:

How to infer

Infering can be done in two ways:

./ config.json


./ config.json

The first one runs file that contains reading parameters from config.json file, initializing tokenizer, initializing and infering model. The second one is doing the same but reads samples from command line.


[1] Kim Y. Convolutional neural networks for sentence classification //arXiv preprint arXiv:1408.5882. – 2014.

[2] P. Bojanowski, E. Grave, A. Joulin, T. Mikolov, Enriching Word Vectors with Subword Information.