2

I am making a chatbot to ask basic questions about solar system. My main concern is how to set the entities for training phrases. example:

  1. What is the mass of moon?
  2. Moon's mass
  3. Tell me the mass of moon?

I have added an image below. My main concern is how to set the entites for mass and body. I have made a custom entity for mass as @body_mass and not sure how to do for planets/objects name. So that I can receive these values in backend. It is not recognizing in Diagnostic Info

image for what I did

1 Answers1

1

The easiest way to do this would be by creating a @Property entity which can detect "What" a user would like to know about a planet, for instance:

  • Height
  • Mass
  • Age
  • Average pet per alien living on the planet
  • etc..

Then you create another set of entities called @Planet with which you detect "Which" planet your user wants to know something about, for instance:

  • Earth
  • Mars
  • Saturn
  • etc..

Then you could create one intent called "Get Planet Info intent" and put example phrases such as:

  • What is the @Property of @Planet
  • How @Property is @Planet

By doing this you save yourself a lot of time because you don't have to create phrases for "What is the height of Earth" and "What is the height of Mars". You just capture a sentence for the property and the planet entity and it should work for every combination in your entities.

You could even improve upon this by adding synonyms for the entities such as:

  • Height: Tall, Long
  • Age: Old, young
  • Mass: Big

In your code all the information you have to check for is which @Property and which @Planet did Dialogflow detect, so it saves you from having to check for things such as Mass_Planet_A, Mass_Planet_B like you would now.

Jordi
  • 3,041
  • 5
  • 17
  • 36
  • Well, I implemented that. One more thing I want to ask -> My intent is `UserAsks` and Entities are `@body-mass` and `@space-object`. Now I want to add more functionality like' what is radius of space object ?' Then Do I have to include this type of question in `UserAsks` intent or make a new one? –  Dec 10 '20 at 16:31
  • 1
    The general rule for this would be that an intent represents a collection of phrases for a goal your user is trying to complete. In this case that would be ask to get information about a planet, anything related to that AND use those entities should work in the same intent. Space object is a bit vague so its difficult to say, if it is something like a planet id add it to your current intent, if you expect questions like, "What is the size of space" (Clearly not a planet) I'd make a new intent for it. – Jordi Dec 10 '20 at 16:58
  • I will try... . –  Dec 10 '20 at 17:22