Class: Kreuzberg::Config::LayoutDetection

Inherits:
Object
  • Object
show all
Defined in:
lib/kreuzberg/config.rb

Overview

Layout detection configuration

Examples:

Basic usage

layout = LayoutDetection.new

With custom threshold and table model

layout = LayoutDetection.new(
  confidence_threshold: 0.5,
  apply_heuristics: true,
  table_model: "tatr"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(confidence_threshold: nil, apply_heuristics: true, table_model: nil) ⇒ LayoutDetection

Returns a new instance of LayoutDetection.



908
909
910
911
912
# File 'lib/kreuzberg/config.rb', line 908

def initialize(confidence_threshold: nil, apply_heuristics: true, table_model: nil)
  @confidence_threshold = confidence_threshold&.to_f
  @apply_heuristics = apply_heuristics ? true : false
  @table_model = table_model&.to_s
end

Instance Attribute Details

#apply_heuristicsObject (readonly)

Returns the value of attribute apply_heuristics.



906
907
908
# File 'lib/kreuzberg/config.rb', line 906

def apply_heuristics
  @apply_heuristics
end

#confidence_thresholdObject (readonly)

Returns the value of attribute confidence_threshold.



906
907
908
# File 'lib/kreuzberg/config.rb', line 906

def confidence_threshold
  @confidence_threshold
end

#table_modelObject (readonly)

Returns the value of attribute table_model.



906
907
908
# File 'lib/kreuzberg/config.rb', line 906

def table_model
  @table_model
end

Instance Method Details

#to_hObject



914
915
916
917
918
919
920
# File 'lib/kreuzberg/config.rb', line 914

def to_h
  {
    confidence_threshold: @confidence_threshold,
    apply_heuristics: @apply_heuristics,
    table_model: @table_model
  }.compact
end