Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.6.1 #66

Merged
merged 4 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions evaluate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let precision = f64::from(n_tp) / f64::from(n_tp + n_fp);
let recall = f64::from(n_tp) / f64::from(n_tp + n_fn);
let f1 = 2. * precision * recall / (precision + recall);
println!("Precision: {}", precision);
println!("Recall: {}", recall);
println!("F1: {}", f1);
println!("TP: {}, TN: {}, FP: {}, FN: {}", n_tp, n_tn, n_fp, n_fn);
println!("Precision: {precision}");
println!("Recall: {recall}");
println!("F1: {f1}");
println!("TP: {n_tp}, TN: {n_tn}, FP: {n_fp}, FN: {n_fn}");
}
EvaluationMetric::Word => {
// Reference:
Expand Down Expand Up @@ -201,9 +201,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let precision = f64::from(n_cor) / f64::from(n_sys);
let recall = f64::from(n_cor) / f64::from(n_ref);
let f1 = 2. * precision * recall / (precision + recall);
println!("Precision: {}", precision);
println!("Recall: {}", recall);
println!("F1: {}", f1);
println!("Precision: {precision}");
println!("Recall: {recall}");
println!("F1: {f1}");
}
}

Expand Down
6 changes: 3 additions & 3 deletions predict/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn print_scores(s: &Sentence, out: &mut dyn Write) -> Result<(), Box<dyn std::er
let mut chars_iter = s.as_raw_text().chars();
let mut prev_c = chars_iter.next().unwrap();
for (i, (c, score)) in chars_iter.zip(s.boundary_scores()).enumerate() {
writeln!(out, "{}:{}{} {}", i, prev_c, c, score)?;
writeln!(out, "{i}:{prev_c}{c} {score}")?;
prev_c = c;
}
writeln!(out)?;
Expand Down Expand Up @@ -116,7 +116,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
s.fill_tags();
}
s.write_tokenized_text(&mut buf);
writeln!(out, "{}", buf)?;
writeln!(out, "{buf}")?;
if args.scores {
print_scores(&s, &mut *out)?;
}
Expand All @@ -143,7 +143,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
s_orig.boundaries_mut().copy_from_slice(s.boundaries());
s_orig.tags_mut().clone_from_slice(s.tags());
s_orig.write_tokenized_text(&mut buf);
writeln!(out, "{}", buf)?;
writeln!(out, "{buf}")?;
if args.scores {
print_scores(&s, &mut *out)?;
}
Expand Down
10 changes: 5 additions & 5 deletions train/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut train_sents = vec![];

