Search code examples
rasa-nlurasa-core

How to identify multiple entities in RASA


I want to extract multiple entities from a user input. Example- "Service httpd is not responding because of high CPU usage and DNS Error" So here I want to identify below: Httpd High CPU usage DNS Error

And I will be using this keywords to get a response from a Database.


Solution

  • Just annotate them accordingly, e.g.

    ## intent: query_error
    - Service [httpd](keyword) is not responding because of [high CPU usage](keyword) and [DNS Error](keyword)
    

    Having the sentence from above, Rasa NLU would extract 3 entities of type keyword. You can then access these entities in a custom action and query your database.

    Regarding the number of examples which are required: this depends on

    • the NLU pipeline which you are using. Typically tensorflow_embedding requires more training examples than spacy_sklearn since it does not use pretrained language models.
    • the number of different values your entities can have. If it is only httpd, high CPU usage, and DNS error then you don't need a lot of examples. However, if you have a thousand different values for your entity, then you need more training examples

    One intent is enough if you always want to trigger the same custom action. However, if you want to classify different type of problems, e.g. server problems and client problems, and trigger different databases depending on the type of problems, you might consider having multiple intents.

    Sorry for the vague answers, but in machine learning most things are highly dependent on the use case and the dataset.