pub struct BboxBook {
pub tags: Vec<i64>,
pub otsl: Vec<i64>,
pub hiddens: Vec<f32>,
pub n: usize,
pub merge: HashMap<usize, i64>,
/* private fields */
}Expand description
The autoregressive loop’s per-step state, mirroring docling’s predict
bookkeeping (tag_H_buf / bboxes_to_merge): which decoder hidden states
feed the bbox decoder and how horizontal spans merge. Both the native and
browser loops step the decoder themselves (sync vs async ort) and feed
each result through step; everything else stays here so the
two paths can’t drift.
Fields§
The decoder input prefix ([START], then every emitted tag).
otsl: Vec<i64>The emitted OTSL structure tokens (no START/END).
Per-bbox-cell decoder hidden states, flattened [n, EMBED_DIM].
n: usizeNumber of hidden states collected (hiddens.len() / EMBED_DIM).
merge: HashMap<usize, i64>Span merges: cur_bbox_ind → partner (-1 → the last box).
Implementations§
Source§impl BboxBook
impl BboxBook
pub fn new() -> Self
Sourcepub fn step(&mut self, raw: i64, hidden: &[f32]) -> bool
pub fn step(&mut self, raw: i64, hidden: &[f32]) -> bool
Feed one raw decoded tag and its hidden state. Returns false to stop
decoding: when the corrected tag is END (not recorded), or when the
current row reached MAX_ROW_TAGS (runaway).
Sourcepub fn runaway(&self) -> bool
pub fn runaway(&self) -> bool
The decode degenerated into one endless row (no nl for
MAX_ROW_TAGS tags). docling keeps such a sequence, but its span
recovery (html_to_otsl knows colspans 2–20 only) and orphan pickup
then drop most of the table’s words; callers reject the structure so
the region takes the geometric fallback instead. A long table that
merely hits MAX_STEPS with ordinary rows is not a runaway.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BboxBook
impl RefUnwindSafe for BboxBook
impl Send for BboxBook
impl Sync for BboxBook
impl Unpin for BboxBook
impl UnsafeUnpin for BboxBook
impl UnwindSafe for BboxBook
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().