Class: Xberg::OcrStrategyScannedPages

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

Overview

Additionally OCR every page that looks like a scan.

Pages are graded on raster coverage, whether the text layer is invisible or absent, the image codec, and the producer. Pages at or above min_confidence are OCR'd; the rest keep native text and still go through the Auto quality check.

Detects that a text layer came from a scanner, not whether it is accurate, so a page carrying a good sidecar is OCR'd too.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#min_confidenceObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



515
516
517
# File 'lib/xberg/native.rb', line 515

def min_confidence
  @min_confidence
end

Class Method Details

.from_hash(hash) ⇒ Object



531
532
533
# File 'lib/xberg/native.rb', line 531

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

Instance Method Details

#auto?Boolean

Returns:

  • (Boolean)


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

def auto? = false

#scanned_pages?Boolean

Returns:

  • (Boolean)


527
528
529
# File 'lib/xberg/native.rb', line 527

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