add instructions

This commit is contained in:
Book-reader 2025-05-10 01:55:53 +12:00
parent 270698c762
commit 623b068cef

View file

@ -3,9 +3,24 @@ use tracing::{debug, error};
use std::{cmp, mem};
use std::collections::BTreeMap;
use std::sync::Mutex;
// TODO: cache distances of strings/substrings
// TODO: use binary search to find direct matches, and if that fails, calculate and cache the result in BTreeMap<word: String, closest_match: String>
// how to generate words.txt:
// clone https://github.com/en-wl/wordlist && cd wordlist
// ./scowl wl --deaccent > words0.txt
// filtered with this python script:
// -----------------------------------
// with open("words0.txt", "r") as f:
// out = []
// for line in f:
// line = line.lower()
// if not line in out:
// out.append(line)
// out.sort()
// with open("words.txt", "w") as out_file:
// for line in out:
// out_file.write(f'{line}')
// ------------------------------------
// then use regex or similar to enclose every line in quotes and add comma, then add 'static KNOWN_WORDS: &[&str] = &[' to the start and '];' to the end
include!("./words.txt");
// a cache of misspelled words and the closest match in the database