pub struct SimilarToPhrase { /* private fields */ }
Implementations§
Source§impl SimilarToPhrase
impl SimilarToPhrase
Sourcepub fn from_phrase(text: &str, max_edit_dist: u8) -> Self
pub fn from_phrase(text: &str, max_edit_dist: u8) -> Self
Create an error-tolerant SequenceExpr that looks for phrases similar to (but not the same as) that contained in the provided text.
This is an expensive operation, so try to only do it at startup and in tests.
It will panic if your document is too complex, so only run this with curated phrases.
Sourcepub fn from_doc(document: &Document, max_edit_dist: u8) -> Self
pub fn from_doc(document: &Document, max_edit_dist: u8) -> Self
Create an error-tolerant SequenceExpr that looks for phrases similar to (but not the same as) that contained in the provided document.
This is an expensive operation, so try to only do it at startup and in tests.
It will panic if your document contains certain token types, so only run this with curated phrases.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimilarToPhrase
impl !RefUnwindSafe for SimilarToPhrase
impl !Send for SimilarToPhrase
impl !Sync for SimilarToPhrase
impl Unpin for SimilarToPhrase
impl !UnwindSafe for SimilarToPhrase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<E> ExprExt for E
impl<E> ExprExt for E
Source§fn iter_matches<'a>(
&'a self,
tokens: &'a [Token],
source: &'a [char],
) -> Box<dyn Iterator<Item = Span> + 'a>
fn iter_matches<'a>( &'a self, tokens: &'a [Token], source: &'a [char], ) -> Box<dyn Iterator<Item = Span> + 'a>
Iterate over all matches of this expression in the document, automatically filtering out
overlapping matches, preferring the first.
fn iter_matches_in_doc<'a>( &'a self, doc: &'a Document, ) -> Box<dyn Iterator<Item = Span> + 'a>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more