Class: Lara::Models::ProfanityDetectResult
- Defined in:
- lib/lara/models/text.rb
Instance Attribute Summary collapse
-
#masked_text ⇒ Object
readonly
Returns the value of attribute masked_text.
-
#profanities ⇒ Object
readonly
Returns the value of attribute profanities.
Instance Method Summary collapse
-
#initialize(masked_text:, profanities: []) ⇒ ProfanityDetectResult
constructor
A new instance of ProfanityDetectResult.
Methods inherited from Base
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_text ⇒ Object (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 |
#profanities ⇒ Object (readonly)
Returns the value of attribute profanities.
55 56 57 |
# File 'lib/lara/models/text.rb', line 55 def profanities @profanities end |