rasa-core не обрабатывает мои истории должным образом - PullRequest
0 голосов
/ 12 сентября 2018

ребята! Здесь мне нужна помощь, когда я обучаю свой набор данных распознавать свои намерения в rasa-nlu, у меня точность выше 80%, но когда я использую rasa-core для создания историй и разговоров, он не признает мои намерения или я не знаю, мои истории неверны. Я записал свои файлы, и журналы отладки для вас, ребята, взглянули на то, что может происходить. Я уже пытался оставить только одну историю и попытаться запустить только эту историю, оставить только службы и ничего не работает. Кто-нибудь знает, что я делаю не так?

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 '[]'

1 Ответ

0 голосов
/ 30 сентября 2018

Кажется, что намерения в вашем домене не совпадают с намерениями, с которыми вы обучили модуль NLU: 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

В вашем домене нет intent_oi, поэтому Rasa Core не знает, какреагировать.Намерения в учебном файле NLU, насколько я понимаю, должны быть подмножеством намерений в вашем домене или таким же набором.

...