Skip to content

Commit

Permalink
Merge pull request #679 from snipsco/release/0.17.2
Browse files Browse the repository at this point in the history
Release 0.17.2
  • Loading branch information
adrienball authored Oct 17, 2018
2 parents 121a676 + c40fb24 commit a51b003
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 16 deletions.
5 changes: 2 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ build: false

test_script:
- "%PYTHON%\\python.exe -m snips_nlu download-all-languages"
- "%PYTHON%\\python.exe -m snips_nlu download-entity snips/musicAlbum fr"
- "%PYTHON%\\python.exe -m snips_nlu download-entity snips/musicArtist fr"
- "%PYTHON%\\python.exe -m snips_nlu download-entity snips/musicTrack fr"
- "%PYTHON%\\python.exe -m snips_nlu download-language-entities fr"
- "%PYTHON%\\python.exe -m snips_nlu download-language-entities en"
- "%PYTHON%\\python.exe -m unittest discover"
- "%PYTHON%\\python.exe snips_nlu_samples/sample.py"
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.17.2] - 2018-10-15
### Added
- Support for builtin music entities in english

## [0.17.1] - 2018-10-09
### Fixed
- `DeterministicIntentParser` now relies on the custom entity parser
Expand Down Expand Up @@ -157,6 +161,7 @@ several commands.
- Fix compiling issue with `bindgen` dependency when installing from source
- Fix issue in `CRFSlotFiller` when handling builtin entities

[0.17.2]: https://github.com/snipsco/snips-nlu/compare/0.17.1...0.17.2
[0.17.1]: https://github.com/snipsco/snips-nlu/compare/0.17.0...0.17.1
[0.17.0]: https://github.com/snipsco/snips-nlu/compare/0.16.5...0.17.0
[0.16.5]: https://github.com/snipsco/snips-nlu/compare/0.16.4...0.16.5
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"sklearn-crfsuite>=0.3.6,<0.4",
"semantic_version>=2.6,<3.0",
"snips_nlu_utils>=0.7,<0.8",
"snips_nlu_ontology>=0.60,<0.61",
"snips_nlu_ontology>=0.61.1,<0.62",
"num2words>=0.5.6,<0.6",
"plac>=0.9.6,<1.0",
"requests>=2.0,<3.0",
Expand Down
2 changes: 1 addition & 1 deletion snips_nlu/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
__email__ = "[email protected], [email protected]"
__license__ = "Apache License, Version 2.0"

__version__ = "0.17.1"
__version__ = "0.17.2"
__model_version__ = "0.17.0"

__download_url__ = "https://github.com/snipsco/snips-nlu-language-resources/releases/download"
Expand Down
4 changes: 3 additions & 1 deletion snips_nlu/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from snips_nlu.cli import (
cross_val_metrics, download, download_all_languages, generate_dataset,
link, train_test_metrics)
from snips_nlu.cli.download_entity import download_builtin_entity
from snips_nlu.cli.download_entity import (
download_builtin_entity, download_language_builtin_entities)
from snips_nlu.cli.inference import parse
from snips_nlu.cli.training import train
from snips_nlu.cli.utils import PrettyPrintLevel, pretty_print
Expand All @@ -20,6 +21,7 @@ def main():
"download": download,
"download-all-languages": download_all_languages,
"download-entity": download_builtin_entity,
"download-language-entities": download_language_builtin_entities,
"link": link,
"generate-dataset": generate_dataset,
"cross-val-metrics": cross_val_metrics,
Expand Down
28 changes: 27 additions & 1 deletion snips_nlu/cli/download_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import sys

import plac
from snips_nlu_ontology import get_builtin_entity_shortname

from future.builtins import str
from snips_nlu_ontology import (
get_builtin_entity_shortname, get_supported_gazetteer_entities)

from snips_nlu import __about__
from snips_nlu.cli.download import download_from_resource_name
Expand Down Expand Up @@ -40,6 +43,29 @@ def download_builtin_entity(entity_name, language, *pip_args):
long_resource_name, entity_name, language, compatibility, pip_args)


@plac.annotations(
language=("Language of the builtin entity", "positional", None, str),
pip_args=("Additional arguments to be passed to `pip install` when "
"installing the builtin entity package"))
# pylint: disable=keyword-arg-before-vararg
def download_language_builtin_entities(language, *pip_args):
"""Download all gazetteer entity resources for a given language as well as
basic language resources for this language"""
download_from_resource_name(language, pip_args, verbose=False)

shortcuts = get_json(__about__.__shortcuts__, "Resource shortcuts")
for entity_name in get_supported_gazetteer_entities(language):
check_resources_alias(entity_name, shortcuts)

compatibility = get_compatibility()
resource_name_lower = entity_name.lower()
long_resource_name = shortcuts.get(resource_name_lower,
resource_name_lower)

_download_and_link_entity(
long_resource_name, entity_name, language, compatibility, pip_args)


# pylint: enable=keyword-arg-before-vararg


Expand Down
2 changes: 1 addition & 1 deletion snips_nlu/cli/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def link_resources(origin, link_name, force, resources_path):
else Path(resources_path)
if not resources_path.exists():
raise OSError("%s not found" % str(resources_path))
link_path = DATA_PATH / link_name
link_path = DATA_PATH / str(link_name)
if link_path.is_symlink() and not force:
raise OSError("Symlink already exists: %s" % str(link_path))
elif link_path.is_symlink():
Expand Down
7 changes: 2 additions & 5 deletions snips_nlu/tests/test_builtin_entity_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from __future__ import unicode_literals

from mock import patch
from snips_nlu_ontology import (
get_all_languages, get_supported_gazetteer_entities)
from snips_nlu_ontology import get_all_languages

from snips_nlu.constants import ENTITIES, ENTITY_KIND, LANGUAGE
from snips_nlu.entity_parser.builtin_entity_parser import (
Expand All @@ -19,9 +18,7 @@ def test_should_parse_grammar_entities(self):
# Given
text = "we'll be 2 at the meeting"
language = "en"
parser = BuiltinEntityParser.build(
language=language,
gazetteer_entity_scope=get_supported_gazetteer_entities(language))
parser = BuiltinEntityParser.build(language=language)

# When / Then
parse = parser.parse(text)
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ skip_install = true
commands =
pip install -e ".[test]"
snips-nlu download-all-languages
snips-nlu download-entity snips/musicAlbum fr
snips-nlu download-entity snips/musicArtist fr
snips-nlu download-entity snips/musicTrack fr
snips-nlu download-language-entities fr
snips-nlu download-language-entities en
coverage run -m unittest discover
python snips_nlu_samples/sample.py
setenv=
Expand Down

0 comments on commit a51b003

Please sign in to comment.