-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #790 from snipsco/release/0.19.6
Release 0.19.6
- Loading branch information
Showing
11 changed files
with
338 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
Contributors | ||
============ | ||
|
||
This is a list of everyone who has made significant contributions to Snips NLU, in alphabetical order. Thanks a lot for the great work! | ||
This is a list of everyone who has made contributions to Snips NLU, in alphabetical order. Thanks a lot for the great work! | ||
|
||
* `Alice Coucke <https://github.com/choufractal>`_ | ||
* `cclauss <https://github.com/cclauss>`_ | ||
* `ddorian <https://github.com/ddorian>`_ | ||
* `Josh Meyer <https://github.com/JRMeyer>`_ | ||
* `Matthieu Brouillard <https://github.com/McFoggy>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from __future__ import unicode_literals | ||
|
||
import io | ||
from unittest import TestCase | ||
|
||
from snips_nlu.dataset import Dataset, validate_and_format_dataset | ||
from snips_nlu.dataset.utils import extract_entity_values | ||
|
||
|
||
class TestDatasetUtils(TestCase): | ||
def test_should_extract_entity_values(self): | ||
# Given | ||
set_light_color_yaml = io.StringIO(""" | ||
--- | ||
type: intent | ||
name: setLightColor | ||
utterances: | ||
- set the lights to [color](blue) | ||
- change the light to [color](yellow) in the [room](bedroom)""") | ||
|
||
turn_light_on_yaml = io.StringIO(""" | ||
--- | ||
type: intent | ||
name: turnLightOn | ||
utterances: | ||
- turn the light on in the [room](kitchen) | ||
- turn the [room](bathroom)'s lights on""") | ||
|
||
color_yaml = io.StringIO(""" | ||
type: entity | ||
name: color | ||
values: | ||
- [blue, cyan] | ||
- red""") | ||
|
||
room_yaml = io.StringIO(""" | ||
type: entity | ||
name: room | ||
values: | ||
- garage | ||
- [living room, main room]""") | ||
|
||
dataset_files = [set_light_color_yaml, turn_light_on_yaml, color_yaml, | ||
room_yaml] | ||
dataset = Dataset.from_yaml_files("en", dataset_files).json | ||
dataset = validate_and_format_dataset(dataset) | ||
|
||
# When | ||
entity_values = extract_entity_values(dataset, | ||
apply_normalization=True) | ||
|
||
# Then | ||
expected_values = { | ||
"setLightColor": {"blue", "yellow", "cyan", "red", "bedroom", | ||
"garage", "living room", "main room", "kitchen", | ||
"bathroom"}, | ||
"turnLightOn": {"bedroom", "garage", "living room", "main room", | ||
"kitchen", "bathroom"} | ||
} | ||
self.assertDictEqual(expected_values, entity_values) |
Oops, something went wrong.