Building Natural Language
Chatbots
What is a Chatbot?
• App which simulates intelligent conversations
• Using rules or AI
• Conversational interface
• Written or spoken text
• Often integrated in messaging platforms
• Slack, Facebook, Messenger, Telegram
• Use cases
• ordering products
• reporting
• managing finances
• internal communications
• scheduling
Transforming User Experience
• Language is emerging as the interface to computers
• The ability to add context to conversations makes a more natural way
to talk to a computer
• Gartner: 30% of browsing done by users will turn out to be screenless
in 2020
• Businesses are looking to reach users where they are found –
messaging platforms
• Chatbots make it easier for users to communicate what they want
and to get it
“…messaging is one of the few things that people do more than social
networking” -- Mark Zuckerberg
source: BI Intelligence
A Quick Look at Voice Assistants
• Amazon, Google, Microsoft and Google have voice assistants
• These automatically handle several common use cases such as voice
search, showing movie trailers, booking restaurant tables, schedule
appointments, etc.
• Others include Facebook M (human assisted) allows customers to do
several things from transferring money to buying a car
• Slack’s slackbots can do things like scheduling meetings, track coworkers’
happiness and take lunch orders among other things
• Businesses which sell or provide customer service through chatbots on
Facebook Messenger (1-800-Flowers, KLM) have seen big increases in sales
source: topbots.com
source: loyalty-apps.com
How Can I Make a Chatbot?
1. Define the scope
2. Figure out the use cases
3. Design the conversation flow and chatbot personality
4. How much intelligence will it need?
5. Choose NLP and/or NLU platform(s)
source: liveworld.com
Making a Chatbot
• What will the chatbot do?
• Pre-sales?
• Customer service?
• Concierge?
• Data hub?
• Entertainment?
• Learn from user feedback?
• Is it external or internal?
• Both? You might consider 2 separate implementations
Specific Use Cases I Settled On
• First implementation would be internal
• It should be able to pull together data from internal sources and
present them in response to conversational queries
• Breaches, incidents, network data summaries, etc
• It should be able to summarize news articles related to the business
• NLP process already analyzes and saves this information
• It should be able to follow conversations in Slack and summarize
• I decided to use a wordcloud for this
• It should have a distinct personality and be able to make small talk
The Conversation Flow
• Small talk follows a Request-Response model
• Stateless, immediate response
• Other queries might require multi-step flows, using context
• Context represents a state in a state machine
• There are start and end states based on the conversation flow
• Not necessarily linear
• Use a graphical tool
• Eg. LucidChart, Visio, XMind
source: chatbotsmagazine.com
Map the Main States
The Sad-Face State
Happier States
The Dream Place State
Other Interactions
source: cleveroad.com
source: Capgemini
Level 1
source: Capgemini
Level 2
source: Capgemini
Level 3
source: Capgemini
Understanding Language Technologies
• NLP = Natural Language Processing
• It’s the general term for the set of technologies dealing with natural
language
• NLU = Natural Language Understanding
• Tighter focused subset of NLP which deals with actual conversational
input
• Handle unstructured inputs and convert to a structured machine
understandable form
• Words which the user enters is transformed into intents and entities
Requirements for a Development Framework
• Natural Language Processing
• Decomposing input sentences into the constituent parts
• Query generation
• Translating parsed sentences into valid queries
• Context management
• Remembering the results of previous queries to answer futures ones
intelligently
• Natural Language Generation
• Giving the chatbot a personality
Development Frameworks
• API.ai -> also known as DialogFlow
• Owned by Google
• Wit.ai
• Facebook
• Microsoft Bot Framework + LUIS
• Watson
• Rasa NLU + Rasa Core (on-prem)
Dialogflow Intents and Entities
source: AppCoda
Contexts
• When you want your chat bot
to be able to hold a conversation
across multiple interactions, use
contexts
source: Medium
Small Talk
source: AppCoda
Wit.ai
source: Wit.ai
Microsoft LUIS
Improving Intent Recognition
source: Rasa
source: Rasa
Comparison
DialogFlow Rasa NLU + Core
Mostly complete tool for creating Chatbots 2 separate projects
No end user management No end user management
Robust HTTP API Rasa NLU: HTTP API, Rasa Core: No HTTP API
SDKs: Android, iOS, HTML, JS, .NET, Python, Java, etc Python
Web frontend Trainer UI as a separate project otherwise no GUI
All data is hosted in the cloud, on-prem not possible Everything is local and on-prem
Hosted by Google Self-hosted
Closed source, commercial, enterprise costs Open source
Tips and Best Practices
• Consistency: don’t create expectations that the chatbot can’t meet
• Limit responses to less than 3-4 lines of text if possible
• Always design for the “didn’t understand” cases
• Test on different devices
• Embed rich content whenever appropriate, but for consistency across
platforms you may want to minimize
• Buttons/UI components help users respond
• Some personality keeps things interesting

