【问题标题】:rasa-core not processing my stories properlyrasa-core 没有正确处理我的故事
【发布时间】:2018-09-12 20:03:41
【问题描述】:

伙计们!我在这里需要帮助,当我训练我的数据集以识别我在 rasa-nlu 中的意图时,我的精度大于 80%,但是当我使用 rasa-core 进行故事和对话时,它不承认我的意图还是我不知道,我的故事是错误的。我已经把我的文件放下了,你们的调试日志看看可能会发生什么。我已经尝试只留下一个故事并尝试只运行这个故事,只留下服务并且没有任何效果。有谁知道我做错了什么?

故事.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 调试

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

【问题讨论】:

    标签: python-3.x rasa-core


    【解决方案1】:

    您域中的意图似乎与您训练 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 训练文件中的意图应该是您在域中的意图的一个子集,或者是同一个集合。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-16
      • 2014-02-06
      • 2018-05-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多