for path in args.tok {
eprintln!("Loading {:?} ...", path);
eprintln!("Loading {path:?} ...");
let f = File::open(path)?;
let f = BufReader::new(f);
for (i, line) in f.lines().enumerate() {
if i % 10000 == 0 {
eprint!("# of sentences: {}\r", i);
eprint!("# of sentences: {i}\r");
stderr().flush()?;
}
let s = Sentence::from_tokenized(&line?)?;
Expand All @@ -101,12 +101,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("# of sentences: {}", train_sents.len());
}
for path in args.part {
eprintln!("Loading {:?} ...", path);
eprintln!("Loading {path:?} ...");
let f = File::open(path)?;
let f = BufReader::new(f);
for (i, line) in f.lines().enumerate() {
if i % 10000 == 0 {
eprint!("# of sentences: {}\r", i);
eprint!("# of sentences: {i}\r");
stderr().flush()?;
}
let s = Sentence::from_partial_annotation(&line?)?;
Expand All @@ -128,7 +128,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut tag_dictionary = vec![];
let mut dictionary = BTreeSet::new();
for path in args.dict {
eprintln!("Loading {:?} ...", path);
eprintln!("Loading {path:?} ...");
let f = File::open(path)?;
let f = BufReader::new(f);
for line in f.lines() {
Expand Down
2 changes: 1 addition & 1 deletion vaporetto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vaporetto"
version = "0.6.0"
version = "0.6.1"
edition = "2021"
rust-version = "1.60"
authors = ["Koichi Akabe <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion vaporetto/src/sentence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ impl<'a, 'b> Sentence<'a, 'b> {
} else {
return Err(VaporettoError::invalid_argument(
"partial_annotation_text",
format!("contains an invalid boundary character: '{}'", c),
format!("contains an invalid boundary character: '{c}'"),
));
}
}
Expand Down
6 changes: 3 additions & 3 deletions vaporetto/src/tag_trainer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl<'a> TagTrainer<'a> {

let mut builder = liblinear::Builder::new();
let training_input = liblinear::util::TrainingInput::from_sparse_features(ys, xs)
.map_err(|e| VaporettoError::invalid_model(format!("liblinear error: {:?}", e)))?;
.map_err(|e| VaporettoError::invalid_model(format!("liblinear error: {e:?}")))?;
builder.problem().input_data(training_input).bias(1.0);
builder
.parameters()
Expand Down Expand Up @@ -321,9 +321,9 @@ impl<'a> TagTrainer<'a> {
cost,
solver,
)?);
eprint!("Tags: {}/{}\r", i, n_tokens);
eprint!("Tags: {i}/{n_tokens}\r");
}
eprintln!("Tags: {}/{}", n_tokens, n_tokens);
eprintln!("Tags: {n_tokens}/{n_tokens}");
liblinear::toggle_liblinear_stdout_output(true);
Ok(tag_models)
}
Expand Down
2 changes: 1 addition & 1 deletion vaporetto/src/trainer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl<'a> Trainer<'a> {
pub fn train(self, epsilon: f64, cost: f64, solver: SolverType) -> Result<Model> {
let mut builder = liblinear::Builder::new();
let training_input = liblinear::util::TrainingInput::from_sparse_features(self.ys, self.xs)
.map_err(|e| VaporettoError::invalid_model(format!("liblinear error: {:?}", e)))?;
.map_err(|e| VaporettoError::invalid_model(format!("liblinear error: {e:?}")))?;
builder.problem().input_data(training_input).bias(1.0);
builder
.parameters()
Expand Down
6 changes: 3 additions & 3 deletions vaporetto_rules/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vaporetto_rules"
version = "0.6.0"
version = "0.6.1"
edition = "2021"
rust-version = "1.60"
authors = ["Koichi Akabe <[email protected]>"]
Expand All @@ -15,7 +15,7 @@ categories = ["text-processing", "no-std"]
[dependencies]
hashbrown = "0.12.3" # MIT or Apache-2.0
unicode-segmentation = "1.10.0" # MIT or Apache-2.0
vaporetto = { path = "../vaporetto", version = "=0.6.0", default-features = false, features = ["alloc"] } # MIT or Apache-2.0
vaporetto = { path = "../vaporetto", version = "=0.6.1", default-features = false, features = ["alloc"] } # MIT or Apache-2.0

[dev-dependencies]
vaporetto = { path = "../vaporetto", version = "=0.6.0" } # MIT or Apache-2.0
vaporetto = { path = "../vaporetto", version = "=0.6.1" } # MIT or Apache-2.0
6 changes: 3 additions & 3 deletions vaporetto_tantivy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vaporetto_tantivy"
version = "0.6.0"
version = "0.6.1"
edition = "2021"
rust-version = "1.60"
authors = ["Koichi Akabe <[email protected]>"]
Expand All @@ -13,8 +13,8 @@ keywords = ["japanese", "tokenizer", "tantivy"]
categories = ["text-processing"]

[dependencies]
vaporetto = { path = "../vaporetto", version = "=0.6.0" } # MIT or Apache-2.0
vaporetto_rules = { path = "../vaporetto_rules", version = "=0.6.0" } # MIT or Apache-2.0
vaporetto = { path = "../vaporetto", version = "=0.6.1" } # MIT or Apache-2.0
vaporetto_rules = { path = "../vaporetto_rules", version = "=0.6.1" } # MIT or Apache-2.0
tantivy = "0.18" # MIT

[dev-dependencies]
Expand Down