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 rule 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 new_with_options<P: AsRef<Path>>(
p: P,
options: RulesOptions
) -> Result<Self, Error>
[src]
p: P,
options: RulesOptions
) -> Result<Self, Error>
Creates a new rule set with options. See new.
pub fn options(&self) -> &RulesOptions
[src]
Gets the options of this rule set.
pub fn options_mut(&mut self) -> &mut RulesOptions
[src]
Gets the options of this rule set (mutable).
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 rules_mut(&mut self) -> &mut [Rule]
[src]
All rules ordered by priority (mutable).
pub fn select<'a>(&'a self, selector: &'a Selector) -> RulesIter<'a>ⓘ
[src]
Returns an iterator over all rules matching the selector.
pub fn select_mut<'a>(&'a mut self, selector: &'a Selector) -> RulesIterMut<'a>ⓘNotable traits for RulesIterMut<'a>
impl<'a> Iterator for RulesIterMut<'a> type Item = &'a mut Rule;
[src]
Notable traits for RulesIterMut<'a>
impl<'a> Iterator for RulesIterMut<'a> type Item = &'a mut Rule;
Returns an iterator over all rules matching the selector (mutable).
pub fn apply(&self, sentence: &Sentence<'_>) -> Vec<Suggestion>
[src]
Compute the suggestions for the given sentence 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.
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 Serialize for Rules
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Rules
impl Send for Rules
impl Sync for Rules
impl Unpin for Rules
impl UnwindSafe for Rules
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>,