kakemono/config.rs
1//! Options and tuning parameters of the analysis. The config struct of each
2//! analysis stage is re-exported here: [`LayoutConfig`] holds one of each.
3//! [`ExcelConfig`] holds the thresholds of the reading of a workbook,
4//! [`WorkbookPdfConfig`] those of its layout in pages.
5
6pub use crate::analysis::blocks::BlocksConfig;
7pub use crate::analysis::floats::FloatsConfig;
8pub use crate::analysis::furniture::FurnitureConfig;
9pub use crate::analysis::lines::LinesConfig;
10pub use crate::analysis::math::MathConfig;
11pub use crate::analysis::order::OrderConfig;
12pub use crate::analysis::page::PageConfig;
13pub use crate::analysis::semantics::SemanticsConfig;
14pub use crate::analysis::tables::TablesConfig;
15pub use crate::excel::ExcelConfig;
16pub use crate::layout::workbook::{WorkbookPdfConfig, WorkbookPdfStyle};
17
18/// Options of the analysis.
19#[derive(Debug, Clone, Copy, PartialEq)]
20pub struct AnalyzeOptions {
21 /// Reconstruct the row/column structure of tables.
22 pub tables: bool,
23 /// Worker threads for reading the pages and building their lines (0 =
24 /// one per CPU).
25 pub jobs: usize,
26 /// Thresholds of the analysis stages.
27 pub layout: LayoutConfig,
28}
29
30impl Default for AnalyzeOptions {
31 fn default() -> Self {
32 Self {
33 tables: true,
34 jobs: 0,
35 layout: LayoutConfig::default(),
36 }
37 }
38}
39
40/// Every threshold of the analysis, grouped by stage. The defaults are the
41/// values the analysis is tuned for; each field is documented where its
42/// struct is defined.
43#[derive(Debug, Clone, Copy, PartialEq, Default)]
44pub struct LayoutConfig {
45 /// Document-wide statistics of the pages.
46 pub page: PageConfig,
47 /// Grouping glyphs into lines.
48 pub lines: LinesConfig,
49 /// Removal of running heads, page numbers and margin stamps.
50 pub furniture: FurnitureConfig,
51 /// Detection of figures, tables and their captions.
52 pub floats: FloatsConfig,
53 /// Reconstruction of table grids.
54 pub tables: TablesConfig,
55 /// Reading order.
56 pub order: OrderConfig,
57 /// Grouping lines into blocks.
58 pub blocks: BlocksConfig,
59 /// Classification, paragraph merging and assembly of the document.
60 pub semantics: SemanticsConfig,
61 /// Rebuilding the structure of displayed formulas.
62 pub math: MathConfig,
63}