diff --git a/evaluate/src/main.rs b/evaluate/src/main.rs index 8ce8fac..82b3658 100644 --- a/evaluate/src/main.rs +++ b/evaluate/src/main.rs @@ -157,10 +157,10 @@ fn main() -> Result<(), Box> { 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: @@ -201,9 +201,9 @@ fn main() -> Result<(), Box> { 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}"); } } diff --git a/predict/src/main.rs b/predict/src/main.rs index 3f4a354..269bb4f 100644 --- a/predict/src/main.rs +++ b/predict/src/main.rs @@ -67,7 +67,7 @@ fn print_scores(s: &Sentence, out: &mut dyn Write) -> Result<(), Box Result<(), Box> { s.fill_tags(); } s.write_tokenized_text(&mut buf); - writeln!(out, "{}", buf)?; + writeln!(out, "{buf}")?; if args.scores { print_scores(&s, &mut *out)?; } @@ -143,7 +143,7 @@ fn main() -> Result<(), Box> { 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)?; } diff --git a/train/src/main.rs b/train/src/main.rs index 4824ba8..0105d22 100644 --- a/train/src/main.rs +++ b/train/src/main.rs @@ -77,12 +77,12 @@ fn main() -> Result<(), Box> { 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?)?; @@ -101,12 +101,12 @@ fn main() -> Result<(), Box> { 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?)?; @@ -128,7 +128,7 @@ fn main() -> Result<(), Box> { 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() { diff --git a/vaporetto/Cargo.toml b/vaporetto/Cargo.toml index 25f205a..2089746 100644 --- a/vaporetto/Cargo.toml +++ b/vaporetto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vaporetto" -version = "0.6.0" +version = "0.6.1" edition = "2021" rust-version = "1.60" authors = ["Koichi Akabe "] diff --git a/vaporetto/src/sentence.rs b/vaporetto/src/sentence.rs index 949f159..066dc9c 100644 --- a/vaporetto/src/sentence.rs +++ b/vaporetto/src/sentence.rs @@ -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}'"), )); } } diff --git a/vaporetto/src/tag_trainer.rs b/vaporetto/src/tag_trainer.rs index a6ca686..fd8f76d 100644 --- a/vaporetto/src/tag_trainer.rs +++ b/vaporetto/src/tag_trainer.rs @@ -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() @@ -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) } diff --git a/vaporetto/src/trainer.rs b/vaporetto/src/trainer.rs index c92ddde..1270a63 100644 --- a/vaporetto/src/trainer.rs +++ b/vaporetto/src/trainer.rs @@ -352,7 +352,7 @@ impl<'a> Trainer<'a> { pub fn train(self, epsilon: f64, cost: f64, solver: SolverType) -> Result { 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() diff --git a/vaporetto_rules/Cargo.toml b/vaporetto_rules/Cargo.toml index 6f3f64b..09800ce 100644 --- a/vaporetto_rules/Cargo.toml +++ b/vaporetto_rules/Cargo.toml @@ -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 "] @@ -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 diff --git a/vaporetto_tantivy/Cargo.toml b/vaporetto_tantivy/Cargo.toml index cfe31dc..e852339 100644 --- a/vaporetto_tantivy/Cargo.toml +++ b/vaporetto_tantivy/Cargo.toml @@ -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 "] @@ -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]