Making a Chat Bot Feel Real

Written by Ben on February 10, 2017

Over at Big Eye Deers we’re busy working on our next big thing! We’re investing in chat bots – they’re versatile, allow users to get to the answers they need while they feel like they’re being looked after and they also take a ton of work.


Now there are a ton of exciting problems to overcome when building a chat bot. The one we’re discussing today is how to make it feel natural when our bot is ‘typing’ What we’re looking to do is try and calculate the difficulty of typing the sentence out to the user and how long that would take a human to type.


I think it’ll be ample enough to base it on word length alone instead of trying to work out the complexity of the word eg. We don’t care if it’s ‘ZANJA’ or ‘JELLY’ it’s a 5 letter word to us.


Here are some examples:

Lorem ipsum consectetur

Ut nisi id a leo nisl at et a


Both of the above sentences are 21 letters but the logic we’re trying to apply is the first would take slightly longer to type to make it feel more real. This is the little equation I’ve come up with to try and get a realistic typing time.




(Letter Count – (Word Count + (Word Count / 10))) / 10 + 0.5


So the first sentence would be (21 – (3 + (3 / 10))) / 10 + 0.5 = 2.27 Seconds

The second would be (21 – (9 + (9 / 10))) / 10 + 0.5 = 1.61 Seconds


I’ve written a quick codepen to test out your sentences so you can see how it works


See the Pen Chatbot Sentence Length Intelligence by Ben Sheppard (@ohlookawebsite) on CodePen.

So what we’ve got is a simple script to work out a “human” typing speed for any given sentence. All we need to do now is give it a bit of character – people make mistakes spell words wrong, chances are if you type the same sentence 10 times it’s not going to take the same amount of time so we need to add a little range to the equation.

(Letter Count – (Word Count + (Word Count / 10))) / 10 + 0.5 + (Math.random() * (0 + 0.25) + 0.0200).toFixed(2)


This will give it a range of +0 – +0.25


That’s it! We’ve now got the logic for a more realistic typing time for our chatbot! We’ve got lots more work to do on it and lots more blogs to write about it, so I best get working!