pub struct DecompositionAhoCorasick { /* private fields */ }
Expand description
Decompose compound words into their parts found in a given dictionary. Useful for small or on the fly generated dictionaries.
This implementation is based on the aho_corasick crate.
This will decompose only if a word can be fully resolved using the dictionary, any texts containing unknown “words” will be passed through as-is.
This is an adaption of the SplitCompoundWords
filter from tantivy for this crate.
Implementations§
Source§impl DecompositionAhoCorasick
impl DecompositionAhoCorasick
Sourcepub fn from_dictionary<I, P>(dict: I) -> Result<Self, BuildError>
pub fn from_dictionary<I, P>(dict: I) -> Result<Self, BuildError>
Create a filter from a given dictionary.
The dictionary will be used to construct an AhoCorasick
automaton
with reasonable defaults. See from_automaton
if
more control over its construction is required.
Sourcepub fn from_automaton(dictionary: AhoCorasick) -> Self
pub fn from_automaton(dictionary: AhoCorasick) -> Self
Create a filter from a given automaton.
The automaton should use one of the leftmost-first match kinds and it should not be anchored.
Trait Implementations§
Source§impl Clone for DecompositionAhoCorasick
impl Clone for DecompositionAhoCorasick
Source§fn clone(&self) -> DecompositionAhoCorasick
fn clone(&self) -> DecompositionAhoCorasick
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DecompositionAhoCorasick
impl Debug for DecompositionAhoCorasick
Source§impl Segmenter for DecompositionAhoCorasick
impl Segmenter for DecompositionAhoCorasick
Source§type SubdivisionIter<'a> = IntoIter<SegmentedToken<'a>>
type SubdivisionIter<'a> = IntoIter<SegmentedToken<'a>>
The iterator type returned by the
subdivide
function if it has multiple results. Read moreSource§fn subdivide<'a>(
&self,
token: SegmentedToken<'a>,
) -> UseOrSubdivide<SegmentedToken<'a>, Self::SubdivisionIter<'a>> ⓘ
fn subdivide<'a>( &self, token: SegmentedToken<'a>, ) -> UseOrSubdivide<SegmentedToken<'a>, Self::SubdivisionIter<'a>> ⓘ
A method that should split the given
token
into zero, one or more subtokens. Read moreAuto Trait Implementations§
impl Freeze for DecompositionAhoCorasick
impl RefUnwindSafe for DecompositionAhoCorasick
impl Send for DecompositionAhoCorasick
impl Sync for DecompositionAhoCorasick
impl Unpin for DecompositionAhoCorasick
impl UnwindSafe for DecompositionAhoCorasick
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