Crates.io | ispell |
lib.rs | ispell |
version | 0.3.1 |
source | src |
created_at | 2016-09-25 23:37:56.356836 |
updated_at | 2020-07-04 01:08:42.713566 |
description | Easily run ispell, hunspell or aspell from Rust |
homepage | |
repository | https://github.com/lise-henry/rust-ispell |
max_upload_size | |
id | 6627 |
size | 49,721 |
This library allows to easily use ispell
or aspell
from Rust.
Add this to your Cargo.toml
[dependencies]
ispell = "0.3"
extern crate ispell;
use ispell::SpellLauncher;
fn main() {
let mut checker = SpellLauncher::new()
.aspell()
.dictionary("en_GB")
.launch()
.unwrap();
let errors = checker.check("A simpel test to see if it detetcs typing errors").unwrap();
for e in errors {
println!("'{}' (pos: {}) is misspelled!", &e.misspelled, e.position);
if !e.suggestions.is_empty() {
println!("Maybe you meant '{}'?", &e.suggestions[0]);
}
}
}
will display:
'simpel' (pos: 2) is misspelled!
Maybe you meant 'simple'?
'detetcs' (pos: 27) is misspelled!
Maybe you meant 'dietetics'?
(Yes, that is exactly what I meant.)
For more information about using this library, see the API documentation on Github.io or on docs.rs.
rust-ispell
0.3 requires the 1.12.0
(or a more recent) version of
the
rustc
compiler, since it uses the std::sync::mpcs::Receiver::recv_timeout
that was only stabilized in this version.
See ChangeLog.md.
rust-ispell
is free software, published under the
Mozilla Public License, version 2.0.