The foremost common approach and technique used in chatbots.
Variations of some pattern matching algorithm exist in each current chatbot framework. The pattern matching approaches can vary in their complexity, but the fundamental idea is the same. The simplest patterns were used in prior chatbots such as ELIZA and PC Therapist. ELIZA would analyse the user’s input “He says I’m discouraged much of the time” by matching it to the keywords in a pre-specified dictionary.
At that point, for a found keyword, ELIZA applies an related input-response rule. Based on this principle, ELIZA transforms the phrase “I am” into the phrase “You are”. The response generation algorithm adds a phrase “I am too bad to hear” prior to “you are” and a response is generated “I am too bad to hear you are discouraged.”4