Natural Language Conversation with a machine

Wondered how Ava in ExMachina was able to communicate so fluently with Caleb? The article attempts to decode this contextual feature of Ava which requires cognitive computing in real-time.

For a machine to understand what the humans are saying and to respond back pertinently, it should be a learning machine that decodes language and can assemble replies on the fly considering the contexts, intent and sentiment behind the dialogue with the human

Technically it would mean decomposing sentences in real-time (as the human speaks), extraction of contexts, intent and the sentiment in their sentences and construction of the answer which satisfies the expectations of the dialogue through relevance and intelligence.

The idea of this article is to explain how a simple algorithm can detect real-time context and sentiment to generate relevant answers for better user experience. The method is an improvisation of Joseph Weizenbaum’s Eliza which is a natural language conversation program. The improvisation involves auto-creating keywords and their ranks and is able to retain contexts for an ongoing conversation.

The data organization structure of a natural language can be explained as; Every noun is a node where a relationship is built between two nouns based on occurrence. Each relationship has an associated verb which defines the action. Preposition defines the position and direction of the node and its relationship. The Adjective is used to assign weights to a particular node and the adverb is used to assign weights to a particular relationship. The interjections contribute to the deduction of sentiment in a given sentence and conjunction is just a construct rule in a conversation which exhibits two or more scenarios.

The routine of the algorithm is to organize data based on the extracted POS (parts of speech) in a given sentence (questions, statements) in order to create assemblies in real-time.

The routine can be broken into two simple steps
1. Decomposition
2. Matching Assemblies


Decomposition: The Decomposing routine involves extracting words and computing their weights based on rules to arrive at a present state containing context tags and sentiment tags to be used in matching assemblies. The rules encompass

1. Expression Rules: When the user inputs (speaks or texts), the input sentence is tagged for available special expressions in the sentence to distribute weights based on rules
2. POS Extractor. In parallel, the input sentence is parsed through the word extractor for POS (Parts of Speech) tagging with appropriate word relationship.
3. Stance Shift Detection; Based on the rules for available conjunction, the sentence is decomposed into different strings for individual sentiment detection
4. Sentiment Detection: Individual Sentiment Parts are generated
5. Depth Detection: Using Noun/Adjectives and Verb/Adverb rules, depth is calculated
6. Resultant Weights to state: Based on ratio, the final state is tagged
7. Context: A parallel process tags the noun and verbs in a sentence for context tags, that uses the relationships defined at nodes to create contexts

Matching Assembly : Based on the tags received, the matching assembly will look for the best possible answers that match both the tag conditions to output an answer

• Tag Match: Using the tags available, the code queries the node of the desired tag to get answers or keywords associated.
• Rules: Incorporating state rules can get keywords related to the given state
• Outputs: The incoming keywords or answers are processed as outputs
• Responses: Based on responses to the outputs, the system tags the sentiment of the responses to the node of the keyword for subsequent references

Answer Database and Management. The algorithm can be plugged to read from a node database to manage past keywords and its weights which can help in learning and quick response generation. The administrator can configure occurrence based learning models easily to learn answers based on past interactions or can manually supervise the answer database.

The algorithm can make a difference in improvising the current processes employed for machine conversation which uses detection of sentiment, intent, context in any automated user conversation

The current tools have a very basic word weighting system and use a linear scoring approach for all available weights associated with POS(Parts of Speech). Due to linear computation, the sentiment extracted is sometimes inaccurate and leads to false context and intent detection. Extracting accurate sentiment in real-time becomes extremely crucial in a real-time chat conversation by bots in order to facilitate relevance.

Secondarily, the functions of conversation (chat-bots) and sentiment detection (sentiment analysis tools) are two different systems and hence understanding the sentiment of the user is hard to detect during a chat conversation. Without understanding the context or sentiment, it is not easy to automate a satisfying experience using machines.

In order to facilitate real-time detection of sentiment and relevance during a chat conversation, the proposed system aims to incorporate a real-time scoring method to deduce weights and states in order to understand sentiments and context references and pass the tags to the reassembly algorithm to formulate answers in real-time

This will be advantageous in creating relevant experiences when bot-customer conversations, robot-home user conversations or robot-patient conversation are considered.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: