Rasa-core not processing my stories properly

rasa-core

(Daniel Zitei) #1

guys! I need a help here, when I train my dataset to recognize my intentions in rasa-nlu, I have a precision greater than 80%, but when I use the rasa-core to do the stories and the conversation, it does not acknowledges my intentions or I do not know, my stories are wrong. I’ve put my files down, and the debug logs for you guys take a look at what might be happening. I already tried to leave only one story and try to run only this story, leave only services and nothing works. Does anyone know what I’m doing wrong?

stories.md

## Story 1
* greet
  - utter_greet
* servico{"setor": "atendimento"}
  - slot{"setor": "atendimento"}
  - action_check_servico

## Story 2
* greet
  - utter_greet
* servico{"setor": "comercial"}
  - slot{"setor": "comercial"}
  - action_check_servico

## Story 3
* greet
  - utter_greet
* servico{"setor": "curriculo"}
  - slot{"setor": "curriculo"}
  - action_check_servico

## Story 4
* greet
  - utter_greet
* servico{"setor": "due"}
  - slot{"setor": "due"}
  - action_check_servico

## Story 5
* greet
  - utter_greet
* servico{"setor": "financeiro"}
  - slot{"setor": "financeiro"}
  - action_check_servico

## Story 6
* greet
  - utter_greet
* servico{"setor": "juridico"}
  - slot{"setor": "juridico"}
  - action_check_servico

## Story 7
* greet
  - utter_greet
* servico{"setor": "ocr"}
  - slot{"setor": "ocr"}
  - action_check_servico

## Story 8
* greet
  - utter_greet
* servico{"setor": "rh"}
  - slot{"setor": "rh"}
  - action_check_servico

## Story 9
* greet
  - utter_greet
* goodbye
  - utter_goodbye

## Story 10
* ofensa
  - utter_ofensa

## Story 11
* greet
  - utter_greet

domain.yml

intents:
  - servico
  - ofensa
  - goodbye
  - greet

entities:
  - setor
  - palavrao

actions:
  - utter_servico_atendimento
  - utter_servico_comercial
  - utter_servico_curriculo
  - utter_servico_due
  - utter_servico_financeiro
  - utter_servico_juridico
  - utter_servico_ocr
  - utter_servico_rh
  - utter_ofensa
  - utter_greet
  - utter_goodbye
  - utter_default
  - actions.ActionCheckServico

slots:
  setor:
    type: categorical
    values:
      - atendimento
      - comercial
      - curriculo
      - due
      - financeiro
      - juridico
      - ocr
      - rh

templates:
  utter_greet:
    - greet 
  utter_ofensa:
    - ofensa
  utter_default:
    - new
  utter_goodbye:
    - goodbye
  utter_servico_atendimento:
    - atendimento
  utter_servico_comercial:
    - comercial
  utter_servico_curriculo:
    - curriculo
  utter_servico_due:
    - due
  utter_servico_financeiro:
    - financeiro
  utter_servico_juridico:
    - juridico
  utter_servico_ocr:
    - ocr
  utter_servico_rh:
    - rh  

actions.py

from rasa_core.actions import Action
from rasa_core.events import SlotSet

class ActionCheckServico(Action):
    def name(self):
        return "action_check_servico"

    def run(self, dispatcher, tracker, domain):
        setor = tracker.get_slot('setor')
        
        responses = {
            'atendimento':  'utter_servico_atendimento',
            'comercial':    'utter_servico_comercial',
            'curriculo':    'utter_servico_curriculo',
            'due':          'utter_servico_due',
            'financeiro':   'utter_servico_financeiro',
            'juridico':     'utter_servico_juridico',
            'ocr':          'utter_servico_ocr',
            'rh':           'utter_servico_rh',
        }

        if setor:
            response = responses.get(setor,"utter_default")
            dispatcher.utter_template(response, tracker)
        else:
            dispatcher.utter_template("utter_default")

        return []

rasa_core.run debug

oi
2018-09-12 19:47:07 DEBUG    rasa_core.tracker_store  - Creating a new tracker for id 'default'.
2018-09-12 19:47:07 DEBUG    rasa_core.processor  - Received user message 'oi' with intent '{'confidence': 1.0, 'name': 'oi'}' and entities '[]'
2018-09-12 19:47:07 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 2 events
2018-09-12 19:47:07 DEBUG    rasa_core.processor  - Current slot values:
        setor: None
