NLP Applications Chatbot

Roman x Stable Diffusion

Chatbots are one of the most wide spread NLP applications. In this tutorial we will build a simple retrieval chatbot that can be used for example as an alternative for FAQ applications in companies.

The approach is following:

  1. Train a model on variants of a question.
  2. Take input and predict the type of question asked - this is called “intent”
  3. Reply with a pre-defined response corresponding to the question asked.

Modern bots are more complex. They evaluate the whole (or large parts of the) dialogue. In addition some have the capacity to generate text.

The iput data looks like this:

👉 Expand to see JSON...

Notebook

Training Chatbot

Assignment

Create an intent classifier

Use following data from HF: fathyshalab/atis-flight

Build an FAQ bot

Use folloqing dataset from HF: Andyrasika/Ecommerce_FAQ

AAU Handbook-bot (Roman solution)

The provided code in the notebook aims to establish a simple text-based question-answering bot utilizing pre-trained Floret word vectors and spaCy to process textual data. Upon receiving a user-input question, the bot evaluates its similarity with pre-existing questions in its dataset using cosine similarity, attempting to find the most pertinent match. If a sufficiently similar question is identified (based on a pre-defined similarity threshold), the bot provides the corresponding answer; otherwise, it prompts the user with the closest matching questions from the dataset, requesting a more precise inquiry.

Similarity-based Chatbot