class Linguin::ProfanityDetection
Linguin::ProfanityDetection
¶ ↑
Returned by Linguin#detect_profanity(!).
success?
- Bool - checks if detection results were found error
- Hash - contains `error` and `message` about what went wrong result - Float - profanity score 0.0..1.0
Attributes
score[RW]
success[W]
Public Class Methods
error(code, message)
click to toggle source
# File lib/linguin/profanity_detection.rb, line 15 def error(code, message) new do |detection| detection.success = false detection.error = { code: code, message: message } end end
success(result)
click to toggle source
# File lib/linguin/profanity_detection.rb, line 25 def success(result) new do |detection| detection.success = true detection.score = result[:score] end end
Public Instance Methods
success?()
click to toggle source
# File lib/linguin/profanity_detection.rb, line 33 def success? !!@success end