Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

import str backport to support unicode in cat slot. fixes #774C #1098

Merged
merged 2 commits into from
Oct 1, 2018
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.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Fixed
-----
- fixed an issue with boolean slots where False and None had the same value
(breaking model compatibility with models that use a boolean slot)
- properly handle non ascii categorical slot values, e.g. ``大于100亿元``

[0.11.8] - 2018-09-28
^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions rasa_core/slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from __future__ import print_function
from __future__ import unicode_literals

from builtins import str

import logging

from rasa_core import utils
Expand Down
11 changes: 6 additions & 5 deletions tests/test_slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,16 @@ def value_feature_pair(self, request):
class TestCategoricalSlot(SlotTestCollection):
def create_slot(self):
return CategoricalSlot("test",
values=[1, "two", {"three": 3}, None])
values=[1, "two", "小于", {"three": 3}, None])

@pytest.fixture(params=[{"a": "b"}, 2, True, "asd", "🌴"])
def invalid_value(self, request):
return request.param

@pytest.fixture(params=[(None, [0, 0, 0, 1]),
(1, [1, 0, 0, 0]),
("two", [0, 1, 0, 0]),
({"three": 3}, [0, 0, 1, 0])])
@pytest.fixture(params=[(None, [0, 0, 0, 0, 1]),
(1, [1, 0, 0, 0, 0]),
("two", [0, 1, 0, 0, 0]),
("小于", [0, 0, 1, 0, 0]),
({"three": 3}, [0, 0, 0, 1, 0])])
def value_feature_pair(self, request):
return request.param