简体   繁体   English

响应聊天脚本中的多个匹配项

[英]Responding to multiple matches in Chatscript

I am currently trying to learn Chatscript but the documentation seems to be poor. 我目前正在尝试学习Chatscript,但是文档似乎很差。 My current issue is how to respond to a multi-statement match to input. 我当前的问题是如何响应输入的多语句匹配。 So, if I say "Hi. Tell me about yourself" and I have a match for "hi" and "about yourself" it will respond to the first match and not the last. 因此,如果我说“嗨,告诉我你自己”,并且我有一个“你好”和“关于你自己”的比赛,它将响应第一个比赛而不是最后一个比赛。 I'm pretty sure I need the control script to change to fix this but am not sure which commands to use. 我很确定我需要更改控制脚本来解决此问题,但不确定要使用哪些命令。 Maybe something that stores all matches in last input and can pick a specific one? 也许可以将所有匹配项存储在最后一个输入中并可以选择一个特定项?

You could create au: response that uses ^next & refine() to move through the sentences starting with something like ~greeting. 您可以创建au:响应,该响应使用^ next&fine()在诸如〜greeting之类的句子中移动。 This is pseudo code : 这是伪代码

u: ( ~greeting ) 

   ^refine()

 a: ( %more ) 

    ^next(input) 
    ^refine()

    b: ( you be ? )

       I'm good!

    b: ( %lenght==0 ) 

       Hi!

( ChatScript System Functions Manual ) ChatScript系统功能手册

^next(what label) – given what of GAMBIT or RESPONDER or REJOINDER or RULE and a rule label or tag, find the next rule of that what. ^ next(什么标签)–给定GAMBIT或RESPONDER或REJOINDER或RULE的内容以及规则标签或标记,找到该内容的下一个规则。 Fails if none is found. 如果未找到则失败。 REJOINDER will fail if it reaches the next top level rule. 如果达到下一个顶级规则,REJOINDER将失败。 If label is “~”, it will use the last call's answer as the starting point, enabling you to walk rules in succession. 如果label为“〜”,它将以上次呼叫的答案为起点,使您可以连续遍历规则。 There is also ^next(FACT @xxx) – see fact manual. 还有^ next(FACT @xxx)–参见事实手册。 For ^next(input) the system will read the next sentence and prep the system with it. 对于^ next(input),系统将读取下一个句子,并为其准备系统。 This means that all patterns and code executing thereafter will be in the context of the next input sentence. 这意味着此后执行的所有模式和代码都将在下一个输入语句的上下文中。 That sentence is now used up, and will not be seen next when the current revised sentence finishes. 该句子现在已用完,当当前修订的句子结束时,将不再显示该句子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM