Chat

The chat endpoint uses all the previous techniques to prepare a message:

  1. Tokenization
  2. Part-of-speech tagging
  3. Lemmatization

The chatbot is then trained on lemmatized classification data, which maps various potential input expressions to a set of possible chat responses. Finally, the endpoint replies with the most probable response from the set of possible responses.

Table of contents

  1. Example request
  2. Response

Example request

Send the following chat message:

POST /zoo-chatbot/chat

{
  "message": "any giraffes?"
}

Response

Data is truncated for readability.

Notice that the most relevant reply is returned:

Response

{
  "category": "animal-list",
  "reply": "The zoo has 10 giraffes, 3 elephants, 2 lions and 12 penguins",
  "probabilities": [
    {
      "category": "animal-list",
      "probability": 0.6893424773
    },
    {
      "category": "directions",
      "probability": 0.0776643807
    },
    {
      "category": "opening-times",
      "probability": 0.0776643807
    }
  ]
}