Struct nlprule::rules::Rules [−][src]
A set of grammatical error correction rules.
Implementations
impl Rules
[src]
pub fn new<P: AsRef<Path>>(p: P) -> Result<Self, Error>
[src]
Creates a new rules set from a path to a binary.
Errors
- If the file can not be opened.
- If the file content can not be deserialized to a rules set.
pub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>
[src]
Creates a new rules set from a reader.
pub fn rules(&self) -> &[Rule]
[src]
All rules ordered by priority.
pub fn rule(&self, id: &str) -> Option<&Rule>
[src]
Finds a rule by ID.
pub fn apply(
&self,
tokens: &[Token<'_>],
tokenizer: &Tokenizer
) -> Vec<Suggestion>
[src]
&self,
tokens: &[Token<'_>],
tokenizer: &Tokenizer
) -> Vec<Suggestion>
Compute the suggestions for the given tokens by checking all rules.
pub fn suggest(&self, text: &str, tokenizer: &Tokenizer) -> Vec<Suggestion>
[src]
Compute the suggestions for a text by checking all rules.
pub fn correct(&self, text: &str, tokenizer: &Tokenizer) -> String
[src]
Correct a text by first tokenizing, then finding all suggestions and choosing the first replacement of each suggestion.
pub fn iter(&self) -> RulesIter<'_>ⓘ
[src]
A referential iterator.
Trait Implementations
impl Default for Rules
[src]
impl<'de> Deserialize<'de> for Rules
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<R> FromIterator<R> for Rules where
R: Into<Rule>,
[src]
R: Into<Rule>,
fn from_iter<I: IntoIterator<Item = R>>(iter: I) -> Self
[src]
impl IntoIterator for Rules
[src]
type Item = Rule
The type of the elements being iterated over.
type IntoIter = RulesIntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl Serialize for Rules
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rules
[src]
impl Send for Rules
[src]
impl Sync for Rules
[src]
impl Unpin for Rules
[src]
impl UnwindSafe for Rules
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,