Class: Xberg::VlmFallbackPolicyOnLowQuality

Inherits:
Data
  • Object
show all
Extended by:
T::Sig
Includes:
VlmFallbackPolicy
Defined in:
lib/xberg/native.rb

Overview

Try the classical OCR backend first. If the quality score is below quality_threshold, send the page to the VLM.

quality_threshold is in the [0.0, 1.0] range produced by calculate_quality_score. A value of 0.5 is a reasonable starting point; calibrate with the Stage 0 benchmark harness.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#quality_thresholdObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



420
421
422
# File 'lib/xberg/native.rb', line 420

def quality_threshold
  @quality_threshold
end

Class Method Details

.from_hash(hash) ⇒ Object



438
439
440
# File 'lib/xberg/native.rb', line 438

def self.from_hash(hash)
  new(quality_threshold: hash[:quality_threshold] || hash["quality_threshold"])
end

Instance Method Details

#always?Boolean

Returns:

  • (Boolean)


434
435
436
# File 'lib/xberg/native.rb', line 434

def always? = false
# @param hash [Hash] deserialized from the native extension
# @return [self]

#disabled?Boolean

Returns:

  • (Boolean)


430
# File 'lib/xberg/native.rb', line 430

def disabled? = false

#on_low_quality?Boolean

Returns:

  • (Boolean)


432
# File 'lib/xberg/native.rb', line 432

def on_low_quality? = true