Module: Kreuzberg::NoChunkingReason

Overview

Reason for not chunking a document.

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
# File 'lib/kreuzberg/native.rb', line 4129

def self.from_hash(hash)
  discriminator = hash[:type] || hash["type"]
  case discriminator
  when "small_file" then NoChunkingReasonSmallFile.from_hash(hash)
  when "few_pages" then NoChunkingReasonFewPages.from_hash(hash)
  when "text_layer_detected" then NoChunkingReasonTextLayerDetected.from_hash(hash)
  when "format_not_chunkable" then NoChunkingReasonFormatNotChunkable.from_hash(hash)
  when "chunking_disabled" then NoChunkingReasonChunkingDisabled.from_hash(hash)
  when "fast_text_extraction" then NoChunkingReasonFastTextExtraction.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end