Make split by gender faster
This commit is contained in:
parent
539c0839db
commit
9a84e979ac
@ -203,11 +203,20 @@ class Handler
|
||||
|
||||
if genero
|
||||
DB.open("postgres://#{USER}:#{PASS}@10.61.0.1:5432/nombres") do |cursor|
|
||||
datos = split_por_genero(cursor, datos)[genero]
|
||||
filtered = Array(Tuple(Int32, String)).new
|
||||
nombres.map { |nombre|
|
||||
fem = feminidad(cursor, nombre[1])
|
||||
# El overlap en 0.5 es intencional!
|
||||
if fem >= 0.5 && genero == "f"
|
||||
filtered << nombre
|
||||
elsif fem <= 0.5 && genero == "m"
|
||||
filtered << nombre
|
||||
end
|
||||
}
|
||||
datos = filtered
|
||||
puts "Data split by gender"
|
||||
end
|
||||
end
|
||||
|
||||
datos = datos[..10]
|
||||
|
||||
if datos.size > 1
|
||||
|
Loading…
Reference in New Issue
Block a user