dialogy.plugins.text.slot_filler package¶
Submodules¶
dialogy.plugins.text.slot_filler.rule_slot_filler module¶
Slot Filling¶
While we describe slots in the linked doc. The slot filling is part of an intent’s role. This plugin orchestrates the execution of slot filling via methods available on intents.
We eagerly apply slot placeholders using the apply method.
Once entities are found, we check if the slots can fill them using the fill method.
If no slots were filled, we remove the placeholders using cleanup method.
- class RuleBasedSlotFillerPlugin(rules, dest=None, guards=None, replace_output=True, fill_multiple=True, debug=False)[source]¶
Bases:
dialogy.base.plugin.Plugin
A utility plugin for slot filling <https://nlpprogress.com/english/intent_detection_slot_filling.html>._ An Intent may have a few slots that need to be filled.
This plugin can assist filling pertaining to certain intent:entity:slot-name association rules.
Let’s run through a practical example. We will create a workflow and preset the output to have expected intent and entities.
- Parameters
rules (Rule) – A mapping that defines relationship between an intent, its slots and the entities that fill them.
fill_multiple (bool) – More than one item be allowed to fill a single slot.
access (Optional[PluginFn]) – Signature for workflow access is
access(workflow) -> (Intent, List[BaseEntity])
mutate (Optional[PluginFn]) – Not needed, pass
None
.
Irrespective of the entities that are found, only the listed type in the slot shall be present in values.
Module contents¶
To handle a single dialog we need a system that can:
Classify inputs into categories.
Extract tokens of additional significance.
Check for associations between the two.
A slot-filler does the third bit. Once an Intent and a set of Entity are identified, there needs to be an arrangement that tells us if any of these are related to each other.
As per the current design, an Intent can contain a number of Slot. A Slot fills an entity of a pre-defined type.