Skip to content

Commit 3f5a57a

Browse files
authored
Merge pull request #120 from snipsco/task/portuguese-v0
Add bindings for Portuguese - PT and BR variants.
2 parents 25e1bd0 + f11ac01 commit 3f5a57a

File tree

15 files changed

+65
-54
lines changed

15 files changed

+65
-54
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.64.0] - 2019-02-28
5+
### Changed
6+
- Bumped `snips-nlu-ontology` to 0.64.4
7+
- Bumped `crf-suite` to 0.3.1 and cbindgen to
8+
49
## [0.63.1] - 2019-02-11
510
### Fixed
611
- Fix an issue regarding the way builtin entities were handled by the `CRFSlotFiller`
@@ -169,6 +174,7 @@ being statically hardcoded, reducing the binary size by 31Mb.
169174
- Improve support for japanese
170175
- Rename python package to `snips_nlu_rust`
171176

177+
[0.64.0]: https://github.com/snipsco/snips-nlu-rs/compare/0.63.1...0.64.0
172178
[0.63.1]: https://github.com/snipsco/snips-nlu-rs/compare/0.63.0...0.63.1
173179
[0.63.0]: https://github.com/snipsco/snips-nlu-rs/compare/0.62.0...0.63.0
174180
[0.61.2]: https://github.com/snipsco/snips-nlu-rs/compare/0.61.1...0.61.2

