ChatScript 5 Advanced User Manual -- 5 Advanced Variables

5.6 Advanced Variables 

    Local Variables :  $xxx and $$xxx are all global in scope.

       $_xxx are local variables.

    Indirection Variables

    Bot variables

    Assigning match variables to user variables : Match variables hold 3 pieces of data

  • original word(s)
  • canonical word(s)
  • position, range location of the word(s)

    JSON dotted notation for variables : $x = $$$obj.name.value.data.side

    Fact dotted notation for variables :  $$f.subject  $$f.verb  $$f.object

5.7 Out of band Communication

    CS can neither see nor act, but it can interact with systems that do. The convention is that out-of-band information occurs at the start of input or output, and is encased in [ ] .

    Eg.  the input like, [ speed=10 rate: 50 ] User said this .  the 2 data oob items.

    Here is a sample pattern to catch oob data.

u: ( < \[ * speed _*1 * \] ) The speed is _0
u: ( < \[ * rate _*1 * \] ) The rate is _0
   The stand-alone engine and the WEBINTERFACE/BETTER scripts automatically handle the following oob outputs :

5.8 System callback functions 
^CSBOOT() : startup of the ChatScript system.

^CS_REBOOT() : executed on every volley prior to loading user data. 

^CSSHUTDOWN() : 

^cs_topic_enter() : 

^cs_topic_exit() :

     AutoInitFile

5.9 Advanced :build

     Build warning message : Build will warn you of a number of situations which, not illegal, might be mistakes. It has several messages about words it doesn't recognize being used as keywords in patterns and concepts. You can suppress those messages by augmenting the dictionary OR just telling the system not to tell you :

     :build 0 nospell

    Files : :build will ignore files that end in ~ or .bak

    Trace :  Finding where the problem is may be hard.

:build harry trace
      Reset User-defined
:build 0 reset
    Build Layers :  The build system has two layers, 0 and 1.

    Skipping a topic file :   :quit

    Block comments

##<< first junk
some junk
##>> more junk
    Renaming Variables, Sets, and Integer Constants
    Defining private Queries

    Documenting variables, functions, factsets, and match variables

    Conditional compilation

5.10 Editing Non-topic Files

   Non-topic files include the contents of DICT and LIVEDATA.

   DICT files :  

   LIVEDATA files : The substitutions files consistof pairs of data per line. The first is what to match. Individual words are separated by underscores, and you can request sentence boundaries < and > .

   Processing done by various of these files can be suppressed by setting $cs_token differently. See Control over Input.


5.11 Common Script Idioms

   Selecting Specific Cases ^refine :  To be efficient in rule processing, I often catch a lot of things in a rule and then refine it.

u: ( ~country ) ^refine()
   a: (Turkey) I like Turkey 
   a: (Sweden) I like Sweden
   a: (*) I've never been there
    Using ^reuse

t: HOUSE () I live in a small house
u: ( where * you * live ) ^reuse(HOUSE)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值