Skip to content

Commit

Permalink
Release 0.65.2 (#150)
Browse files Browse the repository at this point in the history
* Freeze chrono to 0.4.8 to fix issue with rustling-ontology

* Update Changelog

* Bump version to 0.65.2

* Remove serde_derive

* Add `dyn` keyword everywhere
  • Loading branch information
adrienball authored Sep 6, 2019
1 parent 7a5b2b1 commit bf16a8a
Show file tree
Hide file tree
Showing 28 changed files with 74 additions and 69 deletions.
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.65.2] - 2019-09-06
### Fixed
- Freeze chrono to 0.4.8 to fix issue with rustling-ontology [#149](https://github.com/snipsco/snips-nlu-rs/pull/149)

## [0.65.1] - 2019-09-04
### Added
- Add new `parse_with_alternatives` API to `SnipsNluEngine` to get alternative intents and slot values [#148](https://github.com/snipsco/snips-nlu-rs/pull/148)
Expand Down Expand Up @@ -226,6 +230,7 @@ being statically hardcoded, reducing the binary size by 31Mb.
- Improve support for japanese
- Rename python package to `snips_nlu_rust`

[0.65.2]: https://github.com/snipsco/snips-nlu-rs/compare/0.65.1...0.65.2
[0.65.1]: https://github.com/snipsco/snips-nlu-rs/compare/0.65.0...0.65.1
[0.65.0]: https://github.com/snipsco/snips-nlu-rs/compare/0.64.4...0.65.0
[0.64.4]: https://github.com/snipsco/snips-nlu-rs/compare/0.64.3...0.64.4
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.66.0-SNAPSHOT"
version = "0.65.2"
authors = [
"Adrien Ball <[email protected]>",
"Clement Doumouro <[email protected]>",
Expand All @@ -27,14 +27,14 @@ base64 = "0.10"
itertools = { version = "0.8", default-features = false }
log = "0.4"
lru-cache = "0.1"
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tempfile = "3"
ndarray = "0.12"
regex = "1.0"
csv = "1.0"
zip = { version = "0.5", default-features = false, features = ["deflate"] }
chrono = "=0.4.8"

[dev-dependencies]
bencher = { git = "https://github.com/snipsco/bencher", rev = "63910ace" }
Expand Down
2 changes: 1 addition & 1 deletion ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snips-nlu-ffi"
version = "0.66.0-SNAPSHOT"
version = "0.65.2"
edition = "2018"
authors = [
"Adrien Ball <[email protected]>",
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.66.0-SNAPSHOT\""
header = "#define SNIPS_NLU_VERSION \"0.65.2\""

[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.66.0-SNAPSHOT"
#define SNIPS_NLU_VERSION "0.65.2"

#ifndef LIBSNIPS_NLU_H_
#define LIBSNIPS_NLU_H_
Expand Down
2 changes: 1 addition & 1 deletion 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.66.0-SNAPSHOT"
version = "0.65.2"
group = "ai.snips"

repositories {
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.66.0-SNAPSHOT"
version = "0.65.2"
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 = { path = "../../../ffi" }
snips-nlu-ffi = { git = "https://github.com/snipsco/snips-nlu-rs", tag = "0.65.2" }
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.66.0-SNAPSHOT
0.65.2
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.66.0-SNAPSHOT"
VERSION="0.65.2"
SYSTEM=$(echo $1 | tr '[:upper:]' '[:lower:]')
LIBRARY_NAME=libsnips_nlu_ffi
LIBRARY_NAME_A=${LIBRARY_NAME}.a
Expand Down
2 changes: 1 addition & 1 deletion src/injection/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum NluInjectionErrorKind {

// Boilerplate
impl Fail for NluInjectionError {
fn cause(&self) -> Option<&Fail> {
fn cause(&self) -> Option<&dyn Fail> {
self.inner.cause()
}

Expand Down
2 changes: 1 addition & 1 deletion src/injection/injection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ fn stem_entity_value(
entity_values: Vec<GazetteerEntityValue>,
engine_info: &NluEngineInfo,
custom_entity_parser_info: &CustomGazetteerParserInfo,
maybe_stemmer: Option<&Arc<Stemmer>>,
maybe_stemmer: Option<&Arc<dyn Stemmer>>,
) -> Result<Vec<GazetteerEntityValue>, NluInjectionError> {
let stemmed_entity_values = match custom_entity_parser_info.parser_usage {
CustomEntityParserUsage::WithoutStems => vec![],
Expand Down
8 changes: 4 additions & 4 deletions src/intent_classifier/featurizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ pub struct TfidfVectorizer {
builtin_entity_scope: Vec<BuiltinEntityKind>,
vocabulary: HashMap<String, usize>,
idf_diag: Vec<f32>,
word_clusterer: Option<Arc<WordClusterer>>,
stemmer: Option<Arc<Stemmer>>,
word_clusterer: Option<Arc<dyn WordClusterer>>,
stemmer: Option<Arc<dyn Stemmer>>,
language: NluUtilsLanguage,
shared_resources: Arc<SharedResources>,
}
Expand Down Expand Up @@ -394,7 +394,7 @@ fn get_custom_entity_feature_name(entity_name: &str, language: NluUtilsLanguage)
format!("entityfeature{}", e)
}

fn get_word_clusters(query_tokens: &[String], word_clusterer: Arc<WordClusterer>) -> Vec<String> {
fn get_word_clusters(query_tokens: &[String], word_clusterer: Arc<dyn WordClusterer>) -> Vec<String> {
let tokens_ref = query_tokens.iter().map(|t| t.as_ref()).collect_vec();
compute_all_ngrams(tokens_ref.as_ref(), tokens_ref.len())
.into_iter()
Expand All @@ -403,7 +403,7 @@ fn get_word_clusters(query_tokens: &[String], word_clusterer: Arc<WordClusterer>
.collect()
}

fn normalize_stem(tokens: &[String], opt_stemmer: Option<Arc<Stemmer>>) -> Vec<String> {
fn normalize_stem(tokens: &[String], opt_stemmer: Option<Arc<dyn Stemmer>>) -> Vec<String> {
opt_stemmer
.map(|stemmer| tokens.iter().map(|t| stemmer.stem(&normalize(t))).collect())
.unwrap_or_else(|| tokens.iter().map(|t| normalize(t)).collect())
Expand Down
2 changes: 1 addition & 1 deletion src/intent_classifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub trait IntentClassifier: Send + Sync {
pub fn build_intent_classifier<P: AsRef<Path>>(
path: P,
shared_resources: Arc<SharedResources>,
) -> Result<Box<IntentClassifier>> {
) -> Result<Box<dyn IntentClassifier>> {
let metadata_path = path.as_ref().join("metadata.json");
let metadata_file = File::open(&metadata_path).with_context(|_| {
format!(
Expand Down
2 changes: 1 addition & 1 deletion src/intent_parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn build_intent_parser<P: AsRef<Path>>(
metadata: ProcessingUnitMetadata,
path: P,
shared_resources: Arc<SharedResources>,
) -> Result<Box<IntentParser>> {
) -> Result<Box<dyn IntentParser>> {
match metadata {
ProcessingUnitMetadata::LookupIntentParser => {
Ok(Box::new(LookupIntentParser::from_path(path, shared_resources)?) as _)
Expand Down
4 changes: 2 additions & 2 deletions src/intent_parser/probabilistic_intent_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use super::{IntentClassifierResult, IntentParser, InternalParsingResult};
use crate::slot_utils::InternalSlot;

pub struct ProbabilisticIntentParser {
intent_classifier: Box<IntentClassifier>,
slot_fillers: HashMap<IntentName, Box<SlotFiller>>,
intent_classifier: Box<dyn IntentClassifier>,
slot_fillers: HashMap<IntentName, Box<dyn SlotFiller>>,
}

impl ProbabilisticIntentParser {
Expand Down
2 changes: 1 addition & 1 deletion src/models/intent_classifier.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;

use serde_derive::Deserialize;
use serde::Deserialize;

use crate::utils::IntentName;

Expand Down
2 changes: 1 addition & 1 deletion src/models/intent_parser.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;

use serde_derive::Deserialize;
use serde::Deserialize;

use crate::utils::{EntityName, IntentName, SlotName};

Expand Down
2 changes: 1 addition & 1 deletion src/models/nlu_engine.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;

use serde_derive::Deserialize;
use serde::Deserialize;

use crate::utils::{EntityName, IntentName, SlotName};

Expand Down
2 changes: 1 addition & 1 deletion src/models/processing_unit_metadata.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use serde_derive::Deserialize;
use serde::Deserialize;

#[derive(Debug, Deserialize, Copy, Clone, PartialEq, Eq)]
#[serde(tag = "unit_name")]
Expand Down
2 changes: 1 addition & 1 deletion src/models/slot_filler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;

use serde_derive::Deserialize;
use serde::Deserialize;

use crate::utils::{EntityName, IntentName, SlotName};

Expand Down
8 changes: 4 additions & 4 deletions src/nlu_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::utils::{extract_nlu_engine_zip_archive, EntityName, IterOps, SlotName

pub struct SnipsNluEngine {
dataset_metadata: DatasetMetadata,
intent_parsers: Vec<Box<IntentParser>>,
intent_parsers: Vec<Box<dyn IntentParser>>,
shared_resources: Arc<SharedResources>,
}

Expand Down Expand Up @@ -81,7 +81,7 @@ impl SnipsNluEngine {
engine_dir: P,
model: &NluEngineModel,
shared_resources: Arc<SharedResources>,
) -> Result<Vec<Box<IntentParser>>> {
) -> Result<Vec<Box<dyn IntentParser>>> {
model
.intent_parsers
.iter()
Expand Down Expand Up @@ -444,7 +444,7 @@ fn extract_custom_slot(
entity_name: EntityName,
slot_name: SlotName,
custom_entity: &Entity,
custom_entity_parser: Arc<CustomEntityParser>,
custom_entity_parser: Arc<dyn CustomEntityParser>,
slot_alternatives: usize,
) -> Result<Option<Slot>> {
let mut custom_entities = custom_entity_parser.extract_entities(
Expand Down Expand Up @@ -486,7 +486,7 @@ fn extract_builtin_slot(
input: String,
entity_name: EntityName,
slot_name: SlotName,
builtin_entity_parser: Arc<BuiltinEntityParser>,
builtin_entity_parser: Arc<dyn BuiltinEntityParser>,
slot_alternatives: usize,
) -> Result<Option<Slot>> {
let builtin_entity_kind = BuiltinEntityKind::from_identifier(&entity_name)?;
Expand Down
12 changes: 6 additions & 6 deletions src/resources/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::sync::Arc;

use failure::ResultExt;
use log::info;
use serde_derive::Deserialize;
use serde::Deserialize;
use snips_nlu_ontology::Language;

use crate::entity_parser::{CachingBuiltinEntityParser, CachingCustomEntityParser};
Expand Down Expand Up @@ -79,7 +79,7 @@ pub fn load_engine_shared_resources<P: AsRef<Path>>(engine_dir: P) -> Result<Arc
fn load_stemmer<P: AsRef<Path>>(
resources_dir: &P,
metadata: &ResourcesMetadata,
) -> Result<Option<Arc<Stemmer>>> {
) -> Result<Option<Arc<dyn Stemmer>>> {
if let Some(stems) = metadata.stems.as_ref() {
let stemming_directory = resources_dir.as_ref().join("stemming");
let stems_path = stemming_directory.join(stems).with_extension("txt");
Expand All @@ -98,8 +98,8 @@ fn load_stemmer<P: AsRef<Path>>(
fn load_gazetteers<P: AsRef<Path>>(
resources_dir: &P,
metadata: &ResourcesMetadata,
) -> Result<HashMap<String, Arc<Gazetteer>>> {
let mut gazetteers: HashMap<String, Arc<Gazetteer>> = HashMap::new();
) -> Result<HashMap<String, Arc<dyn Gazetteer>>> {
let mut gazetteers: HashMap<String, Arc<dyn Gazetteer>> = HashMap::new();
if let Some(gazetteer_names) = metadata.gazetteers.as_ref() {
let gazetteers_directory = resources_dir.as_ref().join("gazetteers");
for gazetteer_name in gazetteer_names {
Expand All @@ -124,8 +124,8 @@ fn load_gazetteers<P: AsRef<Path>>(
fn load_word_clusterers<P: AsRef<Path>>(
resources_dir: &P,
metadata: &ResourcesMetadata,
) -> Result<HashMap<String, Arc<WordClusterer>>> {
let mut word_clusterers: HashMap<String, Arc<WordClusterer>> = HashMap::new();
) -> Result<HashMap<String, Arc<dyn WordClusterer>>> {
let mut word_clusterers: HashMap<String, Arc<dyn WordClusterer>> = HashMap::new();
if let Some(word_clusters) = metadata.word_clusters.as_ref() {
let word_clusters_directory = resources_dir.as_ref().join("word_clusters");
for clusters_name in word_clusters {
Expand Down
10 changes: 5 additions & 5 deletions src/resources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use self::word_clusterer::WordClusterer;
use super::entity_parser::{BuiltinEntityParser, CustomEntityParser};

pub struct SharedResources {
pub builtin_entity_parser: Arc<BuiltinEntityParser>,
pub custom_entity_parser: Arc<CustomEntityParser>,
pub gazetteers: HashMap<String, Arc<Gazetteer>>,
pub stemmer: Option<Arc<Stemmer>>,
pub word_clusterers: HashMap<String, Arc<WordClusterer>>,
pub builtin_entity_parser: Arc<dyn BuiltinEntityParser>,
pub custom_entity_parser: Arc<dyn CustomEntityParser>,
pub gazetteers: HashMap<String, Arc<dyn Gazetteer>>,
pub stemmer: Option<Arc<dyn Stemmer>>,
pub word_clusterers: HashMap<String, Arc<dyn WordClusterer>>,
pub stop_words: HashSet<String>,
}
4 changes: 2 additions & 2 deletions src/slot_filler/feature_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl ProbabilisticFeatureProcessor {
}

struct FeatureOffsetter {
feature: Box<Feature>,
feature: Box<dyn Feature>,
offsets: Vec<i32>,
}

Expand Down Expand Up @@ -87,7 +87,7 @@ pub trait Feature: FeatureKindRepr + Send + Sync {
fn build_features(
args: &HashMap<String, serde_json::Value>,
shared_resources: Arc<SharedResources>,
) -> Result<Vec<Box<Feature>>>
) -> Result<Vec<Box<dyn Feature>>>
where
Self: Sized;
fn compute(&self, tokens: &[Token], token_index: usize) -> Result<Option<String>>;
Expand Down
Loading

0 comments on commit bf16a8a

Please sign in to comment.