Cargo.toml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "snips-nlu-lib"
3-
version = "0.63.1"
3+
version = "0.64.0"
44
authors = [
55
"Adrien Ball <[email protected]>",
66
"Clement Doumouro <[email protected]>",
@@ -13,34 +13,33 @@ edition = "2018"
1313

1414
[workspace]
1515
members = [
16-
".",
1716
"ffi",
1817
"platforms/python/ffi",
1918
]
2019

2120
[dependencies]
22-
crfsuite = { git = "https://github.com/snipsco/crfsuite-rs", rev = "91fda4b" }
23-
snips-nlu-ontology = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.63.1" }
24-
snips-nlu-parsers = { git = "https://github.com/snipsco/snips-nlu-parsers", tag = "0.1.2" }
25-
snips-nlu-utils = { git = "https://github.com/snipsco/snips-nlu-utils", tag = "0.7.1" }
21+
crfsuite = { git = "https://github.com/snipsco/crfsuite-rs", tag = "0.3.1" }
22+
snips-nlu-ontology = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.64.4" }
23+
snips-nlu-parsers = { git = "https://github.com/snipsco/snips-nlu-parsers", tag = "0.2.0" }
24+
snips-nlu-utils = { git = "https://github.com/snipsco/snips-nlu-utils", tag = "0.8.0" }
2625
failure = "0.1"
27-
base64 = "0.9"
28-
itertools = { version = "0.7", default-features = false }
26+
base64 = "0.10"
27+
itertools = { version = "0.8", default-features = false }
2928
log = "0.4"
3029
lru-cache = "0.1"
3130
serde = "1.0"
3231
serde_derive = "1.0"
3332
serde_json = "1.0"
3433
tempfile = "3"
35-
ndarray = "0.11"
34+
ndarray = "0.12"
3635
regex = "1.0"
3736
csv = "1.0"
38-
zip = { version = "0.3", features=["deflate"] }
37+
zip = { version = "0.5", default-features = false, features = ["deflate"] }
3938

4039
[dev-dependencies]
4140
bencher = { git = "https://github.com/snipsco/bencher", rev = "63910ace" }
4241
clap = "2.32"
43-
dinghy-test = "0.3"
42+
dinghy-test = "0.4"
4443
maplit = "1.0"
4544
fs_extra = "1.1"
4645

ffi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "snips-nlu-ffi"
3-
version = "0.63.1"
3+
version = "0.64.0"
44
edition = "2018"
55
authors = [
66
"Adrien Ball <[email protected]>",
@@ -12,7 +12,7 @@ authors = [
1212
[dependencies]
1313
ffi-utils = { git = "https://github.com/snipsco/snips-utils-rs", rev = "4292ad9" }
1414
snips-nlu-lib = { path = ".." }
15-
snips-nlu-ontology-ffi-macros = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.63.1" }
15+
snips-nlu-ontology-ffi-macros = { git = "https://github.com/snipsco/snips-nlu-ontology", tag = "0.64.4" }
1616
failure = "0.1"
1717
lazy_static = "1.0"
1818
libc = "0.2"

platforms/c/libsnips_nlu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <stdlib.h>
66
#include <stdbool.h>
77

8-
#define SNIPS_NLU_VERSION "0.63.1"
8+
#define SNIPS_NLU_VERSION "0.64.0"
99

1010
/*
1111
* Enum representing the grain of a resolved date related value

platforms/kotlin/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ buildscript {
1111

1212
apply plugin: 'kotlin'
1313

14-
version = "0.63.1"
14+
version = "0.64.0"
1515
group = "ai.snips"
1616

1717
repositories {
@@ -32,7 +32,7 @@ configurations {
3232
dependencies {
3333
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
3434
compile 'net.java.dev.jna:jna:4.5.0'
35-
compile "ai.snips:snips-nlu-ontology:0.63.1"
35+
compile "ai.snips:snips-nlu-ontology:0.64.4"
3636
testCompile 'junit:junit:4.12'
3737
testCompile 'com.google.truth:truth:0.36'
3838
}

platforms/python/ffi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "snips-nlu-python-ffi"
3-
version = "0.63.1"
3+
version = "0.64.0"
44
authors = ["Adrien Ball <[email protected]>"]
55
edition = "2018"
66

@@ -11,4 +11,4 @@ crate-type = ["cdylib"]
1111
[dependencies]
1212
libc = "0.2"
1313
ffi-utils = { git = "https://github.com/snipsco/snips-utils-rs", rev = "4292ad9" }
14-
snips-nlu-ffi = { git = "https://github.com/snipsco/snips-nlu-rs", tag = "0.63.1" }
14+
snips-nlu-ffi = { git = "https://github.com/snipsco/snips-nlu-rs", tag = "0.64.0" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.63.1
1+
0.64.0

platforms/swift/SnipsNlu/Dependencies/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
set -e
66

7-
VERSION="0.63.1"
7+
VERSION="0.64.0"
88
SYSTEM=$(echo $1 | tr '[:upper:]' '[:lower:]')
99
LIBRARY_NAME=libsnips_nlu_ffi
1010
LIBRARY_NAME_A=${LIBRARY_NAME}.a

src/intent_classifier/featurizer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ impl TfidfVectorizer {
188188
let builtin_entities_features: Vec<String> = builtin_entities
189189
.iter()
190190
.map(|ent| get_builtin_entity_feature_name(ent.entity_kind, self.language))
191-
.sorted();
191+
.sorted()
192+
.collect();
192193

193194
// Extract custom entities on the normalized utterance
194195
let custom_entities = self
@@ -399,6 +400,7 @@ fn get_word_clusters(query_tokens: &[String], word_clusterer: Arc<WordClusterer>
399400
.into_iter()
400401
.filter_map(|ngram| word_clusterer.get_cluster(&ngram.0.to_lowercase()))
401402
.sorted()
403+
.collect()
402404
}
403405

404406
fn normalize_stem(tokens: &[String], opt_stemmer: Option<Arc<Stemmer>>) -> Vec<String> {

src/intent_classifier/log_reg_intent_classifier.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl IntentClassifier for LogRegIntentClassifier {
7575
Ok(if intents_results.is_empty() {
7676
IntentClassifierResult {
7777
intent_name: None,
78-
probability: 1.0,
78+
confidence_score: 1.0,
7979
}
8080
} else {
8181
intents_results.into_iter().next().unwrap()
@@ -96,7 +96,7 @@ impl LogRegIntentClassifier {
9696
if self.intent_list.len() <= 1 {
9797
return Ok(vec![IntentClassifierResult {
9898
intent_name: self.intent_list.first().cloned().unwrap_or(None),
99-
probability: 1.0,
99+
confidence_score: 1.0,
100100
}]);
101101
}
102102

@@ -106,9 +106,10 @@ impl LogRegIntentClassifier {
106106
.iter()
107107
.map(|intent_name| IntentClassifierResult {
108108
intent_name: intent_name.clone(),
109-
probability: if intent_name.is_none() { 1.0 } else { 0.0 },
109+
confidence_score: if intent_name.is_none() { 1.0 } else { 0.0 },
110110
})
111-
.sorted_by(|a, b| b.probability.partial_cmp(&a.probability).unwrap()));
111+
.sorted_by(|a, b| b.confidence_score.partial_cmp(&a.confidence_score).unwrap())
112+
.collect());
112113
}
113114

114115
let opt_intents_set: Option<HashSet<&str>> =
@@ -120,15 +121,15 @@ impl LogRegIntentClassifier {
120121
let features = featurizer.transform(input)?;
121122
let filtered_out_indexes =
122123
get_filtered_out_intents_indexes(&self.intent_list, opt_intents_set.as_ref());
123-
let probabilities = logreg.run(&features.view(), filtered_out_indexes)?;
124+
let scores = logreg.run(&features.view(), filtered_out_indexes)?;
124125

125126
Ok(self
126127
.intent_list
127128
.iter()
128-
.zip(probabilities.into_iter())
129-
.map(|(intent_name, probability)| IntentClassifierResult {
129+
.zip(scores.into_iter())
130+
.map(|(intent_name, score)| IntentClassifierResult {
130131
intent_name: intent_name.clone(),
131-
probability: *probability,
132+
confidence_score: *score,
132133
})
133134
.filter(|res| {
134135
if let Some(intent) = res.intent_name.as_ref() {
@@ -140,7 +141,8 @@ impl LogRegIntentClassifier {
140141
true
141142
}
142143
})
143-
.sorted_by(|a, b| b.probability.partial_cmp(&a.probability).unwrap()))
144+
.sorted_by(|a, b| b.confidence_score.partial_cmp(&a.confidence_score).unwrap())
145+
.collect())
144146
}
145147
}
146148

@@ -372,7 +374,7 @@ mod tests {
372374
let actual_result = classification_result.unwrap();
373375
let expected_result = IntentClassifierResult {
374376
intent_name: Some("MakeTea".to_string()),
375-
probability: 0.9088109819597295,
377+
confidence_score: 0.9088109819597295,
376378
};
377379

378380
// Then

0 commit comments

Comments
 (0)