Class: TwitterCldr::Utils::ScriptDetector
- Inherits:
-
Object
- Object
- TwitterCldr::Utils::ScriptDetector
- Defined in:
- lib/twitter_cldr/utils/script_detector.rb
Constant Summary collapse
- PROPERTY_NAME =
'Script'
Class Method Summary collapse
Class Method Details
.detect_scripts(text) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/twitter_cldr/utils/script_detector.rb', line 37 def detect_scripts(text) length = text.length.to_f ScriptDetectionResult.new( scores_for(text).each_with_object({}) do |(script_name, count), ret| ret[script_name] = count / length end ) end |