Skip to main content

WordExtractor

Struct WordExtractor 

Source
pub struct WordExtractor;
Expand description

Extracts words from a sequence of characters based on spatial proximity.

Implementations§

Source§

impl WordExtractor

Source

pub fn extract(chars: &[Char], options: &WordOptions) -> Vec<Word>

Extract words from the given characters using the specified options.

Characters are grouped into words based on spatial proximity:

  • Characters within x_tolerance horizontally and y_tolerance vertically are grouped together.
  • For CJK characters, character width (or height for vertical text) is used as the tolerance instead of the fixed x_tolerance/y_tolerance.
  • By default, whitespace characters split words. Set keep_blank_chars to include them.
  • By default, characters are sorted spatially. Set use_text_flow to preserve PDF content stream order.
  • text_direction controls sorting and gap logic for vertical text.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.