What is your name?

Asking a persons name in Conversation allows you to personalise responses later on. However actually getting a name from a person which looks good in personalisation is quite hard.

First thing to consider is how you ask the question. Take these examples.

  1. What is your name?
  2. Can I get your name?
  3. How do you like to be known as?

All three of these can illicit different responses from the end user, some not the name at all. Possible responses can be.

  • (1) Simon O’Doherty
  • (2) Why do you want to know my name?
  • (2) No
  • (3) Hugh Jass

None of these answers are ideal. The first one will look silly in personalisation. The next two need to be addressed. The last one is just silly.

So at this point is very important to shape what you send to the user. Actually everything you write, especially in process flow you need to be mindful of how you shape your message.

For this example we are going to use “Hello. Before we begin, can I get your name?“. This is liable to get responses as shown above about “why” and “no”. But you will also find that people will often not even read what is being said. So you could also expect a question.

To deal with this, we can create a simple entity to look for common key terms.

conv-0911-1

The reason to use an entity over intents is that in a process flow, the scope of questions is very narrow, and we don’t want to interfere with any other intent training that is required.

We can take the following actions on each entity.

@NameOptions:why
Output: “I need your name so I can be more personalised. Can I get your name?” and ask again.

@NameOptions:question
Output: “Before you ask me a question, can I get your name?” and ask again.

Don’t try to be everything to everyone!

I have seen people try to have Conversation answer any question at any time. This can cause serious issues in process flows, and make it seem more like a search engine.

When creating a process flow, don’t assume that the end user will do everything. Test with your users first to see where you need to customise behaviour.

 
@NameOptions:no
We don’t want to force the person to give their name. So we can customise this with the following advanced code:

{
    "output": {
        "text": "No problem, you don't need to tell me your name. Please ask me a question"
    },
    "context": {
        "name": ""
    }
}

We are setting the context variable name to blank, so that personalisation doesn’t have a name.

Condition: input.text != “”
This node is to actually load the persons name using the following advanced code:

{
  "output": {
    "text": "Hello <? input.text ?>. Please ask me a question."
  },
  "context": {
    "name": " <? input.text ?>"
  }
}

Condition: true
Output: “I didn’t quite get that.” and ask again.
We use this final node in case someone enters nothing. We just send back to ask again.

Here is the sample script for above.

Avoid too much personalisation!

When personalising responses, you should avoid doing it too often. Having the persons name appear infrequently has much more of an impact.

Try to create multiple possible responses and have 1 out of every 4-5 personalised and random responses.

Outstanding Issues

So while this will work, there are still a number of issues you need to factor in.

Too much information: What happens if they answer “My name is Simon O’Doherty”. Conversation cannot handle this, and will use the whole text .

To work around this, you can try passing the users input to AlchemyAPI and Entity extraction to get the persons name. Running on the text above gives the following output (truncated):

"entities": [
        {
            "type": "Person",
            "relevance": "0.33",
            "count": "2",
            "text": "Simon O'Doherty"
        }
    ]

There are still issues with this though, which you will find when you experiment with it. Another option is a simple UIMA dictionary which detects names. I did an example of this long ago, although using WEX or Watson Knowledge Studio may make it a lot easier.

gbenj8n

Bad information: Apart from the joke or offensive names, allowing the user to personalise responses means your system is open to abuse. So you will need to do some sanitisation at the application layer to stop this.

Response formatting: In the example script you will see that context name is being set by ” <? context.name ?>”. However when you test, you will see the preceding space is removed. Without this, you will get some odd formatting like “Hello .” if no name is specified. You need to correct this at the application layer.

5 thoughts on “What is your name?

    • I ended up adding an intent #name, then modified the name capturing conversation card condition to be: input.text !=”” AND #name ; this has helped ensure that only actual names get captured here instead of other intents. This of course still has issues when users input names and other text, but it has helped.

      Is there any way to pull out what the system identified as an intent and store it as context for use in the conversation? For example with a #name intent, could we log what the system identified as a name (ex: John Smith) and then reference that in the future. This way, if other text is present in the response, it would be disregarded.

      • Conversation won’t tell you what question influenced it, because in some cases it will find a valid name that you didn’t put into your intents.

        You shouldn’t need the input.text !=”” piece as #name won’t fire unless there is input to review. But I guess that may also depend on how you have coded the conversation?

  1. Thanks SODOHERTY, it would be awesome to see this capability in the future. Those valid names that I haven’t coded in are exactly what I’d want to pull out (the benefit of intents over entities).

    Yes, you’re correct, I didn’t need input.text !=”” anymore. Appreciate the help!

Leave a Reply