aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-10-11 12:09:37 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-11 12:13:53 +0200
commitc7f229c9015f9feb64a616efb9c6f48cde535b92 (patch)
tree705689d5eaa9cef8baa0084bded11337c4603f6f /src
parentcd6adbd3c9994b837f3b52f5f5489078cfdaaa14 (diff)
downloaddatagengo-c7f229c9015f9feb64a616efb9c6f48cde535b92.tar.gz
datagengo-c7f229c9015f9feb64a616efb9c6f48cde535b92.zip
regenerate extra example sentences with deterministic randomness
Diffstat (limited to 'src')
-rw-r--r--src/main.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 7e0b40b..7ecc195 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1002,7 +1002,7 @@ fn add_examples(all_batches: &mut [Batch], examples: &[Example]) {
.into_iter()
.map(|(_, ex)| ex)
.collect::<Vec<_>>();
- candidates.shuffle(&mut thread_rng());
+ candidates.sort_by_key(|ex| fasthash::metro::hash64(ex.ja.as_bytes()));
batch.extra_examples.clear();
let mut in_batch = Charset::from_iter(batch.examples.iter().map(|x| x.chars.chars().iter().copied()).flatten());
@@ -1020,7 +1020,7 @@ fn add_examples(all_batches: &mut [Batch], examples: &[Example]) {
}
}
- batch.extra_examples.shuffle(&mut thread_rng());
+ batch.extra_examples.sort_by_key(|ex| fasthash::metro::hash64(ex.ja.as_bytes()));
println!("---- BATCH #{:03} ----", i);
for ex in batch.extra_examples.iter() {