pub struct MergeableWords { /* private fields */ }
Expand description
A Expr
that identifies adjacent words that could potentially be merged into a single word.
This checks if two adjacent words could form a valid compound word, but first verifies that the two words aren’t already a valid lexeme in the dictionary (like “straight away”).
Implementations§
Source§impl MergeableWords
impl MergeableWords
pub fn new( predicate: impl Fn(Option<&WordMetadata>, Option<&WordMetadata>) -> bool + Send + Sync + 'static, ) -> Self
Sourcepub fn get_merged_word(
&self,
word_a: &Token,
word_b: &Token,
source: &[char],
) -> Option<CharString>
pub fn get_merged_word( &self, word_a: &Token, word_b: &Token, source: &[char], ) -> Option<CharString>
Get the merged word from the dictionary if these words can be merged. Returns None if the words should remain separate (according to the predicate).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MergeableWords
impl !RefUnwindSafe for MergeableWords
impl !Send for MergeableWords
impl !Sync for MergeableWords
impl Unpin for MergeableWords
impl !UnwindSafe for MergeableWords
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