Skip to content

Commit 63c0b93

Browse files
authored
Merge pull request #38 from snipsco/hotfix/license-info
[hotfix-0.7.2] Make LicenseInfo public
2 parents ffd93e5 + 4a8d299 commit 63c0b93

File tree

5 files changed

+38
-31
lines changed

5 files changed

+38
-31
lines changed

CHANGELOG.md

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

4+
## [0.7.2]
5+
### Fixed
6+
- Make `LicenseInfo` public [#38](https://github.com/snipsco/gazetteer-entity-parser/pull/38)
7+
48
## [0.7.1]
59
### Added
610
- Add a license file to the gazetteer entity parser [#36](https://github.com/snipsco/gazetteer-entity-parser/pull/36)
@@ -23,6 +27,7 @@ All notable changes to this project will be documented in this file.
2327
### Changed
2428
- Clearer `ParserBuilder`'s API
2529

30+
[0.7.2]: https://github.com/snipsco/gazetteer-entity-parser/compare/0.7.1...0.7.2
2631
[0.7.1]: https://github.com/snipsco/gazetteer-entity-parser/compare/0.7.0...0.7.1
2732
[0.7.0]: https://github.com/snipsco/gazetteer-entity-parser/compare/0.6.0...0.7.0
2833
[0.6.0]: https://github.com/snipsco/gazetteer-entity-parser/compare/0.5.1...0.6.0

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gazetteer-entity-parser"
3-
version = "0.7.1"
3+
version = "0.7.2"
44
authors = ["Alaa Saade <[email protected]>"]
55

66
[profile.bench]
@@ -16,10 +16,10 @@ fnv = "1.0"
1616

1717
[dev-dependencies]
1818
criterion = "0.2"
19-
dinghy-test = "0.3"
20-
rand = "0.5"
19+
dinghy-test = "0.4"
20+
rand = "0.7"
2121
tempfile = "3"
22-
mio_httpc = {version = "0.6", features = ["rtls"]}
22+
mio_httpc = {version = "0.8", features = ["rtls"]}
2323
clap = "2"
2424

2525
[[bench]]

benches/bench_parser.rs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,21 @@ extern crate gazetteer_entity_parser;
55
extern crate rand;
66
extern crate serde_json;
77

8-
use std::collections::HashSet;
9-
108
use criterion::Criterion;
9+
use gazetteer_entity_parser::*;
1110
use rand::distributions::Alphanumeric;
12-
use rand::seq::sample_iter;
11+
use rand::rngs::ThreadRng;
12+
use rand::seq::IteratorRandom;
1313
use rand::thread_rng;
1414
use rand::Rng;
15-
16-
use gazetteer_entity_parser::*;
15+
use std::collections::HashSet;
1716

1817
pub fn test_data_path() -> ::std::path::PathBuf {
19-
::dinghy_test::try_test_file_path("data")
20-
.unwrap_or_else(|| "data".into())
18+
::dinghy_test::try_test_file_path("data").unwrap_or_else(|| "data".into())
2119
}
2220

2321
/// Function generating a random string representing a single word of various length
24-
fn generate_random_string(rng: &mut rand::ThreadRng) -> String {
22+
fn generate_random_string(rng: &mut ThreadRng) -> String {
2523
let n_char = rng.gen_range(3, 8);
2624
rng.sample_iter(&Alphanumeric).take(n_char).collect()
2725
}
@@ -31,7 +29,7 @@ fn generate_random_string(rng: &mut rand::ThreadRng) -> String {
3129
struct RandomStringGenerator {
3230
vocabulary: Vec<String>,
3331
max_words: usize,
34-
rng: rand::ThreadRng,
32+
rng: ThreadRng,
3533
already_generated: HashSet<String>,
3634
}
3735

@@ -56,8 +54,10 @@ impl Iterator for RandomStringGenerator {
5654
fn next(&mut self) -> Option<String> {
5755
loop {
5856
let n_words = self.rng.gen_range(1, self.max_words);
59-
let generated_value = sample_iter(&mut self.rng, self.vocabulary.iter(), n_words)
60-
.unwrap()
57+
let generated_value = self
58+
.vocabulary
59+
.iter()
60+
.choose_multiple(&mut self.rng, n_words)
6161
.iter()
6262
.map(|sample_string| sample_string.to_string())
6363
.collect::<Vec<_>>()
@@ -84,7 +84,9 @@ fn generate_random_gazetteer(
8484
raw_value: string,
8585
})
8686
.collect();
87-
let gazetteer = Gazetteer { data: entity_values };
87+
let gazetteer = Gazetteer {
88+
data: entity_values,
89+
};
8890
(gazetteer, rsg)
8991
}
9092

@@ -140,10 +142,16 @@ fn loading(c: &mut Criterion) {
140142

141143
parser.dump(&parser_directory).unwrap();
142144
}
143-
c.bench_function("Loading random gazetteer parser with low redundancy", move |b| {
144-
b.iter(|| Parser::from_folder(parser_directory.clone()).unwrap())
145-
});
145+
c.bench_function(
146+
"Loading random gazetteer parser with low redundancy",
147+
move |b| b.iter(|| Parser::from_folder(parser_directory.clone()).unwrap()),
148+
);
146149
}
147150

148-
criterion_group!(benches, parsing_low_redundancy, parsing_high_redundancy, loading);
151+
criterion_group!(
152+
benches,
153+
parsing_low_redundancy,
154+
parsing_high_redundancy,
155+
loading
156+
);
149157
criterion_main!(benches);

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ mod parser_builder;
8888
mod symbol_table;
8989
mod utils;
9090

91-
pub use data::{EntityValue, Gazetteer};
92-
pub use parser::{ParsedValue, Parser};
93-
pub use parser_builder::ParserBuilder;
91+
pub use data::*;
92+
pub use parser::*;
93+
pub use parser_builder::*;
9494
pub mod errors;

update_version.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@ set -e
44

55
NEW_VERSION=$1
66

7-
if [ -z $NEW_VERSION ]; then
7+
if [[ -z ${NEW_VERSION} ]]; then
88
echo "Usage: $0 NEW_VERSION"
99
exit 1
1010
fi
1111

1212
SPLIT_VERSION=( ${NEW_VERSION//./ } )
13-
if [ ${#SPLIT_VERSION[@]} -ne 3 ]; then
13+
if [[ ${#SPLIT_VERSION[@]} -ne 3 ]]; then
1414
echo "Version number is invalid (must be of the form x.y.z)"
1515
exit 1
1616
fi
1717

18-
let SPLIT_VERSION[1]+=1
19-
NEXT_NEW_VERSION="${SPLIT_VERSION[0]}.${SPLIT_VERSION[1]}.${SPLIT_VERSION[2]}"
20-
21-
echo "REAL VERSION $NEW_VERSION"
22-
echo "NEXT VERSION $NEXT_NEW_VERSION"
23-
2418
perl -p -i -e "s/^version = \".*\"\$/version = \"$NEW_VERSION\"/g" Cargo.toml

0 commit comments

Comments
 (0)