Compare commits
No commits in common. "0e3870a6fa3bb02d0b8b7fd6ab30b0eb2dfe78db" and "ea9e65a20b73ae3995e768886ac70732e7859ec1" have entirely different histories.
0e3870a6fa
...
ea9e65a20b
@ -177,6 +177,7 @@ class Handler
|
|||||||
DB.open(DB_URL) do |cursor|
|
DB.open(DB_URL) do |cursor|
|
||||||
cursor.query sql do |result_set|
|
cursor.query sql do |result_set|
|
||||||
result_set.each do
|
result_set.each do
|
||||||
|
puts "loop"
|
||||||
valor = result_set.read(Int32)
|
valor = result_set.read(Int32)
|
||||||
nombre = result_set.read(String)
|
nombre = result_set.read(String)
|
||||||
datos.push({valor, nombre})
|
datos.push({valor, nombre})
|
||||||
@ -202,11 +203,11 @@ class Handler
|
|||||||
|
|
||||||
if genero
|
if genero
|
||||||
DB.open(DB_URL) do |cursor|
|
DB.open(DB_URL) do |cursor|
|
||||||
datos = datos.find do |item|
|
filtered = Array(Tuple(Int32, String)).new
|
||||||
|
datos.map { |item|
|
||||||
# How feminine is this name?
|
# How feminine is this name?
|
||||||
# Yes this database is upper case
|
# Yes this database is upper case
|
||||||
nombre = item[1].upcase
|
nombre = item[1].upcase
|
||||||
puts "Checking #{nombre}"
|
|
||||||
feminidad = 0
|
feminidad = 0
|
||||||
sql = %(
|
sql = %(
|
||||||
SELECT COALESCE((SELECT frecuencia FROM mujeres WHERE nombre='#{nombre}'), 0) AS mujeres,
|
SELECT COALESCE((SELECT frecuencia FROM mujeres WHERE nombre='#{nombre}'), 0) AS mujeres,
|
||||||
@ -222,13 +223,13 @@ class Handler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# El overlap en 0.5 es intencional!
|
# El overlap en 0.5 es intencional!
|
||||||
if (feminidad >= 0.5 && genero == "f") ||
|
if feminidad >= 0.5 && genero == "f"
|
||||||
(feminidad <= 0.5 && genero == "m")
|
filtered << item
|
||||||
true
|
elsif feminidad <= 0.5 && genero == "m"
|
||||||
else
|
filtered << item
|
||||||
false
|
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
|
datos = filtered
|
||||||
puts "Data split by gender"
|
puts "Data split by gender"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user