Create new wordlist logic and speed up builds
This commit is contained in:
parent
f70d8524bb
commit
97f2cc5d05
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
# ".",
|
||||
"./words",
|
||||
"./this_algorithm",
|
||||
]
|
||||
|
22394
data/wordlist-tmp.csv
22394
data/wordlist-tmp.csv
File diff suppressed because it is too large
Load Diff
Binary file not shown.
2642
docs/wordlist-new.ipynb
Normal file
2642
docs/wordlist-new.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
2112
docs/wordlist.ipynb
2112
docs/wordlist.ipynb
File diff suppressed because one or more lines are too long
@ -8,7 +8,9 @@ fn test_v0() {
|
||||
t("\t\tgrape\n\t orange apple 1000 \t ");
|
||||
t("\n1000 APPlE oRAnGE GrAPe\n");
|
||||
|
||||
ll(37.55512, -76.89212);
|
||||
for i in 0..100 {
|
||||
ll(37.55512 + f64::from(i) * 0.00001, -76.89212);
|
||||
}
|
||||
assert!(false);
|
||||
}
|
||||
fn ll(lat: f64, lon: f64) {
|
||||
|
@ -75,7 +75,8 @@ fn write_number_to_words(mut file: impl Write, words: &[Word]) {
|
||||
writeln!(
|
||||
&mut file,
|
||||
// "pub static NUMBER_TO_WORDS: &[&[usize]] = &["
|
||||
"pub static NUMBER_TO_WORDS: &[&[&'static Word]] = &["
|
||||
r#"/// Mapping from each number to its associated word
|
||||
pub static NUMBER_TO_WORDS: &[&[&'static Word]] = &["#
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -89,7 +90,7 @@ fn write_number_to_words(mut file: impl Write, words: &[Word]) {
|
||||
// write!(&mut file, "{idx},").unwrap();
|
||||
write!(&mut file, "&WORDS[{idx}],").unwrap();
|
||||
}
|
||||
writeln!(&mut file, "],").unwrap();
|
||||
writeln!(&mut file, "], /* {} */", entry[0].0).unwrap();
|
||||
}
|
||||
writeln!(&mut file, "];\n").unwrap();
|
||||
}
|
||||
|
@ -58,6 +58,15 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_length() {
|
||||
assert!(WORDS.len() > 8195);
|
||||
|
||||
for i in 0..8195_u16 {
|
||||
assert_eq!(NUMBER_TO_WORDS[i as usize][0].number, i);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_equivalence() {
|
||||
// Test equivalence
|
||||
@ -78,6 +87,8 @@ mod tests {
|
||||
// Homonyms
|
||||
te!(blue, blew);
|
||||
te!(yellow, hello);
|
||||
te!(days, daze);
|
||||
te!(day, days);
|
||||
|
||||
// Plurals
|
||||
te!(sent, sense);
|
||||
|
Loading…
Reference in New Issue
Block a user