Skip to main content

RegionSignature

Struct RegionSignature 

Source
pub struct RegionSignature {
Show 20 fields pub page_number: u32, pub region_label: String, pub x_left: f32, pub x_right: f32, pub y_top: f32, pub y_bottom: f32, pub area: f32, pub n_lines: u32, pub n_visual_lines: u32, pub median_line_height: f32, pub n_tokens: u32, pub italic_tokens: u32, pub bold_tokens: u32, pub normal_tokens: u32, pub glyph_area: f32, pub density_raw: f32, pub density: f32, pub n_peaks: u32, pub n_peaks_y: u32, pub y_peak_cv: f32,
}
Expand description

Per-region signature. The unit downstream classifiers reason about. Computed for each leaf of the Region tree from RegionStats.per_page[p]. Interior nodes do not get signatures.

Fields§

§page_number: u32§region_label: String

Reading-order path from the Region tree leaf, e.g. “1”, “2-1”, “3-2-1”. Resolves to the matching leaf in RegionStats.per_page[…].root.

§x_left: f32§x_right: f32§y_top: f32§y_bottom: f32§area: f32

(x_right - x_left) × (y_bottom - y_top). Floor-clamped to 1.0.

§n_lines: u32

Distinct y-rows the leaf’s elements occupy (raw y_top values dedup’d by the same baseline).

§n_visual_lines: u32

Lines after Y-baseline dedup (sub/superscripts collapsed).

§median_line_height: f32

Median Y-extent (in pt) of input elements in the leaf. Used as the per-region reference for the visual-line tolerance.

§n_tokens: u32§italic_tokens: u32§bold_tokens: u32§normal_tokens: u32§glyph_area: f32

Estimated ink-bearing area: Σ per-token chars × font_size² × glyph_width_ratio.

§density_raw: f32

glyph_area / area. Body prose ≈ 0.4-0.6 typically.

§density: f32

Per-document normalization: density_raw / max(density_raw across all regions in the document). Lands in [0, 1].

§n_peaks: u32

X-projection sustained-peak count. ≥ 2 indicates multi-column content (table or list); 1 indicates flowing prose.

§n_peaks_y: u32

Y-projection presence-based peak count. One peak per visual row in the leaf’s Y-extent.

§y_peak_cv: f32

Coefficient of variation of inter-Y-peak gaps. 0.0 when < 3 peaks.

Trait Implementations§

Source§

impl Clone for RegionSignature

Source§

fn clone(&self) -> RegionSignature

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RegionSignature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for RegionSignature

Source§

fn default() -> RegionSignature

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RegionSignature

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<RegionSignature, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RegionSignature

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.