-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
意图 inform_case 和 SearchCase区别 #8
Comments
我现在有这么一个场景:当我们输入“”查询车牌号码粤A12345“”,rasa core能够返回请求的数据给我,但当我再次输入“”再帮我查一下身份证号码“”时,rasa core却把上一次车牌的结果返回给我,而没有问我继续输入身份证号码,请问是什么原因导致的呢?期待解答!谢谢! Rasa Core logs:
story: # happy with request number
* greet
- utter_answer_greet
* request_number
- number_form
- form{"name": "number_form"}
- form{"name": null}
* thanks
- utter_answer_thanks action code: class NumberForm(FormAction):
def name(self):
"""Request Number action唯一标识"""
return "number_form"
def validate_number(self, value, dispatcher, tracker, domain):
pass
def validate_item(self, value, dispatcher, tracker, domain):
pass
@staticmethod
def required_slots(tracker):
number = tracker.get_slot('number')
if number is not None:
return ["number"]
return ["item", "number"]
def submit(self, dispatcher, tracker, domain):
inputItem = tracker.get_slot("item")
inputNum = tracker.get_slot("number")
print("##### current slot:item={0},number={1}".format(inputItem, inputNum))
return [] train core model configs: def train_dialogue_keras_form(domain_file="configs/core/domain_form.yml",
model_path="models/dialogue_keras_form_new",
training_data_file="data/stories_data/form"):
fallback = FallbackPolicy(
fallback_action_name="action_default_fallback",
nlu_threshold=0.4,
core_threshold=0.3
)
agent = Agent(domain_file,
policies=[MemoizationPolicy(max_history=5),
MobilePolicy(epochs=100, batch_size=16),
FormPolicy(), fallback])
training_data = agent.load_data(training_data_file)
agent.train(
training_data,
validation_split=0.2
)
agent.persist(model_path)
return agent domain.yml:
|
当时这么做的意图是为了先通过SearchCase进入本轮对话,再用inform_case 采集信息,这样有利于会话的切换。比如inform_case中有时间字段,当我直接输入一个时间字段时,是直接进入案件这个会话呢还是进入话费咨询这个会话,特别是有共同的字段时,比如时间、地点。所以,这里是先通过SearchCase、request_search这些来先判断进入哪一个会话,进入会话后再采集各自的信息。 |
这个问题,显然是车牌号码与身份证号码都是用的 number_form(FormAction)来填的曹,你第一次用车牌号填充了并没有清空,所以第二次查身份证号码时,里面已经有值了就直接返回了。要么用不同的FormAction(不同的业务会话建议用不同的FormAction),要么每次用完了就清空曹(return [AllSlotsReset()])。 |
您好!在rasa_dataset_training.json文件中,意图 inform_case 和 SearchCase有什么区别?为什么不用一个SearchCase包括这两个意图的样本?另外,如果把这两个意图的样本都归纳到form:case_form,即命名一个case_form意图,这样不是不好构建story吗?现在遇到一些问题想不通,麻烦能够解释下原因吗?谢谢!
The text was updated successfully, but these errors were encountered: