Class: Langchain::Processors::Eml

Inherits:
Base
  • Object
show all
Defined in:
lib/langchain/processors/eml.rb

Constant Summary collapse

EXTENSIONS =
[".eml"]
CONTENT_TYPES =
["message/rfc822"]

Instance Method Summary collapse

Methods included from DependencyHelper

#depends_on

Constructor Details

#initializeEml

Returns a new instance of Eml.



9
10
11
# File 'lib/langchain/processors/eml.rb', line 9

def initialize(*)
  depends_on "mail"
end

Instance Method Details

#parse(data) ⇒ String

Parse the document and return the cleaned text

Parameters:

  • data (File)

Returns:

  • (String)


16
17
18
19
20
# File 'lib/langchain/processors/eml.rb', line 16

def parse(data)
  mail = Mail.read(data.path)
  text_content = extract_text_content(mail)
  clean_content(text_content)
end