liveBook · Manning

Intention

As explained in Natural Language Processing in Action, Second Edition

An intent is a category representing an objective that a user wants an NLP system or chatbot to carry out.

An intent is a category of objectives a user may want an NLP system or chatbot to carry out. A greeting such as “hello” can signal starting a conversation; a question or command can signal a task. section 1.5

A simple recognizer can use keywords to classify a message as a greeting or, otherwise, unknown. This is a starting point, not a full account of user goals; adding intent categories or trying regular expressions can extend it. section 1.5.1

Listing 1.1 Keyword detection using str.split
>>> greetings = "Hi Hello Greetings".split()
>>> user_statement = "Hello Joshua"
>>> user_token_sequence = user_statement.split()
>>> user_token_sequence
['Hello', 'Joshua']
>>> if user_token_sequence[0] in greetings:
...     bot_reply = "Thermonuclear War is a strange game. "
...     bot_reply += "The only winning move is NOT TO PLAY."
>>> else:
...     bot_reply = "Would you like to play a nice game of chess?"
>>> bot_reply
'Thermonuclear War is a strange game. The only winning move is NOT TO PLAY.'

The example checks whether the first token of a message matches a greeting keyword, then selects a reply. section 1.5.1

Intent recognition helps a chatbot respond to conversational goals. Cooperative conversation also requires maintaining state and generating text that helps users achieve their goals. section 1.5 section 12.9

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Defines intent and demonstrates keyword detection for greeting versus unknown, while pointing toward regular expressions as an extension.
Examples
Uses “Hello Joshua” to illustrate greeting detection and a Ukrainian translation query to illustrate a task intent.
What you can do after
Build a simple keyword recognizer that assigns greeting or unknown intent, then extend its rules with more categories or regular expressions.
How it connects
Links intent recognition with NLP pipelines, chatbots, regular expressions, and cooperative conversation.

Also explained in

Compare how 6 books explain intention →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.