pdf-engine 1.2.0

Unified PDF rendering engine — page rendering, text extraction, thumbnails.
Documentation
// @generated by scripts/extraction/learned/export_rust.py -- do not edit.
//
// Copyright (c) 2026 Innovation Trigger B.V.
//
// PDFluent is available under two licences, at your option: the GNU AGPLv3, or
// the PDFluent Commercial Licence. See the LICENSE file in this repository --
// that file travels with the copy you received, which a URL does not.
//! The `table_is` model: 300 trees, 3998 splits, depth at most 5, in 1 part(s).
//!
//! Model sha256 (of model.json): 9acd761d937534b6a0102d12a292f4e96eed43dd3a366106995f3ddaf771aae7

mod part_00;

/// The sha256 of the LightGBM dump this code was generated from.
pub const MODEL_SHA256: &str = "9acd761d937534b6a0102d12a292f4e96eed43dd3a366106995f3ddaf771aae7";

/// The input, in order: `x[i]` is `FEATURES[i]`, NaN when missing.
pub const FEATURES: [&str; 15] = ["rows", "cols", "cells", "numeric", "words_cell", "col_words_max", "col_words_min", "heading_share", "p_head_max", "p_head_mean", "first_col_p_head", "empty", "height_share", "wordy_share", "first_col_words"];

/// The probability at or above which the decision is taken, chosen on the
/// validation documents and recorded in the model's manifest.
pub const THRESHOLD: f64 = 0.08_f64;

/// LightGBM's numerical decision, missing values included.
#[inline(always)]
fn go_left(value: f64, threshold: f64, default_left: bool, missing: u8) -> bool {
    // 0: None, 1: Zero, 2: NaN -- LightGBM's MissingType.
    let value = if missing != 2 && value.is_nan() { 0.0 } else { value };
    if (missing == 1 && value.abs() <= 1e-35) || (missing == 2 && value.is_nan()) {
        return default_left;
    }
    value <= threshold
}

/// The raw margin: the sum of the trees, before the sigmoid.
pub fn predict_margin(x: &[f64; 15]) -> f64 {
    let acc = 0.0;
    part_00::add(x, acc)
}