首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rasa-core不能正确处理我的故事

rasa-core不能正确处理我的故事
EN

Stack Overflow用户
提问于 2018-09-13 04:03:42
回答 1查看 1.4K关注 0票数 1

伙计们!这里我需要帮助,当我训练我的数据集来识别我在rasa-nlu中的意图时,我的准确率高于80%,但当我使用rasa-core进行故事和对话时,它不承认我的意图或我不知道,我的故事是错误的。我已经把我的文件放下来了,调试日志给你们看一下可能发生的事情。我已经试着只留下一个故事,并且试着只运行这个故事,只留下服务,什么都不起作用。有人知道我做错了什么吗?

stories.md

代码语言:javascript
复制
## 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

代码语言:javascript
复制
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

代码语言:javascript
复制
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调试

代码语言:javascript
复制
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 '[]'
EN

回答 1

Stack Overflow用户

发布于 2018-09-30 11:15:21

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52302635

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档