Class: TwitterCldr::Normalizers::NFKD

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/normalizers/nfkd.rb

Direct Known Subclasses

NFD

Constant Summary collapse

COMPATIBILITY_FORMATTING_TAG_REGEXP =
/^<.*>$/
HANGUL_DECOMPOSITION_CONSTANTS =
{
    :SBase  => 0xAC00,
    :LBase  => 0x1100,
    :VBase  => 0x1161,
    :TBase  => 0x11A7,
    :LCount => 19,
    :VCount => 21,
    :TCount => 28,
    :NCount => 588,  # VCount * TCount
    :Scount => 11172 # LCount * NCount
}

Class Method Summary collapse

Class Method Details

.normalize(string) ⇒ Object


17
18
19
20
21
# File 'lib/twitter_cldr/normalizers/nfkd.rb', line 17

def normalize(string)
  code_points = TwitterCldr::Utils::CodePoints.from_string(string)
  normalized_code_points = normalize_code_points(code_points)
  TwitterCldr::Utils::CodePoints.to_string(normalized_code_points)
end

.normalize_code_points(code_points) ⇒ Object


23
24
25
# File 'lib/twitter_cldr/normalizers/nfkd.rb', line 23

def normalize_code_points(code_points)
  canonical_ordering(decomposition(code_points))
end