Added missing file, refactored normalize_name out
This commit is contained in:
parent
cafe5fdce5
commit
a62d814aaf
@ -27,6 +27,14 @@ class Handler
|
|||||||
|
|
||||||
nombres = [] of String
|
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)
|
def run(request : HTTP::Request)
|
||||||
unless (body = request.body).nil?
|
unless (body = request.body).nil?
|
||||||
query = JSON.parse(body)
|
query = JSON.parse(body)
|
||||||
@ -40,10 +48,7 @@ class Handler
|
|||||||
|
|
||||||
# Remove all diacritics and whatnot
|
# Remove all diacritics and whatnot
|
||||||
nombres = nombres.map { |n|
|
nombres = nombres.map { |n|
|
||||||
normalized = n.unicode_normalize(:nfkd).chars
|
normalize_name n
|
||||||
normalized.reject! { |c|
|
|
||||||
!c.ascii_letter?
|
|
||||||
}.join("").downcase
|
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "Processing #{nombres}"
|
puts "Processing #{nombres}"
|
||||||
|
6
c-historico/shard.yml
Normal file
6
c-historico/shard.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
name: historico
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
ishi:
|
||||||
|
github: toddsundsted/ishi
|
Loading…
Reference in New Issue
Block a user