Building Natural Language Chatbots

  • 1.
  • 2.
    What is aChatbot? • App which simulates intelligent conversations • Using rules or AI • Conversational interface • Written or spoken text • Often integrated in messaging platforms • Slack, Facebook, Messenger, Telegram • Use cases • ordering products • reporting • managing finances • internal communications • scheduling
  • 3.
    Transforming User Experience •Language is emerging as the interface to computers • The ability to add context to conversations makes a more natural way to talk to a computer • Gartner: 30% of browsing done by users will turn out to be screenless in 2020 • Businesses are looking to reach users where they are found – messaging platforms • Chatbots make it easier for users to communicate what they want and to get it “…messaging is one of the few things that people do more than social networking” -- Mark Zuckerberg
  • 4.
  • 5.
    A Quick Lookat Voice Assistants • Amazon, Google, Microsoft and Google have voice assistants • These automatically handle several common use cases such as voice search, showing movie trailers, booking restaurant tables, schedule appointments, etc. • Others include Facebook M (human assisted) allows customers to do several things from transferring money to buying a car • Slack’s slackbots can do things like scheduling meetings, track coworkers’ happiness and take lunch orders among other things • Businesses which sell or provide customer service through chatbots on Facebook Messenger (1-800-Flowers, KLM) have seen big increases in sales
  • 6.
  • 7.
  • 8.
    How Can IMake a Chatbot? 1. Define the scope 2. Figure out the use cases 3. Design the conversation flow and chatbot personality 4. How much intelligence will it need? 5. Choose NLP and/or NLU platform(s)
  • 9.
  • 10.
    Making a Chatbot •What will the chatbot do? • Pre-sales? • Customer service? • Concierge? • Data hub? • Entertainment? • Learn from user feedback? • Is it external or internal? • Both? You might consider 2 separate implementations
  • 11.
    Specific Use CasesI Settled On • First implementation would be internal • It should be able to pull together data from internal sources and present them in response to conversational queries • Breaches, incidents, network data summaries, etc • It should be able to summarize news articles related to the business • NLP process already analyzes and saves this information • It should be able to follow conversations in Slack and summarize • I decided to use a wordcloud for this • It should have a distinct personality and be able to make small talk
  • 12.
    The Conversation Flow •Small talk follows a Request-Response model • Stateless, immediate response • Other queries might require multi-step flows, using context • Context represents a state in a state machine • There are start and end states based on the conversation flow • Not necessarily linear • Use a graphical tool • Eg. LucidChart, Visio, XMind
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
    Understanding Language Technologies •NLP = Natural Language Processing • It’s the general term for the set of technologies dealing with natural language • NLU = Natural Language Understanding • Tighter focused subset of NLP which deals with actual conversational input • Handle unstructured inputs and convert to a structured machine understandable form • Words which the user enters is transformed into intents and entities
  • 25.
    Requirements for aDevelopment Framework • Natural Language Processing • Decomposing input sentences into the constituent parts • Query generation • Translating parsed sentences into valid queries • Context management • Remembering the results of previous queries to answer futures ones intelligently • Natural Language Generation • Giving the chatbot a personality
  • 26.
    Development Frameworks • API.ai-> also known as DialogFlow • Owned by Google • Wit.ai • Facebook • Microsoft Bot Framework + LUIS • Watson • Rasa NLU + Rasa Core (on-prem)
  • 27.
    Dialogflow Intents andEntities source: AppCoda
  • 28.
    Contexts • When youwant your chat bot to be able to hold a conversation across multiple interactions, use contexts
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
    Comparison DialogFlow Rasa NLU+ Core Mostly complete tool for creating Chatbots 2 separate projects No end user management No end user management Robust HTTP API Rasa NLU: HTTP API, Rasa Core: No HTTP API SDKs: Android, iOS, HTML, JS, .NET, Python, Java, etc Python Web frontend Trainer UI as a separate project otherwise no GUI All data is hosted in the cloud, on-prem not possible Everything is local and on-prem Hosted by Google Self-hosted Closed source, commercial, enterprise costs Open source
  • 37.
    Tips and BestPractices • Consistency: don’t create expectations that the chatbot can’t meet • Limit responses to less than 3-4 lines of text if possible • Always design for the “didn’t understand” cases • Test on different devices • Embed rich content whenever appropriate, but for consistency across platforms you may want to minimize • Buttons/UI components help users respond • Some personality keeps things interesting