Class: Kreuzberg::Result::PageContent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentString (readonly)

Returns Text content for this page.

Returns:

  • (String)

    Text content for this page



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/kreuzberg/result.rb', line 148

PageContent = Struct.new(:page_number, :content, :tables, :images, :hierarchy, :is_blank, :layout_regions) do
  def to_h
    {
      page_number: page_number,
      content: content,
      tables: tables.map(&:to_h),
      images: images.map(&:to_h),
      hierarchy: hierarchy&.to_h,
      is_blank: is_blank,
      layout_regions: layout_regions&.map(&:to_h)
    }
  end
end

#hierarchyPageHierarchy? (readonly)

Returns Hierarchy information for the page.

Returns:



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/kreuzberg/result.rb', line 148

PageContent = Struct.new(:page_number, :content, :tables, :images, :hierarchy, :is_blank, :layout_regions) do
  def to_h
    {
      page_number: page_number,
      content: content,
      tables: tables.map(&:to_h),
      images: images.map(&:to_h),
      hierarchy: hierarchy&.to_h,
      is_blank: is_blank,
      layout_regions: layout_regions&.map(&:to_h)
    }
  end
end

#imagesArray<Image> (readonly)

Returns Images on this page.

Returns:

  • (Array<Image>)

    Images on this page



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/kreuzberg/result.rb', line 148

PageContent = Struct.new(:page_number, :content, :tables, :images, :hierarchy, :is_blank, :layout_regions) do
  def to_h
    {
      page_number: page_number,
      content: content,
      tables: tables.map(&:to_h),
      images: images.map(&:to_h),
      hierarchy: hierarchy&.to_h,
      is_blank: is_blank,
      layout_regions: layout_regions&.map(&:to_h)
    }
  end
end

#is_blankObject

Returns the value of attribute is_blank

Returns:

  • (Object)

    the current value of is_blank



148
149
150
# File 'lib/kreuzberg/result.rb', line 148

def is_blank
  @is_blank
end

#layout_regionsObject

Returns the value of attribute layout_regions

Returns:

  • (Object)

    the current value of layout_regions



148
149
150
# File 'lib/kreuzberg/result.rb', line 148

def layout_regions
  @layout_regions
end

#page_numberInteger (readonly)

Returns Page number (1-indexed).

Returns:

  • (Integer)

    Page number (1-indexed)



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/kreuzberg/result.rb', line 148

PageContent = Struct.new(:page_number, :content, :tables, :images, :hierarchy, :is_blank, :layout_regions) do
  def to_h
    {
      page_number: page_number,
      content: content,
      tables: tables.map(&:to_h),
      images: images.map(&:to_h),
      hierarchy: hierarchy&.to_h,
      is_blank: is_blank,
      layout_regions: layout_regions&.map(&:to_h)
    }
  end
end

#tablesArray<Table> (readonly)

Returns Tables on this page.

Returns:

  • (Array<Table>)

    Tables on this page



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/kreuzberg/result.rb', line 148

PageContent = Struct.new(:page_number, :content, :tables, :images, :hierarchy, :is_blank, :layout_regions) do
  def to_h
    {
      page_number: page_number,
      content: content,
      tables: tables.map(&:to_h),
      images: images.map(&:to_h),
      hierarchy: hierarchy&.to_h,
      is_blank: is_blank,
      layout_regions: layout_regions&.map(&:to_h)
    }
  end
end

Instance Method Details

#to_hObject



149
150
151
152
153
154
155
156
157
158
159
# File 'lib/kreuzberg/result.rb', line 149

def to_h
  {
    page_number: page_number,
    content: content,
    tables: tables.map(&:to_h),
    images: images.map(&:to_h),
    hierarchy: hierarchy&.to_h,
    is_blank: is_blank,
    layout_regions: layout_regions&.map(&:to_h)
  }
end