ChatScript 6 Writing a Chatbot

https://github.com/bwilcox-1234/ChatScript/blob/master/WIKI/PAPERS/Writing-a-Chatbot.md

   How to think about creating it.

6.1 Uses of ChatScript

   ChatScript is a scripting language and engine for responding to meaning.

   It has been used to write chatbots which carry on an entertaining conversation. Even a chatbot that pretends to be a patient to help train doctors on diagnostic interviews.

   It has planning capability, and could be used to allow a robot to carry out plans it synthesizes in response to verbal instruction.

   It has been used to determine the intent of an Amazon product search and either better reorder search results from Amazon or to perform a more successful replacement search if Amazon's search breaks down.

   It has been used to provide natural language mapping into appropriate SQL queries on the Dun and BradStreet business database.

6.2 What are your goals

   Is it entertainment or enlightenment? Is it an agent to provide answers about something or from the world? Is it to be the brains of a useful robot?

6.3 Who is your audience

   we normally make our bot personalities female, because both men and women prefer to talk to women.

6.4 Crafting a personality

    You have to define a consistent personality.

    How old, what gender, what attitudes, likes, and dislikes. The character needs strengths AND weaknesses; It shouldn't be perfect in everything.

    The easiest way to start is to pick a personality profile - base it on a real or fictional character, an astrological sign, or whatever.

     For example, Angela was a talking cat ( that's not the quirky part ) that was deeply interested in fashion and wouldn't eat meat because of an incident with a rat in her childhood. Her fashion interests had to match with her being a cat, so she loved hats but had trouble with shoes ( her claws ruined them ).

6.5 Authoring

   I have authored bots on my own. But I am not really a creative writer, so often times Sue, who is not a coder, is involved.

   What we do is she writes a proto script of what she wants and then I convert that into proper ChatScript. Trying to train her to write script directly is a bad investment of time.

6.6 How to think about ChatScript conversation

   Topics typically are a collection of rules based around a conversational theme, be it food, or pets, or murder.

   The great thing about ChatScript is you can write a topic on anything and just dump it into the system and have it automatically hooked up and working. So lots of people can collaborate by merely picking a different topic to write about and putting them all collectively into the system. When we write a chatbot, we have different styles of topics we write.

6.7 Interactive Chat Topic

   The meat and potatoes of our conversational chatbots is the interactive topic.

   a better topic will actually interact with the user and share personal opinions and information. Interacting with the user will generally mean that we ask the user questions and volunteer our answers to those same questions. If you ask the user something personal like do you like apples, it is expected you will give your opinion on the subject as well - a sharing of intimacy.

   Whether you tell the user your view first and then solicit theirs or ask them and then volunteer yours is a matter of choice. Partly you want to vary your style, so you may change the order at times. But generally you are better off asking them first and answering for your bot second. If you tell them first, you often stifle their opinions. Or because you have told them what you are talking about before asking a question, they may volunteer their own answer before you ask the question. This become a tricky scripting problem because you have to detect they did this (because it would be stupid to ask them after they have just told you).

   The other reason to ask first is that you can prepare a lot of easily scripted rejoinders when you can anticipate their answers.

   One of the good things about asking question is that their response is generally confined to answering you. This makes it easy to write rejoinders that can interact with them.

Do you like swimming?
   You can pretty much cover the field with about 20-30 rejoinders. And having a great rejoinder to what the user says will make your bot seem interlligent.
topic: ~ATHLETICS (all-American athletic pickup_game team ~athlete ~sports ~team_sport)

t: Do you play any team sports?
  a: ( ~yesanswer ) I don't really care, I'm not sure why I asked.
                    Are you any good at your favorite sports?
  a: ( ~noanswer ) I loathe sports.

t: Who was the fastest runner? Adam. He was first in the human race.

t: PLAY () I used to play volleyball. I've tried hang-gliding. The former was fun, the latter is dangerous.

#! do you play any sports?
?: ( you < * [play participate do ] < * [athlete ~team_sport athletic sport ] < ![baseball basketball ] )
   ^reuse(PLAY)

#! what team do you support?
?: ( what *~2 team * you [support favor] ) I don't care for any sports teams.
    The above topic did express Suzette's opinions. Our Angela bot went farther and did everything in character in every topic. Her questions were personal and her answers were always from her history or her opinion. Everything she said revealed more of her character and history. Nothing was impersonal. She was a friend who shared things with you, told you her personal stories of triumph or disaster and listened to yours.

6.8 Issues of Length

    How long should a gambit be and how big should a topic be?

    Our experience is that most people will drop out of most topics after about 8 gambits.

    A really long topic is usually just a collection of sub-themes. Eg. the money topic might look like this:

topic: ~money()
t: ^gambit(~lottery)
t: ^gambit(~charity)
t: ^gambit(~investing)
t: ^gambit(~retirement)
    This means the bot might start talking about money, walking through each topic in turn. On the other hand, if the user inquires about investing, the bot would respond from that topic and remain there til done.

6.9 Story Topics

    Some of our topics in Angela were personal stories. 

    Obviously you do want responders for questions they might naturally ask. And you have to write your control script to specially manage story topics different from other topics. Why?   

    In a normal free flowing conversation, the user might say something that takes you to another topic. That's fine, conversations often deflect and wander around. But stories don't.

    You can't have the system leaving the story partway. It has to remain focused on completing it. You can't return to it at some later time. So the control script has to allow the system to answer questions from any other topic if the user does ask something unexpected, but it has to be smart enough to force the flow back into the story topic to finish it.

6.10 Reactor Topics

     A different kind of topic is one that just issues one-liner reactions to things.

6.11 Keywordless Topic

     A special topic for holding responders is one that has no keywords and is directly invoked by the control script when normal topics fail to match.

6.12 Quibble Topics

    It's very important to have these quibbles because user's like to think they were heard. Ignoring the user just makes them mad.

    Quibble topics are similar to the keywordless topic in that they don't have topic keywords and are directly invoked by the control script. The main difference is that the quibbles are universal, suitable for any bot, and not specific to the character.

    And quibbles can pick up on mere words of the input and not care about the complete meaning. A sample quibble might be:

#! because you know what it's like to live there.
s: ( because you know ) [I don't know any such thing. ]
                                       [Whatever I once knew, I have long since forgotten. ]

6.13 Repetition: Keep/Repeat/Random

     One clear thing that makes a bot stand out non-human is saying the same thing word for word in separate volleys.

     This is such an important issue that ChatScript is designed to deal with it in multiple ways, even detecting it from the user. But mostly all we are concerned with is repetition from the bot.

6.14 Emotion

     Emotion is an interesting problem because it's extremely difficult to put text emotion into prerecorded output text.

     Putting pre-canned gestures on output is OK when you have a controllable avatar, but emotion is usually more dynamic and builds up as a result of continuing interaction.

     Parts of the reason our first bot, Suzette, won the Loebner's was because she expressed dynamic emotion. She did this in two ways. First, since being insulted and hit upon is common for a female bot, she had lots of rules to detect this. She not only deflected sexual innuendos but added warnings about you behavior and if you did too much of it in too short a space of time, she would warn you and then refuse to talk to you for 5 minutes.

     And Suzette monitored user input for repetition. So if user just kept saying the same thing, she would pick up and comment on it initially, and start getting cross if it was done too often.

     She also tracked information on the conversation. Long sentences from the user indicated interest in the topic, short ones disinterest. Saying you were bored, clear disinterest. Agreeing with her by answering yes a lot or complementing her indicated you linked her and were sympatico. Disagreeing by answering no a lot or by insulting her indicated you disliked her or weren't her kind of person.

     So she kept track of attention and affinity. Attention could cause her to change topics if you seemed bored but if you were bored a lot then it reduced your affinity with her. When your affinity was too positive toward her, she bacame neurotically insecure. She didn't deserve your love and interest in her and expressed it verbally. Similarly, if your affinity went too negative, she became paranoid or hostile.

     She worried who are listening, why you asked the questions you did, and if things got too bad, began verbally speculating to herself how she might kill you. She tracked these states as a result of what the user said and what she said. And had additional emotional topics that could add extra sentences in front of the normally generated conversation. So if you asked her do you have any pets, you get her normal answer with any emotional spice occasinally added in a sentence in front.


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值