Skip to content

Instantly share code, notes, and snippets.

@zealot128 zealot128/vornamen.rb
Last active Sep 24, 2018

What would you like to do?
Vornamen finder - Populaere Vornamen (Berliner OpenData) greppen nach Namensbestandteilen, z.B. `ruby vornamen.rb m scha` alle Namen mit scha im Namen.
require 'csv'
unless ARGV.count == 2
puts "USAGE: #{__FILE__} [GENDER: m|f] SEARCH"
gender = ARGV[0]
require 'open-uri'
all = []
].each do |file|
all +=, col_sep: ';').select { |_, _, g| g == gender }
names = { |a, b| [a, b.to_i] }.group_by { |a, b| a }.map { |k, v| [k,] }
rx =[1], 'i') { |name, _|
name && name[rx]
}.take(20).map do |name, count|
puts " #{name}: #{count}x"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.