It’s just a little currency conversion example. A=from_currency, B=to_currency, C=curr_qty, D=change_denomination.
so after they enter from_currency and to_currency and curr_qty, I want to calculate another value that I will stash in a non-form slot for later use outside the form.
Training data looks like:
- I need to get [USD](to_currency) from [Yuan](from_currency)
- convert [dollars](from_currency) to [yuan](to_currency)
- [Pounds](currency)
Here you can see I have from_currency, to_currency, and currency (when there are no predicates in the text).
## lookup:from_currency
data/entities/currencies.txt
## lookup:to_currency
data/entities/currencies.txt
## lookup:currency
data/entities/currencies.txt
from slot_mappings():
"from_currency": [self.from_entity(entity="from_currency", intent="currency_convert"),
self.from_entity(entity="currency", intent="currency_convert")],
"to_currency": [self.from_entity(entity="to_currency", intent="currency_convert"),
self.from_entity(entity="currency", intent="currency_convert")],
This works fine for my scenario so far. The alternative I think is to just have 1 currency entity and write a bunch of code in validate that starts looking for special words before and after the entity (e.g., if I find “from” before currency entity, then put in from_currency, etc.) but that seems pretty horrible.