sebrae / nlu-boleto

Natural Language Understanding with RASA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Natural Language Understanding with RASA

https://nlu.rasa.ai/tutorial.html

Estruturação de intenções e entendidas a partir de solução com exemplo de boleto.

O JSON de treinamento pode ser gerado de forma dinâmica utilizando chatito

Install

Debian

sudo apt-get update
sudo apt-get install python-dev -y
sudo apt-get install python-pip -y

Centos

sudo yum install python-devel

MacOS

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python3

RASA

sudo pip install rasa_nlu
sudo pip install -U scikit-learn scipy sklearn-crfsuite
sudo pip install spacy
sudo pip install sklearn

#IF ERROR
pip install --upgrade --force-reinstall sklearn

Download Language Models

sudo python -m spacy download en
sudo python -m spacy download pt

Training

python -m rasa_nlu.train -c config/config_spacy.json
python -m rasa_nlu.server -c config/config_spacy.json

https://github.com/RasaHQ/rasa-nlu-trainer https://rasahq.github.io/rasa-nlu-trainer

Server HTTP

Request

Raw POST sample as JSON

http://localhost/parse

{"q":"quero gerar o boleto de janeiro"}

Output

{
  "entities": [
    {
      "start": 14, 
      "extractor": "ner_crf", 
      "end": 20, 
      "value": "boleto", 
      "entity": "boleto"
    }, 
    {
      "start": 21, 
      "extractor": "ner_crf", 
      "end": 31, 
      "value": "de janeiro", 
      "entity": "mes"
    }
  ], 
  "intent": {
    "confidence": 0.6182224263214309, 
    "name": "findBoletoDASByMes"
  }, 
  "text": "quero gerar o boleto de janeiro", 
  "intent_ranking": [
    {
      "confidence": 0.6182224263214309, 
      "name": "findBoletoDASByMes"
    }, 
    {
      "confidence": 0.2125461695864951, 
      "name": "goodbye"
    }, 
    {
      "confidence": 0.12601956063941733, 
      "name": "findBoletoDAS"
    }, 
    {
      "confidence": 0.04321184345265633, 
      "name": "greet"
    }
  ]
}

About

Natural Language Understanding with RASA

License:Apache License 2.0