Class: Lara::Models::ProfanityDetectResult

Inherits:
Base
  • Object
show all
Defined in:
lib/lara/models/text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

parse_time

Constructor Details

#initialize(masked_text:, profanities: []) ⇒ ProfanityDetectResult

Returns a new instance of ProfanityDetectResult.



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/lara/models/text.rb', line 57

def initialize(masked_text:, profanities: [])
  super()
  @masked_text = masked_text
  @profanities = profanities.map do |p|
    DetectedProfanity.new(
      text: p["text"] || p[:text],
      start_char_index: p["start_char_index"] || p[:start_char_index],
      end_char_index: p["end_char_index"] || p[:end_char_index],
      score: p["score"] || p[:score]
    )
  end
end

Instance Attribute Details

#masked_textObject (readonly)

Returns the value of attribute masked_text.



55
56
57
# File 'lib/lara/models/text.rb', line 55

def masked_text
  @masked_text
end

#profanitiesObject (readonly)

Returns the value of attribute profanities.



55
56
57
# File 'lib/lara/models/text.rb', line 55

def profanities
  @profanities
end