Skip to content

Commit

Permalink
Release/0.64.4 (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemDoum authored and adrienball committed Jun 20, 2019
1 parent 206436e commit b782bc9
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 60 deletions.
12 changes: 2 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
cache:
- cargo
- directories:
- platforms/python/ffi/target

jobs:
include:
- if: branch = master or head_branch =~ /^release\/.+$/
Expand Down Expand Up @@ -44,8 +39,8 @@ jobs:
- PYTHON_TESTS=true
- if: branch = master or head_branch =~ /^release\/.+$/
os: linux
language: rust
rust: stable
language: java
jdk: openjdk8
env:
- KOTLIN_TESTS=true
- os: linux
Expand All @@ -59,6 +54,3 @@ before_install: . ./.travis/before_install.sh
install: ./.travis/install.sh

script: ./.travis/test.sh

git:
depth: 10
3 changes: 2 additions & 1 deletion .travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then

if [[ ${PYTHON_TESTS} == true ]]; then
# install pyenv
git clone --depth 1 https://github.com/pyenv/pyenv ~/.pyenv
git clone https://github.com/pyenv/pyenv $HOME/.pyenv
git --git-dir=$HOME/.pyenv/.git --work-tree=$HOME/.pyenv checkout v1.2.11 # Fix for https://github.com/pyenv/pyenv/issues/1066
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.64.4] - 2019-06-19
### Changed
- Accept ambiguous results from `DeterministicIntentParser` when confidence score is above 0.5 [#141](https://github.com/snipsco/snips-nlu-rs/pull/141)
- Bumped ontology to `0.64.7` [#142](https://github.com/snipsco/snips-nlu-rs/pull/142)
- Bumped parsers to `0.2.2` [#142](https://github.com/snipsco/snips-nlu-rs/pull/142)

## [0.64.3] - 2019-04-29
### Fixed
- Make the `WrongModelVersion` error message intelligible [#133](https://github.com/snipsco/snips-nlu-rs/pull/133)
Expand Down Expand Up @@ -200,6 +206,7 @@ being statically hardcoded, reducing the binary size by 31Mb.
- Improve support for japanese
- Rename python package to `snips_nlu_rust`

[0.64.4]: https://github.com/snipsco/snips-nlu-rs/compare/0.64.3...0.64.4
[0.64.3]: https://github.com/snipsco/snips-nlu-rs/compare/0.64.2...0.64.3
[0.64.2]: https://github.com/snipsco/snips-nlu-rs/compare/0.64.1...0.64.2
[0.64.1]: https://github.com/snipsco/snips-nlu-rs/compare/0.64.0...0.64.1
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snips-nlu-lib"
version = "0.64.3"
version = "0.64.4"
authors = [
"Adrien Ball <[email protected]>",
"Clement Doumouro <[email protected]>",
Expand All @@ -19,8 +19,8 @@ members = [

[dependencies]
crfsuite = { git = "https://github.com/snipsco/crfsuite-rs", tag = "0.3.1" }
snips-nlu-ontology = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.64.6" }
snips-nlu-parsers = { git = "https://github.com/snipsco/snips-nlu-parsers", tag = "0.2.1" }
snips-nlu-ontology = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.64.7" }
snips-nlu-parsers = { git = "https://github.com/snipsco/snips-nlu-parsers", tag = "0.2.2" }
snips-nlu-utils = { git = "https://github.com/snipsco/snips-nlu-utils", tag = "0.8.0" }
failure = "0.1"
base64 = "0.10"
Expand Down
4 changes: 2 additions & 2 deletions ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snips-nlu-ffi"
version = "0.64.3"
version = "0.64.4"
edition = "2018"
authors = [
"Adrien Ball <[email protected]>",
Expand All @@ -12,7 +12,7 @@ authors = [
[dependencies]
ffi-utils = { git = "https://github.com/snipsco/snips-utils-rs", rev = "4292ad9" }
snips-nlu-lib = { path = ".." }
snips-nlu-ontology-ffi-macros = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.64.6" }
snips-nlu-ontology-ffi-macros = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.64.7" }
failure = "0.1"
lazy_static = "1.0"
libc = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion ffi/cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language = "c"

include_guard = "LIBSNIPS_NLU_H_"

header = "#define SNIPS_NLU_VERSION \"0.64.3\""
header = "#define SNIPS_NLU_VERSION \"0.64.4\""

[parse]
parse_deps = true
Expand Down
2 changes: 1 addition & 1 deletion platforms/c/libsnips_nlu.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define SNIPS_NLU_VERSION "0.64.3"
#define SNIPS_NLU_VERSION "0.64.4"

#ifndef LIBSNIPS_NLU_H_
#define LIBSNIPS_NLU_H_
Expand Down
4 changes: 2 additions & 2 deletions platforms/kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {

apply plugin: 'kotlin'

version = "0.64.3"
version = "0.64.4"
group = "ai.snips"

repositories {
Expand All @@ -32,7 +32,7 @@ configurations {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'net.java.dev.jna:jna:4.5.0'
compile "ai.snips:snips-nlu-ontology:0.64.6"
compile "ai.snips:snips-nlu-ontology:0.64.7"
testCompile 'junit:junit:4.12'
testCompile 'com.google.truth:truth:0.36'
}
Expand Down
2 changes: 1 addition & 1 deletion platforms/python/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It is recommended to install the package with a virtualenv:

.. code-block:: bash
virtualenv venv
virtualenv -p python3.6 venv
. venv/bin/activate
The package is available on pypi, and can be installed with `pip`:
Expand Down
4 changes: 2 additions & 2 deletions platforms/python/ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snips-nlu-python-ffi"
version = "0.64.3"
version = "0.64.4"
authors = ["Adrien Ball <[email protected]>"]
edition = "2018"

Expand All @@ -11,4 +11,4 @@ crate-type = ["cdylib"]
[dependencies]
libc = "0.2"
ffi-utils = { git = "https://github.com/snipsco/snips-utils-rs", rev = "4292ad9" }
snips-nlu-ffi = { git = "https://github.com/snipsco/snips-nlu-rs", tag = "0.64.3" }
snips-nlu-ffi = { git = "https://github.com/snipsco/snips-nlu-rs", tag = "0.64.4" }
4 changes: 2 additions & 2 deletions platforms/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"Programming Language :: Python :: 3.7",
],
install_requires=[
"future==0.16.0",
"pathlib==1.0.1"
"future>=0.16,<0.18",
"pathlib>=1.0,<2.0; python_version < '3.4'",
],
packages=packages,
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion platforms/python/snips_nlu_rust/__version__
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.64.3
0.64.4
2 changes: 1 addition & 1 deletion platforms/python/tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py34, py35, py36, py37
envlist = py27, py35, py36, py37
skipsdist = True

[testenv]
Expand Down
2 changes: 1 addition & 1 deletion platforms/swift/SnipsNlu/Dependencies/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

set -e

VERSION="0.64.3"
VERSION="0.64.4"
SYSTEM=$(echo $1 | tr '[:upper:]' '[:lower:]')
LIBRARY_NAME=libsnips_nlu_ffi
LIBRARY_NAME_A=${LIBRARY_NAME}.a
Expand Down
132 changes: 100 additions & 32 deletions src/intent_parser/deterministic_intent_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl IntentParser for DeterministicIntentParser {
.next()
.and_then(|res| {
// return None in case of ambiguity
if res.intent.confidence_score < 1.0 {
if res.intent.confidence_score <= 0.5 {
None
} else {
Some(res)
Expand Down Expand Up @@ -456,14 +456,16 @@ mod tests {
r"^\s*This\s*is\s*a\s*(?P<group0>%DUMMY_ENTITY_1%)\s*query\s*from\s*another\s*intent\s*$".to_string()
],
"dummy_intent_3".to_string() => vec![
r"^\s*Send\s*(?P<group6>%SNIPSAMOUNTOFMONEY%)\s*$".to_string(),
r"^\s*Send\s*(?P<group6>%SNIPSAMOUNTOFMONEY%)\s*to\s*john\s*$".to_string(),
r"^\s*Send\s*(?P<group6>%SNIPSAMOUNTOFMONEY%)\s*to\s*john\s*at\s*(?P<group7>%DUMMY_ENTITY_2%)\s*$".to_string()
],
"dummy_intent_4".to_string() => vec![
r"^\s*what\s*is\s*(?P<group8>%SNIPSNUMBER%)\s*plus\s*(?P<group8_2>%SNIPSNUMBER%)\s*$".to_string()
],
"dummy_intent_5".to_string() => vec![
r"^\s*Send\s*5\s*dollars\s*to\s*john\s*$".to_string(),
r"^\s*Send\s*5\s*dollars\s*$".to_string(),
r"^\s*Send\s*5\s*dollars\s*to\s*(?P<group10>%NAME%)\s*$".to_string(),
],
"dummy_intent_6".to_string() => vec![
r"^\s*search\s*$".to_string(),
Expand All @@ -481,6 +483,7 @@ mod tests {
"group7".to_string() => "dummy_slot_name2".to_string(),
"group8".to_string() => "dummy_slot_name5".to_string(),
"group9".to_string() => "dummy_slot_name6".to_string(),
"group10".to_string() => "name".to_string(),
],
slot_names_to_entities: hashmap![
"dummy_intent_1".to_string() => hashmap![
Expand All @@ -498,7 +501,9 @@ mod tests {
"dummy_intent_4".to_string() => hashmap![
"dummy_slot_name5".to_string() => "snips/number".to_string(),
],
"dummy_intent_5".to_string() => hashmap![],
"dummy_intent_5".to_string() => hashmap![
"name".to_string() => "name".to_string(),
],
"dummy_intent_6".to_string() => hashmap![
"dummy_slot_name6".to_string() => "search_object".to_string(),
],
Expand Down Expand Up @@ -611,21 +616,66 @@ mod tests {
fn test_ambiguous_intent_should_not_be_parsed() {
// Given
let text = "Send 5 dollars to john";
let mocked_builtin_entity_parser = MockedBuiltinEntityParser::from_iter(vec![(
text.to_string(),
vec![BuiltinEntity {
value: "5 dollars".to_string(),
range: 5..14,
entity: SlotValue::AmountOfMoney(AmountOfMoneyValue {
value: 5.,
precision: Precision::Exact,
unit: Some("dollars".to_string()),
}),
entity_kind: BuiltinEntityKind::AmountOfMoney,
}],
)]);
struct TestBuiltinEntityParser {}

impl BuiltinEntityParser for TestBuiltinEntityParser {
fn extract_entities(
&self,
_sentence: &str,
filter_entity_kinds: Option<&[BuiltinEntityKind]>,
_use_cache: bool,
) -> Result<Vec<BuiltinEntity>> {
Ok(
if filter_entity_kinds
.map(|kinds| kinds.contains(&BuiltinEntityKind::AmountOfMoney))
.unwrap_or(true)
{
vec![BuiltinEntity {
value: "5 dollars".to_string(),
range: 5..14,
entity: SlotValue::AmountOfMoney(AmountOfMoneyValue {
value: 5.,
precision: Precision::Exact,
unit: Some("dollars".to_string()),
}),
entity_kind: BuiltinEntityKind::AmountOfMoney,
}]
} else {
vec![]
},
)
}
}

struct TestCustomEntityParser {}

impl CustomEntityParser for TestCustomEntityParser {
fn extract_entities(
&self,
_sentence: &str,
filter_entity_kinds: Option<&[String]>,
) -> Result<Vec<CustomEntity>> {
Ok(
if filter_entity_kinds
.map(|kinds| kinds.contains(&"name".to_string()))
.unwrap_or(true)
{
vec![CustomEntity {
value: "john".to_string(),
range: 18..22,
resolved_value: "john".to_string(),
entity_identifier: "name".to_string(),
}]
} else {
vec![]
},
)
}
}

let shared_resources = SharedResourcesBuilder::default()
.builtin_entity_parser(mocked_builtin_entity_parser)
.builtin_entity_parser(TestBuiltinEntityParser {})
.custom_entity_parser(TestCustomEntityParser {})
.build();
let parser =
DeterministicIntentParser::new(sample_model(), Arc::new(shared_resources)).unwrap();
Expand Down Expand Up @@ -739,22 +789,40 @@ mod tests {
#[test]
fn test_get_intents() {
// Given
let text = "Send 5 dollars to john";
let mocked_builtin_entity_parser = MockedBuiltinEntityParser::from_iter(vec![(
text.to_string(),
vec![BuiltinEntity {
value: "5 dollars".to_string(),
range: 5..14,
entity: SlotValue::AmountOfMoney(AmountOfMoneyValue {
value: 5.,
precision: Precision::Exact,
unit: Some("dollars".to_string()),
}),
entity_kind: BuiltinEntityKind::AmountOfMoney,
}],
)]);
let text = "Send 5 dollars";
struct TestBuiltinEntityParser {}

impl BuiltinEntityParser for TestBuiltinEntityParser {
fn extract_entities(
&self,
_sentence: &str,
filter_entity_kinds: Option<&[BuiltinEntityKind]>,
_use_cache: bool,
) -> Result<Vec<BuiltinEntity>> {
Ok(
if filter_entity_kinds
.map(|kinds| kinds.contains(&BuiltinEntityKind::AmountOfMoney))
.unwrap_or(true)
{
vec![BuiltinEntity {
value: "5 dollars".to_string(),
range: 5..14,
entity: SlotValue::AmountOfMoney(AmountOfMoneyValue {
value: 5.,
precision: Precision::Exact,
unit: Some("dollars".to_string()),
}),
entity_kind: BuiltinEntityKind::AmountOfMoney,
}]
} else {
vec![]
},
)
}
}

let shared_resources = SharedResourcesBuilder::default()
.builtin_entity_parser(mocked_builtin_entity_parser)
.builtin_entity_parser(TestBuiltinEntityParser {})
.build();
let parser =
DeterministicIntentParser::new(sample_model(), Arc::new(shared_resources)).unwrap();
Expand Down

0 comments on commit b782bc9

Please sign in to comment.