Geo location custom slot

rasa-core

(Luke Jordan) #1

One of the functions we’re building for our WhatsApp service is to provide nearby services (e.g., shelters, clinics), using the ability in WhatsApp to send a pin with longitude & latitude.

I can’t see a natural slot type among the built-in types to hold this, and I’d prefer to have it in a slot. It would seem straightforward enough to create it as a custom slot, which I’ve started to do, but not sure how to approach featurization.

I guess a naive approach would be to do a two-dimension vector with long & lat each one dimension and set to 1 if present, though I can’t really think of an instance where one would be set and not the other.

There’s one other slight complication which is for our users (very low spec mobile devices) the accuracy of the coordinates can vary a lot, so maybe one dimension for present/not and another for accuracy.

Final option would just be a text slot with standard format (long, lat) and the custom action that later uses it just pulls out the coordinates.

Any suggestions on best way to implement? And/or a better way entirely?


(Akela Drissner) #2

Any reason you can’t just store this in a normal slot as a dictionary? It’ll get stored as a string, but you can then just use literal_eval when you need to do something with it in an action


(Luke Jordan) #3

Ah, right makes complete sense. Hadn’t thought of using literal_eval. Will do that. Thanks!