pub struct OffsetCorrection {
pub filtered: usize,
pub cumulative_diff: isize,
}Expand description
Character filters transform raw text before tokenization.
Each filter receives the full input string and returns the transformed string plus an offset correction map so that token offsets can be mapped back to positions in the original text.
See [[analyzers#Character Filters]]. A correction entry mapping a position in the filtered text back to the original text. Used to fix token offsets after character filtering.
Fields§
§filtered: usizeByte offset in the filtered text.
cumulative_diff: isizeHow many bytes were removed (positive) or added (negative as wrapping)
up to this point. To recover the original offset:
original_offset = filtered_offset + cumulative_diff
Trait Implementations§
Source§impl Clone for OffsetCorrection
impl Clone for OffsetCorrection
Source§fn clone(&self) -> OffsetCorrection
fn clone(&self) -> OffsetCorrection
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OffsetCorrection
impl RefUnwindSafe for OffsetCorrection
impl Send for OffsetCorrection
impl Sync for OffsetCorrection
impl Unpin for OffsetCorrection
impl UnsafeUnpin for OffsetCorrection
impl UnwindSafe for OffsetCorrection
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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