mirror of
https://github.com/SinTan1729/unscrambler-rust.git
synced 2025-04-19 09:20:02 -05:00
Updated wordlist and made related changes in code
This commit is contained in:
parent
6192c22c19
commit
ade3107107
4 changed files with 740218 additions and 4 deletions
|
@ -3,3 +3,7 @@
|
|||
I'm learning Rust, so this is just a rewrite of an simple old project in Rust.
|
||||
|
||||
[Link to old project.](https://github.com/SinTan1729/Unscrambler)
|
||||
|
||||
### Note
|
||||
|
||||
The main wordlist was pulled from [words_alpha.txt by dwyl](https://github.com/dwyl/english-words/) and processed using Rust. Processing code was really simple, so didn't put it up here.
|
370106
src/data/wordlist.txt
370106
src/data/wordlist.txt
File diff suppressed because one or more lines are too long
370106
src/data/wordlist_sorted.txt
370106
src/data/wordlist_sorted.txt
File diff suppressed because one or more lines are too long
|
@ -4,6 +4,8 @@ fn main() {
|
|||
// read the dictionary files
|
||||
let wordlist = include_str!("data/wordlist.txt");
|
||||
let wordlist_sorted = include_str!("data/wordlist_sorted.txt");
|
||||
let wordlist = &[" ", &wordlist.replace("\n", " ")[..]].join("")[..];
|
||||
let wordlist_sorted = &[" ", &wordlist_sorted.replace("\n", " ")[..]].join("")[..];
|
||||
|
||||
// get into a loop so that we can run it multiple times
|
||||
loop {
|
||||
|
@ -41,7 +43,7 @@ fn main() {
|
|||
for index in indices {
|
||||
println!(
|
||||
"{}",
|
||||
sentence_case(&wordlist[index + 1..index + input.len() - 1])
|
||||
sentence_case(&wordlist[index + 1..index - 1 + input.len()])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +64,6 @@ fn sentence_case(s: &str) -> String {
|
|||
let mut c = s.chars();
|
||||
match c.next() {
|
||||
None => String::new(),
|
||||
Some(f) => f.to_uppercase().collect::<String>() + &c.as_str()[..].to_lowercase(),
|
||||
Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue