This site is no longer updated.Go to new Conversational Cloud docs

Basic Patterns Elements


*

* — any (possibly zero-length) sequence of characters.


How to use
state: catchAll
        q!: *
        a: I don’t understand you.
state: start
        q!: * 
        a: Let’s get started!
        go!: /SecondStep

word

word — the specified word, checked against the request character-by-character and in accordance with its position in the phrase.


How to use
state:
    q!: hello
    a: Hello! What's up?

* stem *

*stem* — stemma: checks if the word contains the given character sequence.

Asterisks can be placed:

  • In the beginning, to denote a variable prefix: the pattern *put will match input, output, put.
  • In the end, to denote a variable suffix: the pattern put* will match putting, putter, put.
  • Both in the beginning and in the end, to denote variable prefixes and suffixes: the pattern *put* will match outputting, put.

How to use
state:
    q: * *info* * // will match "info", "information, "metainfo"
    a: More information is available at http://example.cn

(word1|word2|or a phrase)

(word1|word2|or a phrase) — alternatives: checks whether the request contains any of the given alternatives.

The options are separated by either | or /. They may recursively contain any other embedded pattern elements.


How to use
state:
    q: (hello | good* (morning/day/evening) | greet* )
    a: Hiya!

[an optional word|or another phrase]

[an optional word|or another phrase] — options: elements within square brackets need not be present within the request.

If they are, the weight of the pattern is increased.

Alternatives with options are also supported.


How to use
state: How many players
    q: * {(how [many|much]) (gamer*|player*|people) [can] [play]} *
    q: * [game] for one * [or] [many] *
    q: * {([game]|in the game) [is] [there] (multiplayer [mode]|for several player*)} *
    a: This is a single-player adventure.

{word1 word2 (1|2)}

{word1 word2 (1|2)} — permutations: checks whether its elements are contained within the request in any order.

Permutation elements are separated by spaces.

Any element may recursively contain other pattern elements to an arbitrary level of embedding.

You should include no more than 5-6 elements into permutations.


How to use
state: How much gameplay
    q: * {(how [much|many]) gameplay} *
    q: * {[how] (big|great) [is] [the] [game]} *
    a: The script for this game took about 2 thousand pages!