Class: TwitterCldr::Utils::ScriptDetectionResult

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/utils/script_detector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scores) ⇒ ScriptDetectionResult

Returns a new instance of ScriptDetectionResult.



12
13
14
# File 'lib/twitter_cldr/utils/script_detector.rb', line 12

def initialize(scores)
  @scores = scores
end

Instance Attribute Details

#scoresObject (readonly)

Returns the value of attribute scores.



10
11
12
# File 'lib/twitter_cldr/utils/script_detector.rb', line 10

def scores
  @scores
end

Instance Method Details

#best_guessObject



16
17
18
19
# File 'lib/twitter_cldr/utils/script_detector.rb', line 16

def best_guess
  max_score = scores.max_by { |(_, score)| score }
  max_score.first if max_score
end

#score_for(script_name) ⇒ Object



21
22
23
# File 'lib/twitter_cldr/utils/script_detector.rb', line 21

def score_for(script_name)
  scores[script_name]
end

#scriptsObject



25
26
27
# File 'lib/twitter_cldr/utils/script_detector.rb', line 25

def scripts
  scores.keys
end