Class: LangExtract::Core::Chunk

Inherits:
Data
  • Object
show all
Defined in:
lib/langextract/core/chunking.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#char_interval ⇒ Object (readonly)

Returns the value of attribute char_interval

Returns:

  • (Object) —

    the current value of char_interval



7
8
9
# File 'lib/langextract/core/chunking.rb', line 7

def char_interval
  @char_interval
end

#document_id ⇒ Object (readonly)

Returns the value of attribute document_id

Returns:

  • (Object) —

    the current value of document_id



7
8
9
# File 'lib/langextract/core/chunking.rb', line 7

def document_id
  @document_id
end

#index ⇒ Object (readonly)

Returns the value of attribute index

Returns:

  • (Object) —

    the current value of index



7
8
9
# File 'lib/langextract/core/chunking.rb', line 7

def index
  @index
end

#text ⇒ Object (readonly)

Returns the value of attribute text

Returns:

  • (Object) —

    the current value of text



7
8
9
# File 'lib/langextract/core/chunking.rb', line 7

def text
  @text
end

#token_interval ⇒ Object (readonly)

Returns the value of attribute token_interval

Returns:

  • (Object) —

    the current value of token_interval



7
8
9
# File 'lib/langextract/core/chunking.rb', line 7

def token_interval
  @token_interval
end

Instance Method Details

#to_h ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/langextract/core/chunking.rb', line 8

def to_h
  {
    "text" => text,
    "char_interval" => char_interval.to_h,
    "token_interval" => token_interval&.to_h,
    "index" => index,
    "document_id" => document_id
  }
end