| Crates.io | urlchecker |
| lib.rs | urlchecker |
| version | 0.3.0 |
| created_at | 2022-08-04 14:05:08.09759+00 |
| updated_at | 2022-08-14 18:54:14.017484+00 |
| description | A simple url checker for finding fraud url(s) or nearest url |
| homepage | |
| repository | https://github.com/sn99/urlchecker |
| max_upload_size | |
| id | 638741 |
| size | 11,571 |
A simple url checker for finding fraud url(s) or nearest url while being fast (threading)
A spell-checker based on the statistical algorithm described by Peter Norvig in http://norvig.com/spell-correct.html.
Usage requires a two-step process:
url.train() one or more times with a large text to train the language modelurl.correct(word) to retrieve the correction for the specified URL if it exists
Eg:-
use std::collections::HashMap;
use urlchecker::URL;
fn main() {
let mut url = URL {
letters: "1234567890._-@abcdefghijklmnopqrstuvwxyz".to_string(),
url_counts: HashMap::new(),
};
url.train(
"https://docs.rs/regex/latest/regex/ \
https://norvig.com/spell-correct.html \
https://doc.rust-lang.org/stable/std/thread/fn.scope.html\
https://docs.rs/urlchecker/latest/urlchecker/index.html",
);
println!("{:#?}", url);
println!("{:#?}", url.correct("doks.rs"));
}
Output:-
URL {
letters: "1234567890._-@abcdefghijklmnopqrstuvwxyz",
url_counts: {
"docs.rs": 2,
"doc.rust-lang.org": 1,
"norvig.com": 1,
},
}
Some(
"docs.rs",
)
Inspired from: