Class: Kotoshu::Language::LanguageIdentifier::DetectionResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/kotoshu/language/identifier.rb

Overview

Value object for detection result.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#confidenceFloat (readonly)

Confidence score (0.0 to 1.0)

Returns:

  • (Float)

    the current value of confidence



80
81
82
# File 'lib/kotoshu/language/identifier.rb', line 80

def confidence
  @confidence
end

#labelString (readonly)

Raw FastText label

Returns:

  • (String)

    the current value of label



80
81
82
# File 'lib/kotoshu/language/identifier.rb', line 80

def label
  @label
end

#languageString (readonly)

ISO 639-1 language code

Returns:

  • (String)

    the current value of language



80
81
82
# File 'lib/kotoshu/language/identifier.rb', line 80

def language
  @language
end

Instance Method Details

#to_sObject



81
82
83
# File 'lib/kotoshu/language/identifier.rb', line 81

def to_s
  "#{language} (#{(confidence * 100).round(1)}%)"
end