Class: Kreuzberg::Result::LayoutRegion

Inherits:
Struct
  • Object
show all
Defined in:
lib/kreuzberg/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#area_fractionFloat (readonly)

Returns Fraction of page area covered (0.0 to 1.0).

Returns:

  • (Float)

    Fraction of page area covered (0.0 to 1.0)



170
171
172
173
174
175
176
177
178
179
# File 'lib/kreuzberg/result.rb', line 170

LayoutRegion = Struct.new(:class_name, :confidence, :bounding_box, :area_fraction) do
  def to_h
    {
      class: class_name,
      confidence: confidence,
      bounding_box: bounding_box&.to_h,
      area_fraction: area_fraction
    }
  end
end

#bounding_boxElementBoundingBox (readonly)

Returns Bounding box in document coordinate space.

Returns:



170
171
172
173
174
175
176
177
178
179
# File 'lib/kreuzberg/result.rb', line 170

LayoutRegion = Struct.new(:class_name, :confidence, :bounding_box, :area_fraction) do
  def to_h
    {
      class: class_name,
      confidence: confidence,
      bounding_box: bounding_box&.to_h,
      area_fraction: area_fraction
    }
  end
end

#class_nameString (readonly)

Returns Layout class name (e.g. “picture”, “table”, “text”).

Returns:

  • (String)

    Layout class name (e.g. “picture”, “table”, “text”)



170
171
172
173
174
175
176
177
178
179
# File 'lib/kreuzberg/result.rb', line 170

LayoutRegion = Struct.new(:class_name, :confidence, :bounding_box, :area_fraction) do
  def to_h
    {
      class: class_name,
      confidence: confidence,
      bounding_box: bounding_box&.to_h,
      area_fraction: area_fraction
    }
  end
end

#confidenceFloat (readonly)

Returns Detection confidence score (0.0 to 1.0).

Returns:

  • (Float)

    Detection confidence score (0.0 to 1.0)



170
171
172
173
174
175
176
177
178
179
# File 'lib/kreuzberg/result.rb', line 170

LayoutRegion = Struct.new(:class_name, :confidence, :bounding_box, :area_fraction) do
  def to_h
    {
      class: class_name,
      confidence: confidence,
      bounding_box: bounding_box&.to_h,
      area_fraction: area_fraction
    }
  end
end

Instance Method Details

#to_hObject



171
172
173
174
175
176
177
178
# File 'lib/kreuzberg/result.rb', line 171

def to_h
  {
    class: class_name,
    confidence: confidence,
    bounding_box: bounding_box&.to_h,
    area_fraction: area_fraction
  }
end