pub struct TextElement<'a> { /* private fields */ }Expand description
Text element.
A layout element with the recognized text.
Implementations§
Source§impl<'a> TextElement<'a>
impl<'a> TextElement<'a>
Sourcepub fn get_utf8_text(&self, level: LayoutLevel) -> Utf8Text
pub fn get_utf8_text(&self, level: LayoutLevel) -> Utf8Text
Get recognized text as UTF-8 string.
Sourcepub fn confidence(&self, level: LayoutLevel) -> f32
pub fn confidence(&self, level: LayoutLevel) -> f32
Returns the mean confidence of the element at the given level.
The confidence range is [0; 100].
Sourcepub fn word_recognition_language(&self) -> Option<&CStr>
pub fn word_recognition_language(&self) -> Option<&CStr>
Returns the language that was used to recognize the word.
Sourcepub fn word_is_from_dictionary(&self) -> bool
pub fn word_is_from_dictionary(&self) -> bool
Returns true if the current word is a dictionary word.
Sourcepub fn word_is_numeric(&self) -> bool
pub fn word_is_numeric(&self) -> bool
Returns true if the current word is a number.
Sourcepub fn word_font_attributes(&self) -> Option<(FontAttrs, &CStr)>
pub fn word_font_attributes(&self) -> Option<(FontAttrs, &CStr)>
Returns font attributes of the current word as well as the font name.
Sourcepub fn symbol_is_superscript(&self) -> bool
pub fn symbol_is_superscript(&self) -> bool
Returns true if the current symbol is a superscript.
Sourcepub fn symbol_is_subscript(&self) -> bool
pub fn symbol_is_subscript(&self) -> bool
Returns true if the current symbol is a subscript.
Sourcepub fn symbol_is_dropcap(&self) -> bool
pub fn symbol_is_dropcap(&self) -> bool
Returns true if the current symbol is a dropcap.
Sourcepub fn choices(&self) -> ChoiceIterator<'a>
pub fn choices(&self) -> ChoiceIterator<'a>
Returns an iteratove over classifier choices for the current symbol.
Methods from Deref<Target = Element<'a>>§
Sourcepub fn is_at_beginning_of(&self, level: LayoutLevel) -> bool
pub fn is_at_beginning_of(&self, level: LayoutLevel) -> bool
Returns true if the element is at the start of the given level.
Sourcepub fn is_at_final_element(
&self,
level: LayoutLevel,
element: LayoutLevel,
) -> bool
pub fn is_at_final_element( &self, level: LayoutLevel, element: LayoutLevel, ) -> bool
Returns true if the element is at the end of the given level.
Sourcepub fn bounding_box(&self, level: LayoutLevel) -> Option<Rectangle>
pub fn bounding_box(&self, level: LayoutLevel) -> Option<Rectangle>
Returns the bounds of the element at the given level of the layout.
Returns None if the given level doesn’t exist.
The box position and dimensions should match the ones of
get_binary_image
but may not match the ones of get_image due to padding.
Sourcepub fn block_type(&self) -> BlockType
pub fn block_type(&self) -> BlockType
Returns block type.
Sourcepub fn get_binary_image(&self, level: LayoutLevel) -> Image
pub fn get_binary_image(&self, level: LayoutLevel) -> Image
Returns a binary image of the element at the given layout level.
Sourcepub fn get_image(
&self,
level: LayoutLevel,
padding: u32,
original: &Image,
) -> (Image, i32, i32)
pub fn get_image( &self, level: LayoutLevel, padding: u32, original: &Image, ) -> (Image, i32, i32)
Returns a grayscale image of the element at the given layout level.
Padding is added to the left-top corner in both dimensions.
If padding is zero, then the returned positions and dimensions should match
the ones of bounding_box.
Sourcepub fn baseline(&self, level: LayoutLevel) -> Option<Line>
pub fn baseline(&self, level: LayoutLevel) -> Option<Line>
Returns the baseline of the element.
Sourcepub fn orientation(&self) -> OrientationParams
pub fn orientation(&self) -> OrientationParams
Returns the element’s block orientation.
Sourcepub fn paragraph_info(&self) -> ParagraphInfo
pub fn paragraph_info(&self) -> ParagraphInfo
Returns the element’s paragraph information.