Entity/slot get an integer where values are NOT pre-defined

considering github example: https://raw.githubusercontent.com/RasaHQ/rasa/master/examples/restaurantbot/

{“people”: “six”} the number of possible persons is pre-defined.

Can you point me to a complete example (1 line from nlu.md, domain.yml slot entites and the line from stories.md) on how to get an

  • arbitrary string like “My name is Walter” -> but works for any value
  • arbitrary text like "I want to order 10 pizzas -> but should work for any value

Would I use text or float for the integer use case?

what would the syntax look like?

idea: i use the extracted slot value for backend service

Hi @spotlight2001, You can try adding a few(5-10) names and quantities in the intents of “name” and “quantity”.

example:

name : john walter adam…

quantity : 5 10 13…

Also, annotate the entity in the intent. example: my name is [[walter]] ((name)) Here, will contain the name and () will contain the entity name, Assuming you already have slots for name and quantity

image

As you can see, “want leave on 31 december” is an intent and “31 december” is an entity.

Hope this works for you.

  • arbitrary string like “My name is Walter” → but works for any value

You should give your NLU multiple examples on how to recognize “Walter” and similar words as an entity.

  • arbitrary text like "I want to order 10 pizzas → but should work for any value

I’d just recommend using duckling as it handles stuff like that quite fine (Numeral). You don’t want to see it as floats or text. You won’t be able to use a string version of 10 unless you parse it first. A float also seems weird, do you want 10.2452 pizza’s?

I agree with @Mappi. Duckling certainly is a more viable option.

Hmmm I tried but I doesnt work as expected:

stories.md

* introduce{"name": "Walter"}
  - utter_greet

nlu.md

- My name is [Walter](name)
- My name is [Fritz](name)
- My name is [Franz](name)
- My name is [Hans](name)

domain.yml

utter_greet:
  - text: "hi {name}, how are you?"

Actual: Your input -> my name is Franz

hi Franz, how are you?

Your input ->  my name is franz

hi Franz, how are you?

Your input ->  my name is peter

hi Franz, how are you?

Your input ->  my name is stefan

hi Franz, how are you?

Expect: my name is Ali hi Ali, how are you?

? I dont get it.

2nd try:

nlu.md

## intent:introduce
- My name is [Walter Fritz Franz Hans](name)

.

Your input ->  my name is Walter

hi None, how are you?

Your input ->  my name is Walter Fritz Franz Hans

hi Walter Fritz Franz Hans, how are you?

I’m not sure but I think there is a method to get the latest updated value of a slot. You can use that in the first method that you tried. But maybe you’ll need a custom action for this.

Try “tracker.current_slot_values”.

Your input ->  my name is Christoph
hi None, how are you?

no I mean how to get Christoph and other names without having EVERY possible name in my nlu.md