AI Zone Admin Forum Add your forum


square (auto-added space) vs curly brackets (no space added)

CS (chatscript) seems to auto add spaces for patterns

[pat1][pat2][pat3]——CS auto insert space——> [pat1]  [pat2]  [pat3]


{pat1}{pat2}{pat3}——CS will not insert space——> {pat1}{pat2}{pat3}

Is there any special consideration for adding the space between adjacent square brackets patterns?

I am asking because I am using CS to power a Chinese chatbot, and I want the ability to construct phrases from component chinese class of characters, e.g.,

I want to create composite patterns like “吃饭”

from concepts:

concept: ~zh_eat1 [ 吃 食 ]
concept: ~zh_meal1 [ 饭 晏 ]

If I use:


CS automatically inserts space between the two classes and assumes I want the pattern

“吃  饭”


{~zh_eat}{~zh_meal} works, it casts the net too wide.

I could modify the source code to achieve what I want, but I just want to check if there is someting I am missing.

Many thanks for your insight.

P.S. CS is extremely versatile, and I salute the author Bruce Wilcox and the numerous contributors to this fantastic engineering feat!



  [ # 1 ]

I am not sure what you are talking about.
Given the following source: u: ({xx}{yyy}) hit
CS generates in output compiled script: u: ( { xx } { yyy } ) hit
so it does generate spaces…

can you be clearer in your example


  [ # 2 ]

Note that: “吃饭”  has no spaces between the characters, so they form a single word, NOT something that can be two concepts.  You’d need to force spaces between each character from the outside


  [ # 3 ]

Thanks Bruce for your insights.

concept: ~zh_eat1 [ 吃 食 ]
concept: ~zh_meal1 [ 饭 晏 ]

1) the pattern:


CS 8.0 will match (too general)

”  吃饭  “
”  食晏  “
”  晏  “
”  吃  “
”  饭  “
”  食  “

2) while the pattern

( [~zh_eat][~zh_meal] )

CS 8.0 will only match

”  吃 饭  “
”  食 晏  “

Specifically accounting for space in [] and {} will enable CS to process compound words for languages like German and CJK.


  login or register to react