pub struct Token {
pub text: String,
pub offset: Offset,
pub reference_offsets: Vec<OffsetSize>,
pub mask: Mask,
}Expand description
Owned token that references the original text but stores its own string representation.
Fields§
§text: StringString representation
offset: OffsetStart and end positions of the token with respect to the original text
reference_offsets: Vec<OffsetSize>Sequence of positions with respect to the original text contained in the token.
For example, if the token offset is start: 4, end: 10, corresponding reference_offsets are [4, 5, 6, 7, 8, 9]
mask: MaskMask indicating the type of the token
Implementations§
Trait Implementations§
Source§impl ConsolidatableTokens<Token> for Vec<Token>
impl ConsolidatableTokens<Token> for Vec<Token>
Source§fn iter_consolidate_tokens(&self) -> ConsolidatedTokenIterator<'_, Token> ⓘ
fn iter_consolidate_tokens(&self) -> ConsolidatedTokenIterator<'_, Token> ⓘ
Creates an iterator from a sequence of
ConsolidatableTokens.Source§impl TokenTrait for Token
impl TokenTrait for Token
impl Eq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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