/ / Some tips for choosing the correct entities in Dialogflow
DialogFlow

Some tips for choosing the correct entities in Dialogflow

Recently, on the Dialogflow Product forum, there was this question:

There is also a reply by a Google employee, which you should go and read.

There are two interesting things about this question:

  1. The asker is effectively trying to fit their entire chatbot into a single intent
  2. The asker thinks that everything should be an entity (which is probably a direct consequence of point 1)

But I was more interested in why someone would think that the entire sentence is full of candidates for entities. In my opinion, you should actually try to use an entity only when you absolutely need to.

So how can you decide what should and shouldn’t be an entity?

Here are some ideas.

Learn about the different types of nouns

Did you know that the English language has something like nine different types of nouns? Here is a quick list:

  • proper nouns
  • common nouns
  • material nouns
  • countable nouns
  • uncountable or mass nouns
  • collective nouns
  • concrete nouns
  • abstract nouns
  • pronouns

Here is an article which describes them in detail.

Does this mean there is a 1-to-1 mapping between these different types of nouns and Dialogflow entities? No, not that I am aware of.

But knowledge of these different types of nouns will be very handy as you think about what to use and what not to use as an entity. For example, a proper noun is most likely an entity. (Again, there are probably some exceptions to this rule).

Learn about Part-of-speech tagging

In general, learning about Natural Language Processing will help you build out better chatbots (even if you don’t use Dialogflow).

Suppose you don’t want to spend all that effort. Here is a quick hack. At least learn about Part-of-speech tagging and some general principles about how POS tagging is implemented.

So what is part of speech tagging? Let us say you have a well formed English sentence. Part of speech tagging assigns tags to all the different words and identifies which word is which part-of-speech, e.g. pronoun, noun, verb, adjective etc. (see the next section)

Read this StackOverflow answer to get an idea of the various different tags which are typically used in POS tagging.

Use the Parts of Speech online tool

And the next tip is to use the Parts of Speech online tool.

Here is how it parses a sentence that the questioner asked:

Notice that “What” is marked as a pronoun – that is, it refers to some other noun (the job title) in the sentence. Often, pronouns can be omitted from the sentence and you will still get a gist of what the sentence is about. In this case, reading “job title of Frank Gallagher?” still gives you a very good idea of what the user’s intent is. That’s why the Google employee answered that “question words” shouldn’t be annotated as entities in this case. And in general, pronouns are not good candidates for entities, in my opinion.

In the same way, you can use the tool to develop some useful insights into how you declare your intents and how you choose your entities. (of course, you first need to learn about the types of nouns and about POS tagging to be able to do this).

Feedback?

Do you have any tips for how to choose entities? Let me know in the comments.

FREE COURSES

Related Posts

  • hi sir i want an entity for which can take credit or debit card numbers
    when i am sending that number to webhook that 16 digit is changing to exponential number

    which entity should i choose

  • Is there any way to access the link you have shared of the forum? it shows the support is deprecated and lead to home page of google help.

    • Yeah, I don’t know why Google keeps deprecating/deleting their forums. And I don’t know if there is any way to access the link. Maybe you can try the Internet Archive, although it doesn’t seem to have crawled these sites properly.

    • If you mean you want to add new values into a developer entity based on logs of conversations that people have with your agent, at the moment the best way to do that is to go through your logs manually and add these values as you find them.

  • Hello. Here is a good explanation.
    Can you give me advice or show direction to search? I need help with other sentence construction. For example, asker wants to find some word. It can be verb or noun, or adjective mostly. I can find a Verb as action marker of an intent. Like “find”, “show”. But how to get 2nd word after the Verb or all other words after the Verb? It is very easy with regex with strong pattern but very hard in natural language. It is why I try to use NLP in Dialogflow. Is it possible to get some pattern and then only part of this pattern as value to proceed?
    Thanks in advance. Alexey

      • Hi, Aravindmc. For example user print command to find some word in a vocabulary from some text “find cat”, but it can be noun, verb, adjective too with or without an article. Is it possible to use a simplest way to get 1st word after “find” (or synonyms (show, tell, search, etc). Thus we have webhook with the Command and the Object to find. Second better approach a little bit harder. It is very good to understand is it noon, verb, adjective, (and maybe acronym) etc to request a different vocabulary.
        I guess it is impossible train all combination of phrases with entity “find” and all other nouns, verbs, adjectives. I can’t find how to realize it in Dialogflow. I didn’t find it in documentation or in @sys* entities. For example something like that I try to use in Recast_AI (now it belongs to SAP). The service can recognize parts of speech themselves.
        I hope that I wrote clear explanation what I want to do and what problems I have.
        Thank you in advance.
        Alexey