프로그래밍/RiveScript

[Tutorial] Alternatives and Optionals

프리월드 2017. 3. 7. 21:44

와일드 카드와 같은 것을 사용하고 싶지만 가능한 단어를 몇 가지로 제한하고 싶다면 어떻게해야할까요? 

몇 가지 예를 통해서 보도록 하겠습니다.

+ what is your (home|office|cell) number
- You can reach me at: 1 (800) 555-1234.

+ i am (really|very|super) tired
- I'm sorry to hear that you are <star> tired.

+ i (like|love) the color *
- What a coincidence! I <star1> that color too!
- I also have a soft spot for the color <star2>!
- Really? I <star1> the color <star2> too!
- Oh I <star1> <star2> too!

이 예에서 사용자는  "what is your home number"또는 "what is your office number"또는 "what is your cell number"라고 말할 수 있습니다. home, office, cell중에서 일치한다면 이에 대응한 응답을 받을 수 있습니다.

또한, 와일드 카드처럼 <star> 태그도 사용할 수 있다는 것입니다. 하나 이상의 옵션을 포함 할 수 있습니다.

+ how [are] you
- I'm great, you?

+ what is your (home|office|cell) [phone] number
- You can reach me at: 1 (800) 555-1234.

+ i have a [red|green|blue] car
- I bet you like your car a lot.

[options]선택 사항이 없어도 트리거가 실행 되도록 합니다. 그렇기 때문에 <star> 태그를 사용 할 수는 없습니다.

optionals로 작성한 트리거를 키워드(keyword) 라고 합니다. 사용자가 메시지에 맞는 또는 생략 가능한 말에 응답할 것입니다.

+ [*] the machine [*]
- How do you know about the machine!?

[*] 옵션을 사용하여 메시지의 일부를 무시할 수 있습니다.



'프로그래밍 > RiveScript' 카테고리의 다른 글

[Tutorial] Priority Triggers  (0) 2017.03.08
[Tutorial] Arrays in Triggers  (0) 2017.03.08
[Tutorial] TRIGGERS  (0) 2017.03.07
[Tutorial] The Begin File  (0) 2017.03.07
[Tutorial] FIRST STEPS - Line Breaking  (0) 2017.03.06