Permalink
Browse files

Document normalization algorithms.

  • Loading branch information...
1 parent c66e710 commit f26a430eb62921a97d53d559726e0b6c6bf80efe @KL-7 KL-7 committed May 16, 2012
Showing with 13 additions and 0 deletions.
  1. +6 −0 lib/twitter_cldr/normalizers/nfd.rb
  2. +7 −0 lib/twitter_cldr/normalizers/nfkd.rb
View
6 lib/twitter_cldr/normalizers/nfd.rb
@@ -5,12 +5,18 @@
module TwitterCldr
module Normalizers
+
+ # Implements normalization of a Unicode string to Normalization Form D (NFD).
+ # This normalization includes only Canonical Decomposition.
+ #
class NFD < Base
class << self
protected
+ # Returns false if Decomposition Mapping is compatibility decomposition.
+ #
def decomposable?(mapping)
super && !compatibility_decomposition?(mapping)
end
View
7 lib/twitter_cldr/normalizers/nfkd.rb
@@ -5,12 +5,18 @@
module TwitterCldr
module Normalizers
+
+ # Implements normalization of a Unicode string to Normalization Form D (NFD).
+ # This normalization includes only Canonical Decomposition.
+ #
class NFKD < Base
class << self
protected
+ # Removes compatibility formatting tag from Decomposition Mapping if there is one.
+ #
def decomposition_mapping(unicode_data)
mapping = super(unicode_data)
compatibility_decomposition?(mapping) ? mapping[1..-1] : mapping
@@ -19,5 +25,6 @@ def decomposition_mapping(unicode_data)
end
end
+
end
end

0 comments on commit f26a430

Please sign in to comment.