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



306
307
308
# File 'lib/xberg/native.rb', line 306

def quality_threshold
  @quality_threshold
end

Class Method Details

.from_hash(hash) ⇒ Object



324
325
326
# File 'lib/xberg/native.rb', line 324

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

Instance Method Details

#always?Boolean

Returns:

  • (Boolean)


320
321
322
# File 'lib/xberg/native.rb', line 320

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

#disabled?Boolean

Returns:

  • (Boolean)


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

def disabled? = false

#on_low_quality?Boolean

Returns:

  • (Boolean)


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

def on_low_quality? = true