Added missing file, refactored normalize_name out
This commit is contained in:
@@ -27,6 +27,14 @@ class Handler
|
||||
|
||||
nombres = [] of String
|
||||
|
||||
def normalize_name(s)
|
||||
# Remove diacritics, turn lowercase
|
||||
normalized = s.unicode_normalize(:nfkd).chars
|
||||
normalized.reject! { |c|
|
||||
!c.ascii_letter?
|
||||
}.join("").downcase
|
||||
end
|
||||
|
||||
def run(request : HTTP::Request)
|
||||
unless (body = request.body).nil?
|
||||
query = JSON.parse(body)
|
||||
@@ -40,10 +48,7 @@ class Handler
|
||||
|
||||
# Remove all diacritics and whatnot
|
||||
nombres = nombres.map { |n|
|
||||
normalized = n.unicode_normalize(:nfkd).chars
|
||||
normalized.reject! { |c|
|
||||
!c.ascii_letter?
|
||||
}.join("").downcase
|
||||
normalize_name n
|
||||
}
|
||||
|
||||
puts "Processing #{nombres}"
|
||||
|
Reference in New Issue
Block a user