Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full intent name to ranked responses #5690

Merged
merged 14 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/5690.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``full_retrieval_intent`` property to ``ResponseSelector`` rankings
5 changes: 5 additions & 0 deletions rasa/nlu/selectors/response_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ def process(self, message: Message, **kwargs: Any) -> None:
label, label_ranking = self._predict_label(out)
retrieval_intent_name = self.retrieval_intent_mapping.get(label.get("name"))

for ranking in label_ranking:
ranking["full_retrieval_intent"] = self.retrieval_intent_mapping.get(
ranking.get("name")
)

selector_key = (
self.retrieval_intent
if self.retrieval_intent
Expand Down
8 changes: 8 additions & 0 deletions tests/nlu/selectors/test_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ def test_train_selector(pipeline, component_builder, tmpdir):
.get("default")
.get("full_retrieval_intent")
) is not None

ranking = parsed.get(RESPONSE_SELECTOR_PROPERTY_NAME).get("default").get("ranking")
assert ranking is not None

for rank in ranking:
assert rank.get("name") is not None
assert rank.get("confidence") is not None
assert rank.get("full_retrieval_intent") is not None