pub struct ShapeField {
pub n_tokens: usize,
pub spans: Vec<(usize, usize)>,
pub frames: Vec<ShapeFrame>,
pub boundaries: Vec<usize>,
/* private fields */
}Expand description
The structural side table, keyed by byte offset (like SpectralField).
Fields§
§n_tokens: usizeToken count.
spans: Vec<(usize, usize)>Byte span per token - the byte-offset key.
frames: Vec<ShapeFrame>One frame per token.
boundaries: Vec<usize>Shape-change-point byte offsets (silhouette-break cuts), sorted.
Implementations§
Source§impl ShapeField
impl ShapeField
Sourcepub fn class_at(&self, byte: usize) -> u32
pub fn class_at(&self, byte: usize) -> u32
The shape-class of the token covering byte (0 if empty).
Sourcepub fn period_at(&self, byte: usize) -> (u16, f32)
pub fn period_at(&self, byte: usize) -> (u16, f32)
The dominant shape-period and its strength at byte.
Sourcepub fn in_template(&self, byte: usize) -> bool
pub fn in_template(&self, byte: usize) -> bool
Is byte inside a strong shape-period (template) run?
Sourcepub fn shape_regions(&self) -> Vec<(usize, usize, u16)>
pub fn shape_regions(&self) -> Vec<(usize, usize, u16)>
The periodic / template regions as byte spans plus their period: maximal runs of tokens whose period strength clears the template threshold. The structural map a tabular / template consumer reads.
Sourcepub fn template_spans(&self) -> Vec<(usize, usize, u16)>
pub fn template_spans(&self) -> Vec<(usize, usize, u16)>
Self::shape_regions with each run reaching back over the periods
before it that already repeat: a whole period is taken while every
token’s kind equals the kind one period later, or one period earlier
where the later one lies past the input’s end, and the period holds a
kind other than a word. The kind rather than the whole class, so two
words of different shapes in one column, alpha and beta, carry the
run back; a kind other than a word, since every word is one kind and
text of words alone repeats at any period. The reader finds a period
only once its trailing window holds a few repeats, so a run begins rows
after the repetition does, and at the input’s end it may be the last
row alone. Byte spans with their period, ascending by start.