Class: Kreuzberg::Config::Hierarchy
- Inherits:
-
Object
- Object
- Kreuzberg::Config::Hierarchy
- Defined in:
- lib/kreuzberg/config.rb
Overview
Hierarchy detection configuration
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#include_bbox ⇒ Object
readonly
Returns the value of attribute include_bbox.
-
#k_clusters ⇒ Object
readonly
Returns the value of attribute k_clusters.
-
#ocr_coverage_threshold ⇒ Object
readonly
Returns the value of attribute ocr_coverage_threshold.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(enabled: true, k_clusters: 6, include_bbox: true, ocr_coverage_threshold: nil) ⇒ Hierarchy
constructor
A new instance of Hierarchy.
- #to_h ⇒ Object
Constructor Details
#initialize(enabled: true, k_clusters: 6, include_bbox: true, ocr_coverage_threshold: nil) ⇒ Hierarchy
Returns a new instance of Hierarchy.
351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/kreuzberg/config.rb', line 351 def initialize( enabled: true, k_clusters: 6, include_bbox: true, ocr_coverage_threshold: nil ) @enabled = enabled ? true : false @k_clusters = k_clusters&.to_i || 6 @include_bbox = include_bbox ? true : false @ocr_coverage_threshold = ocr_coverage_threshold&.to_f end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
349 350 351 |
# File 'lib/kreuzberg/config.rb', line 349 def enabled @enabled end |
#include_bbox ⇒ Object (readonly)
Returns the value of attribute include_bbox.
349 350 351 |
# File 'lib/kreuzberg/config.rb', line 349 def include_bbox @include_bbox end |
#k_clusters ⇒ Object (readonly)
Returns the value of attribute k_clusters.
349 350 351 |
# File 'lib/kreuzberg/config.rb', line 349 def k_clusters @k_clusters end |
#ocr_coverage_threshold ⇒ Object (readonly)
Returns the value of attribute ocr_coverage_threshold.
349 350 351 |
# File 'lib/kreuzberg/config.rb', line 349 def ocr_coverage_threshold @ocr_coverage_threshold end |
Class Method Details
.from_h(hash) ⇒ Object
372 373 374 375 376 377 |
# File 'lib/kreuzberg/config.rb', line 372 def self.from_h(hash) return nil if hash.nil? return hash if hash.is_a?(self) new(**hash.transform_keys(&:to_sym)) if hash.is_a?(Hash) end |
Instance Method Details
#to_h ⇒ Object
363 364 365 366 367 368 369 370 |
# File 'lib/kreuzberg/config.rb', line 363 def to_h { enabled: @enabled, k_clusters: @k_clusters, include_bbox: @include_bbox, ocr_coverage_threshold: @ocr_coverage_threshold }.compact end |