diff --git a/.travis.yml b/.travis.yml index 417ad60b..dc9ce30c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,13 @@ matrix: - rust: nightly include: - os: osx + osx_image: xcode9.3 language: generic env: - TOXENV=py27 - PYTHON_TESTS=true - os: osx + osx_image: xcode9.3 language: generic env: - TOXENV=py36 diff --git a/.travis/before_install.sh b/.travis/before_install.sh index d37e939a..15b519a5 100755 --- a/.travis/before_install.sh +++ b/.travis/before_install.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -ev # Install Rust if [ -z ${TRAVIS_RUST_VERSION+w} ]; then @@ -29,7 +30,7 @@ if [ $TRAVIS_OS_NAME == "osx" ]; then python --version fi - if [ $IOS_SWIFT_TESTS == true ]; then + if [ "${IOS_SWIFT_TESTS}" == "true" ]; then PATH="$HOME/.cargo/bin:$PATH" rustup target install x86_64-apple-ios fi diff --git a/CHANGELOG.md b/CHANGELOG.md index ac07d15d..05e8cdc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.58.2] - 2018-08-21 +### Changed +- Bump `snips-nlu-ontology` to `0.57.3` + ## [0.58.1] - 2018-07-24 ### Fixed - Error when loading a `SnipsNluEngine` from zip data @@ -83,6 +87,7 @@ being statically hardcoded, reducing the binary size by 31Mb. - Rename python package to `snips_nlu_rust` +[0.58.2]: https://github.com/snipsco/snips-nlu-rs/compare/0.58.1...0.58.2 [0.58.1]: https://github.com/snipsco/snips-nlu-rs/compare/0.58.0...0.58.1 [0.58.0]: https://github.com/snipsco/snips-nlu-rs/compare/0.57.2...0.58.0 [0.57.2]: https://github.com/snipsco/snips-nlu-rs/compare/0.57.1...0.57.2 diff --git a/snips-nlu-cli/Cargo.toml b/snips-nlu-cli/Cargo.toml index f3d8ef14..db65c360 100644 --- a/snips-nlu-cli/Cargo.toml +++ b/snips-nlu-cli/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "snips-nlu-cli" -version = "0.58.1" +version = "0.58.2" authors = ["Adrien Ball "] [dependencies] snips-nlu-lib = { path = "../snips-nlu-lib" } -clap = "2.32.0" -serde_json = "1.0.22" \ No newline at end of file +clap = "2.32" +serde_json = "1.0" diff --git a/snips-nlu-ffi/Cargo.toml b/snips-nlu-ffi/Cargo.toml index a0482e72..79b9ad3d 100644 --- a/snips-nlu-ffi/Cargo.toml +++ b/snips-nlu-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "snips-nlu-ffi" -version = "0.58.1" +version = "0.58.2" authors = [ "Kevin Lefevre ", "Thibaut Lorrain " @@ -9,7 +9,7 @@ authors = [ [dependencies] ffi-utils = { git = "https://github.com/snipsco/snips-utils-rs", rev = "b1f4af3" } snips-nlu-lib = { path = "../snips-nlu-lib" } -snips-nlu-ontology-ffi-macros = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.57.1" } +snips-nlu-ontology-ffi-macros = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.57.3" } failure = "0.1" lazy_static = "1.0" libc = "0.2" diff --git a/snips-nlu-ffi/kotlin/build.gradle b/snips-nlu-ffi/kotlin/build.gradle index 519aec94..39dbd4bb 100644 --- a/snips-nlu-ffi/kotlin/build.gradle +++ b/snips-nlu-ffi/kotlin/build.gradle @@ -11,7 +11,7 @@ buildscript { apply plugin: 'kotlin' -version = "0.58.1" +version = "0.58.2" group = "ai.snips" repositories { diff --git a/snips-nlu-ffi/python/snips-nlu-python-ffi/Cargo.toml b/snips-nlu-ffi/python/snips-nlu-python-ffi/Cargo.toml index d019fda0..0141c561 100644 --- a/snips-nlu-ffi/python/snips-nlu-python-ffi/Cargo.toml +++ b/snips-nlu-ffi/python/snips-nlu-python-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "snips-nlu-python-ffi" -version = "0.58.1" +version = "0.58.2" authors = ["Adrien Ball "] [lib] @@ -10,4 +10,4 @@ crate-type = ["cdylib"] [dependencies] libc = "0.2" ffi-utils = { git = "https://github.com/snipsco/snips-utils-rs", rev = "b1f4af3" } -snips-nlu-ffi = { git = "https://github.com/snipsco/snips-nlu-rs", tag = "0.58.1" } +snips-nlu-ffi = { git = "https://github.com/snipsco/snips-nlu-rs", tag = "0.58.2" } diff --git a/snips-nlu-ffi/python/snips_nlu_rust/__version__ b/snips-nlu-ffi/python/snips_nlu_rust/__version__ index 831bbee3..31cbc49a 100644 --- a/snips-nlu-ffi/python/snips_nlu_rust/__version__ +++ b/snips-nlu-ffi/python/snips_nlu_rust/__version__ @@ -1 +1 @@ -0.58.1 +0.58.2 diff --git a/snips-nlu-ffi/swift/SnipsNlu/Dependencies/build.sh b/snips-nlu-ffi/swift/SnipsNlu/Dependencies/build.sh index c20627f8..0bbaa0e5 100755 --- a/snips-nlu-ffi/swift/SnipsNlu/Dependencies/build.sh +++ b/snips-nlu-ffi/swift/SnipsNlu/Dependencies/build.sh @@ -4,7 +4,7 @@ set -e -VERSION="0.58.1" +VERSION="0.58.2" SYSTEM=$(echo $1 | tr '[:upper:]' '[:lower:]') LIBRARY_NAME=libsnips_nlu_ffi LIBRARY_NAME_A=${LIBRARY_NAME}.a diff --git a/snips-nlu-lib/Cargo.toml b/snips-nlu-lib/Cargo.toml index faf4a3ba..5dcf2262 100644 --- a/snips-nlu-lib/Cargo.toml +++ b/snips-nlu-lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "snips-nlu-lib" -version = "0.58.1" +version = "0.58.2" authors = [ "Thibaut Lorrain ", "Kevin Lefevre " @@ -10,15 +10,14 @@ description = "Rust implementation of Snips NLU" [dependencies] crfsuite = { git = "https://github.com/snipsco/crfsuite-rs", rev = "30b2ea6" } -snips-nlu-ontology = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.57.1" } -snips-nlu-ontology-parsers = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.57.1" } +snips-nlu-ontology = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.57.3" } +snips-nlu-ontology-parsers = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.57.3" } snips-nlu-utils = { git = "https://github.com/snipsco/snips-nlu-utils", tag = "0.6.1" } -dinghy-test = "0.3" failure = "0.1" base64 = "0.9" itertools = { version = "0.7", default-features = false } lazy_static = "1.0" -lru-cache = "0.1.1" +lru-cache = "0.1" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" @@ -30,6 +29,7 @@ zip = { version = "0.3", features=["deflate"] } [dev-dependencies] bencher = { git = "https://github.com/snipsco/bencher", rev = "63910ace" } +dinghy-test = "0.3" maplit = "1.0" [[bench]] diff --git a/snips-nlu-lib/benches/nlu_engine.rs b/snips-nlu-lib/benches/nlu_engine.rs index 8e1c7583..d69eef2f 100644 --- a/snips-nlu-lib/benches/nlu_engine.rs +++ b/snips-nlu-lib/benches/nlu_engine.rs @@ -1,6 +1,7 @@ #[macro_use] extern crate bencher; extern crate snips_nlu_lib; +extern crate dinghy_test; use std::env; @@ -10,6 +11,12 @@ use snips_nlu_lib::*; const ENGINE_DIR_ENV: &str = "SNIPS_NLU_BENCH_ENGINE_DIR"; const SENTENCE_ENV: &str = "SNIPS_NLU_BENCH_SENTENCE"; +fn file_path(filename: &str) -> ::std::path::PathBuf { + dinghy_test::try_test_file_path("data") + .unwrap_or_else(|| "../data".into()) + .join(filename) +} + fn load_nlu_engine() -> SnipsNluEngine { let engine_path = if let Ok(engine_directory) = env::var(ENGINE_DIR_ENV) { file_path(&engine_directory) diff --git a/snips-nlu-lib/src/lib.rs b/snips-nlu-lib/src/lib.rs index 7a5129b4..ecb9e5a8 100644 --- a/snips-nlu-lib/src/lib.rs +++ b/snips-nlu-lib/src/lib.rs @@ -1,6 +1,7 @@ extern crate base64; extern crate crfsuite; extern crate csv; +#[cfg(test)] extern crate dinghy_test; #[macro_use] extern crate failure; @@ -50,4 +51,4 @@ pub use nlu_engine::SnipsNluEngine; pub use resources::loading::clear_resources; // This is used by benches pub use slot_filler::{CRFSlotFiller, SlotFiller}; pub use nlu_utils::token::{compute_all_ngrams, tokenize_light}; -pub use utils::file_path; // This is used by benches + diff --git a/snips-nlu-lib/src/resources/stemmer.rs b/snips-nlu-lib/src/resources/stemmer.rs index f232494d..3b7695d6 100644 --- a/snips-nlu-lib/src/resources/stemmer.rs +++ b/snips-nlu-lib/src/resources/stemmer.rs @@ -22,6 +22,7 @@ impl HashMapStemmer { let mut values = HashMap::::new(); let mut csv_reader = csv::ReaderBuilder::new() .delimiter(b',') + .quoting(false) .flexible(true) .has_headers(false) .from_reader(reader); @@ -93,7 +94,7 @@ mod tests { fn hashmap_stemmer_works() { // Given let stems: &[u8] = r#" -investigate,investigated,investigation +investigate,investigated,investigation,"investigate do,done,don't,doing,did,does"#.as_ref(); // When @@ -104,6 +105,7 @@ do,done,don't,doing,did,does"#.as_ref(); let stemmer = stemmer.unwrap(); assert_eq!(stemmer.stem("don't"), "do".to_string()); assert_eq!(stemmer.stem("does"), "do".to_string()); + assert_eq!(stemmer.stem("\"investigate"), "investigate".to_string()); assert_eq!(stemmer.stem("unknown"), "unknown".to_string()); } } diff --git a/snips-nlu-lib/src/resources/word_clusterer.rs b/snips-nlu-lib/src/resources/word_clusterer.rs index 51839467..a4c53d0a 100644 --- a/snips-nlu-lib/src/resources/word_clusterer.rs +++ b/snips-nlu-lib/src/resources/word_clusterer.rs @@ -21,6 +21,7 @@ impl HashMapWordClusterer { fn from_reader(reader: R) -> Result { let mut csv_reader = csv::ReaderBuilder::new() .delimiter(b'\t') + .quoting(false) .has_headers(false) .from_reader(reader); let mut values = HashMap::::new(); @@ -103,7 +104,9 @@ mod tests { // Given let clusters: &[u8] = r#" hello 1111111111111 -world 1111110111111"#.as_ref(); +world 1111110111111 +"yolo 1111100111111 +"#.as_ref(); // When let clusterer = HashMapWordClusterer::from_reader(clusters); @@ -113,6 +116,7 @@ world 1111110111111"#.as_ref(); let clusterer = clusterer.unwrap(); assert_eq!(clusterer.get_cluster("hello"), Some("1111111111111".to_string())); assert_eq!(clusterer.get_cluster("world"), Some("1111110111111".to_string())); + assert_eq!(clusterer.get_cluster("\"yolo"), Some("1111100111111".to_string())); assert_eq!(clusterer.get_cluster("unknown"), None); } } diff --git a/snips-nlu-lib/src/utils.rs b/snips-nlu-lib/src/utils.rs index 619b1d26..306dbc6a 100644 --- a/snips-nlu-lib/src/utils.rs +++ b/snips-nlu-lib/src/utils.rs @@ -10,6 +10,7 @@ pub trait FromPath { fn from_path>(path: P) -> Result where Self: Sized; } +#[cfg(test)] pub fn file_path(filename: &str) -> ::std::path::PathBuf { ::dinghy_test::try_test_file_path("data") .unwrap_or_else(|| "../data".into())