How to recognize a variable number of categorical values?

rasa-nlu

(Zackhardtoname) #1

Hi there,

I am building a bot for a business knowledge graph (in neo4j). Since a node/type has so many properties (like a person can have a name, age, sex, etc.), I have a categorical slot named queried_item whose values can be age, sex. I am trying to handle the case when the user asks both a person’s age and sex at the same time as in “What are X’s age and sex?”

I appreciate any help or insight.


(Alan Nichol) #2

I’m not sure what your question is.

“What are X’s age and sex?”

How would you like this sentence to be parsed? What do you want to do with this information afterwards?


(Zackhardtoname) #3

Hi It would be nice if we have.

“intent”: null, “entities”: [

{
  "entity": "name",
  "value": "X",
  "start": 0,
  "end": 1,
  "confidence": null,
  "extractor": "ner_mitie"
},
{
  "entity": "queried_item",
  "value": "age",
  "start": ...,
  "end": ...,
  "confidence": null,
  "extractor": "ner_mitie"
}, 
   {
  "entity": "queried_item",
  "value": "sex",
  "start": ...,
  "end": ...,
  "confidence": null,
  "extractor": "ner_mitie"
}

],

Is it possible? I saw a slot type called list although I couldn’t find any example…


(Souvik Ghosh) #4

I don’t think that is the right way to approach this problem. You should have two different slots (age and sex) and train them or use duckling ,

sex is a categorical slot ( M/F/X) while age is a number or a range you can set a min-max value for age in rasa core as well

From a NLU perspective( you can use duckling to extract age, given the user is mentioning the age as a number )

Keep in mind what NLU is, it is trying to extract meaningful information from parsed sentences. not keeping mapping of such data.

Users don’t say - I am age years old. Users will say I am 20 years old. Now given how you have trained your model, 20 in this case means it is an age not a queried item. it is upto you as a developer to understand that age is a queried item.