All Projects → deepmipt → Intent_classifier

deepmipt / Intent_classifier

Licence: apache-2.0

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Intent classifier

Bidaf Keras
Bidirectional Attention Flow for Machine Comprehension implemented in Keras 2
Stars: ✭ 60 (-10.45%)
Mutual labels:  natural-language-processing, neural-networks, natural-language-understanding
Spokestack Python
Spokestack is a library that allows a user to easily incorporate a voice interface into any Python application.
Stars: ✭ 103 (+53.73%)
Mutual labels:  natural-language-processing, neural-networks, natural-language-understanding
Codesearchnet
Datasets, tools, and benchmarks for representation learning of code.
Stars: ✭ 1,378 (+1956.72%)
Mutual labels:  natural-language-processing, neural-networks, nlp-machine-learning
Nlp Pretrained Model
A collection of Natural language processing pre-trained models.
Stars: ✭ 122 (+82.09%)
Mutual labels:  natural-language-processing, neural-networks, nlp-machine-learning
Ner
Named Entity Recognition
Stars: ✭ 288 (+329.85%)
Mutual labels:  natural-language-processing, nlp-machine-learning, natural-language-understanding
Natural Language Processing Specialization
This repo contains my coursework, assignments, and Slides for Natural Language Processing Specialization by deeplearning.ai on Coursera
Stars: ✭ 151 (+125.37%)
Mutual labels:  natural-language-processing, nlp-machine-learning, natural-language-understanding
Chatbot
Русскоязычный чатбот
Stars: ✭ 106 (+58.21%)
Mutual labels:  natural-language-processing, neural-networks, natural-language-understanding
Nlp Conference Compendium
Compendium of the resources available from top NLP conferences.
Stars: ✭ 349 (+420.9%)
Mutual labels:  natural-language-processing, nlp-machine-learning, natural-language-understanding
Coursera Natural Language Processing Specialization
Programming assignments from all courses in the Coursera Natural Language Processing Specialization offered by deeplearning.ai.
Stars: ✭ 39 (-41.79%)
Mutual labels:  natural-language-processing, nlp-machine-learning, natural-language-understanding
Spacy Transformers
🛸 Use pretrained transformers like BERT, XLNet and GPT-2 in spaCy
Stars: ✭ 919 (+1271.64%)
Mutual labels:  natural-language-processing, natural-language-understanding
Ciff
Cornell Instruction Following Framework
Stars: ✭ 23 (-65.67%)
Mutual labels:  natural-language-processing, natural-language-understanding
Mongolian Bert
Pre-trained Mongolian BERT models
Stars: ✭ 21 (-68.66%)
Mutual labels:  natural-language-processing, natural-language-understanding
Riceteacatpanda
repo with challenge material for riceteacatpanda (2020)
Stars: ✭ 18 (-73.13%)
Mutual labels:  natural-language-processing, neural-networks
Awesome Ai Ml Dl
Awesome Artificial Intelligence, Machine Learning and Deep Learning as we learn it. Study notes and a curated list of awesome resources of such topics.
Stars: ✭ 831 (+1140.3%)
Mutual labels:  natural-language-processing, neural-networks
Drl4nlp.scratchpad
Notes on Deep Reinforcement Learning for Natural Language Processing papers
Stars: ✭ 26 (-61.19%)
Mutual labels:  natural-language-processing, neural-networks
Insuranceqa Corpus Zh
🚁 保险行业语料库,聊天机器人
Stars: ✭ 821 (+1125.37%)
Mutual labels:  natural-language-processing, natural-language-understanding
Max Text Sentiment Classifier
Detect the sentiment captured in short pieces of text
Stars: ✭ 35 (-47.76%)
Mutual labels:  natural-language-processing, natural-language-understanding
Gsoc2018 3gm
💫 Automated codification of Greek Legislation with NLP
Stars: ✭ 36 (-46.27%)
Mutual labels:  natural-language-processing, natural-language-understanding
Machine Learning
머신러닝 입문자 혹은 스터디를 준비하시는 분들에게 도움이 되고자 만든 repository입니다. (This repository is intented for helping whom are interested in machine learning study)
Stars: ✭ 705 (+952.24%)
Mutual labels:  natural-language-processing, neural-networks
Easy Deep Learning With Allennlp
🔮Deep Learning for text made easy with AllenNLP
Stars: ✭ 32 (-52.24%)
Mutual labels:  natural-language-processing, neural-networks

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 https://www.slideshare.net/KonstantinSavenkov/nlu-intent-detection-benchmark-by-intento-august-2017

How to install

First of all, one have to download this repo:

git clone https://github.com/deepmipt/intent_classifier.git

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:

./intent_classifier.py ./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.

Example:

./intent_classifier.py ./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 train.py 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 train.py that includes reading data, tokenization, constructing data, building dataset, initializing and training model with given parameters on dataset from data.csv:

./train.py config.json data.csv 

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

  • Directory named model_path should exist. For example, if config.json contains "model_path": "./cnn_model", then configuration parameters for the trained model will be saved to ./cnn_model/cnn_model_opt.json and weights of the model will be saved to ./cnn_model/cnn_model.h5.

  • Parameter model_from_saved means whether to load pre-trained model

  • Parameter lear_metrics is a string that can include either metrics from keras.metrics or custom metrics from the file metrics.py (for example, fmeasure).

  • Parameter confident_threshold is within the range [0,1] and means the boundary whether sample belongs to the class.

  • Parameter fasttext_model contains path to pre-trained binary skipgram fastText [2] model for English language. If one prefers to use default model, it will be downloaded when one will train model.

  • Parameter text_size means the number of words for padding of each tokenized text request.

  • Parameter model_name contains name of the class method from multiclass.ry returning uncompiled Keras model. One can use cnn_model that is shallow-and-wide CNN (config.json contains parameters for this model), dcnn_model that is deep CNN model (be attentive to provide necessary parameters for the model), also it is possible to write own model.

  • All other parameters refer to learning and network configuration.

How to infer

Infering can be done in two ways:

./infer.py config.json

or

./intent_classifier.py config.json

The first one runs infer.py 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.

References

[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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].