class ActiveGenie::DataExtractor::FromInformal
def self.call(...)
def self.call(...) new(...).call() end
def call
def call response = Basic.call(@text, data_to_extract_with_litote, config: @config) if response['message_litote'] response = Basic.call(response['litote_rephrased'], @data_to_extract, config: @config) end response end
def data_to_extract_with_litote
def data_to_extract_with_litote { **@data_to_extract, message_litote: { type: 'boolean', description: 'Return true if the message is a litote. A litote is a figure of speech that uses understatement to emphasize a point by stating a negative to further affirm a positive, often incorporating double negatives for effect.' }, litote_rephrased: { type: 'string', description: 'The true meaning of the litote. Rephrase the message to a positive and active statement.' } } end
def initialize(text, data_to_extract, config: {})
- Example: Analyze text with litote -
Returns:
-
(Hash)
- The extracted data including litote analysis. In addition to the
Parameters:
-
config
(Hash
) -- Additional config for the extraction process -
data_to_extract
(Hash
) -- Schema defining the data structure to extract -
text
(String
) -- The informal text to analyze
def initialize(text, data_to_extract, config: {}) @text = text @data_to_extract = data_to_extract @config = ActiveGenie::Configuration.to_h(config) end