Handling pronouns in user intents

Hello!

What’s the best way to resolve anaphors within a conversation and determine what pronouns refer to in the user’s current intent?

Are there built-in mechanisms for this in the rasa or is it worth using slots and custom actions with some set of rules and logic?

I have seen references to anaphors in the Knowledge Base Action documentation:

If the user refers to an object via “the first one”, “that one”, or “it”, you should mark those terms as mention

While I don’t think it’s part of rasa’s core, it’s worth checking the code of ActionQueryKnowledgeBase to see if they make use of it there (if at all they do). So maybe it’s something you can replicate in a custom action.

@josejulio thanks, this is a very useful link and it will help in some of my scripts. Has anyone used this functionality?
I don’t think it covers all possible uses of pronouns.
For example:

User: I have a meeting with John Doe today, write this event in my diary for 10 am.
Bot: (performs a custom action and communicates with the diary application via the API, recording an event) The event is placed in your diary.
User: By the way, his birthday is in 2 days, set a reminder.
Bot: (sets a reminder) A reminder is added to your diary.

In this case, there is no use of a knowledge base, but pronouns and entity references are used. How then? Just heuristically determine which entity I’m referring to?

I don’t know much about it, but an idea could be to store the last used object in a slot. You could make use of custom actions to store other things like at what point in the conversation it happened or any other information that would provide more context.

Later, when you detect a pronoun you can make use of said slot to determine to give more context to your action.

This is (sort of) what the KnowledgeBase action do: https://github.com/RasaHQ/rasa-sdk/blob/e9dc496d8378150844b0cc89e73a86496a128657/rasa_sdk/knowledge_base/actions.py#L40

See their mentions map: https://github.com/RasaHQ/rasa-sdk/blob/e9dc496d8378150844b0cc89e73a86496a128657/rasa_sdk/knowledge_base/storage.py#L15-L28