2018-09-12 19:47:07 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, {}, {'intent_oi': 1.0, 'prev_action_listen': 1.0}]
2018-09-12 19:47:07 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-09-12 19:47:07 DEBUG    rasa_core.featurizers  - Feature 'intent_oi' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:07 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-09-12 19:47:07 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'utter_greet' with prob 0.70.
greet
2018-09-12 19:47:07 DEBUG    rasa_core.processor  - Action 'utter_greet' ended with events '[]'
2018-09-12 19:47:07 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: greet, data: null)'
2018-09-12 19:47:07 DEBUG    rasa_core.policies.memoization  - Current tracker state [{}, {'intent_oi': 1.0, 'prev_action_listen': 1.0}, {'prev_utter_greet': 1.0, 'intent_oi': 1.0}]
2018-09-12 19:47:07 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-09-12 19:47:07 DEBUG    rasa_core.featurizers  - Feature 'intent_oi' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:07 DEBUG    rasa_core.featurizers  - Feature 'intent_oi' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:07 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-09-12 19:47:07 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'action_listen' with prob 1.00.
2018-09-12 19:47:07 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'
atendimento
2018-09-12 19:47:12 DEBUG    rasa_core.tracker_store  - Recreating tracker for id 'default'
2018-09-12 19:47:12 DEBUG    rasa_core.processor  - Received user message 'atendimento' with intent '{'confidence': 1.0, 'name': 'atendimento'}' and entities '[]'
2018-09-12 19:47:12 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 6 events
2018-09-12 19:47:12 DEBUG    rasa_core.processor  - Current slot values:
        setor: None
2018-09-12 19:47:12 DEBUG    rasa_core.policies.memoization  - Current tracker state [{'intent_oi': 1.0, 'prev_action_listen': 1.0}, {'prev_utter_greet': 1.0, 'intent_oi': 1.0}, {'prev_action_listen': 1.0, 'intent_atendimento': 1.0}]
2018-09-12 19:47:12 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-09-12 19:47:12 DEBUG    rasa_core.featurizers  - Feature 'intent_oi' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:12 DEBUG    rasa_core.featurizers  - Feature 'intent_oi' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:12 DEBUG    rasa_core.featurizers  - Feature 'intent_atendimento' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:12 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-09-12 19:47:12 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'utter_ofensa' with prob 0.85.
ofensa
2018-09-12 19:47:12 DEBUG    rasa_core.processor  - Action 'utter_ofensa' ended with events '[]'
2018-09-12 19:47:12 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: ofensa, data: null)'
2018-09-12 19:47:12 DEBUG    rasa_core.policies.memoization  - Current tracker state [{'prev_utter_greet': 1.0, 'intent_oi': 1.0}, {'prev_action_listen': 1.0, 'intent_atendimento': 1.0}, {'prev_utter_ofensa': 1.0, 'intent_atendimento': 1.0}]
2018-09-12 19:47:12 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-09-12 19:47:12 DEBUG    rasa_core.featurizers  - Feature 'intent_oi' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:12 DEBUG    rasa_core.featurizers  - Feature 'intent_atendimento' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:12 DEBUG    rasa_core.featurizers  - Feature 'intent_atendimento' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain
2018-09-12 19:47:12 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-09-12 19:47:12 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'action_listen' with prob 1.00.
2018-09-12 19:47:12 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'

Pip list | grep rasa_core not returning anything
(Souvik Ghosh) #2

how did you turn on the server?? it seems that your rasa core is not using the NLU model that you have trained instead relying not the default RegexInterpreter


(Daniel Zitei) #3

/opt/conda/envs/rasa-env/bin/python -m rasa_core.run -d /app/models/current/dialogue -u /app/models/NestorGR/current–debug


(Souvik Ghosh) #4

Can you check if your NLU model is working, from your logs it seems like you are not receiving the correct intent

try to run the rasa NLU model and check if it is providing you with the correct intent or not


(Daniel Zitei) #5

the code of test:

from rasa_nlu.model import Interpreter

import json

interpreter = Interpreter.load("./models/NestorGR/current")

message = "oi"

result = interpreter.parse(message)

print(json.dumps(result, indent=2))

the output:

/opt/conda/envs/rasa-env/lib/python3.5/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
  if diff:
{
  "entities": [],
  "intent_ranking": [
    {
      "confidence": 0.848019002158706,
      "name": "greet"
    },
    {
      "confidence": 0.07112117205187492,
      "name": "goodbye"
    },
    {
      "confidence": 0.05073803114558156,
      "name": "ofensa"
    },
    {
      "confidence": 0.03012179464383729,
      "name": "servico"
    }
  ],
  "intent": {
    "confidence": 0.848019002158706,
    "name": "greet"
  },
  "text": "oi"
}

(Souvik Ghosh) #6

shouldn’t there be a space between current and debug. just spitballing now

There are no typos here? It is strange

there doesn’t seem to be a reason why your intent is not caught. which version is it? 0.10.4? or 0.11.3


(Daniel Zitei) #7
Name: rasa-core
Version: 0.10.0
Summary: Machine learning based dialogue engine for conversational software.
Home-page: https://rasa.com
Author: Rasa Technologies GmbH
Author-email: hi@rasa.com
License: Apache 2.0
Location: /opt/conda/envs/rasa-env/lib/python3.5/site-packages
Requires: mattermostwrapper, ConfigArgParse, scikit-learn, redis, six, coloredlogs, flask-cors, python-telegram-bot, apscheduler, requests, numpy, twilio, fbmessenger, slackclient, h5py, future, graphviz, tqdm, flask, tensorflow, keras, jsonpickle, fakeredis, pykwalify, ruamel.yaml, colorhash, rasa-nlu, networkx, typing

(Souvik Ghosh) #8

Can you move to 0.10.4 first and check if they are working. There are no active documentation on 0.10.0


(Daniel Zitei) #9

its that. thanks man! you are awesome!