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 from_reader<R: Read>(reader: R) -> Result<Self, Error>[src]
Creates a new rules set from a reader.
pub fn to_writer<W: Write>(&self, writer: W) -> Result<(), Error>[src]
Serializes this rules set to a writer.
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<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 = IntoIter<Rule>
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
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>,