Hello,
To prepare for the 2019/2020 football season kick-off I've put together
a football data wrangling w/ sample that lets you match 1500+
football club names
from 100+ leagues from around the world using the sportdb gem / library
and open football.db (public domain) datasets.
Example:
require 'sportdb/config'
## note: requires a local copy of the football.db clubs datasets
## see https://github.com/openfootball/clubs
SportDb::Import.config.clubs_dir = './clubs'
m = SportDb::Import.config.clubs.match( 'Arsenal' )
m.size # 3 club matches found
#=> 3
m[0].name; m[0].city; m[0].country
#=> "Arsenal FC", "London", "England"
m[1].name; m[1].city; m[1].country
#=> "Arsenal Tula", "Tula", "Russia"
m[2].name; m[2].city; m[2].country
#=> "Arsenal de Sarandí", "Sarandí", "Argentina"
m = SportDb::Import.config.clubs.match_by( name: 'Arsenal', country: 'eng' )
# -or- try alternative names (and auto-generated spelling variants)
m = SportDb::Import.config.clubs.match_by( name: 'Arsenal FC', country: 'eng' )
m = SportDb::Import.config.clubs.match_by( name: 'Arsenal F.C.',
country: 'eng' )
m = SportDb::Import.config.clubs.match_by( name: '...A.r.s.e.n.a.l...
F.C...', country: 'eng' )
m.size # 1 club match found
#=> 1
m[0].name; m[0].city; m[0].country
#=> "Arsenal FC", "London", "England"
m = SportDb::Import.config.clubs.match_by( name: 'Arsenal', country: 'ar' )
# -or- try alternative names (and auto-generated spelling variants)
m = SportDb::Import.config.clubs.match_by( name: 'Arsenal Sarandí',
country: 'ar' )
m = SportDb::Import.config.clubs.match_by( name: 'Arsenal Sarandi',
country: 'ar' )
m.size # 1 club match found
#=> 1
m[0].name; m[0].city; m[0].country
#=> "Arsenal de Sarandí", "Sarandí", "Argentina"
# try some more
m = SportDb::Import.config.clubs.match( 'AZ' )
m[0].name; m[0].city; m[0].country
#=> "AZ Alkmaar", "Alkmaar", "Netherlands"
m = SportDb::Import.config.clubs.match( 'Bayern' )
# -or- try alternative names (and auto-generated spelling variants)
m = SportDb::Import.config.clubs.match( 'Bayern München' )
m = SportDb::Import.config.clubs.match( 'Bayern Munchen' )
m = SportDb::Import.config.clubs.match( 'Bayern Muenchen' )
m[0].name; m[0].city; m[0].country
#=> "Bayern München", "München", "Germany"
# and so on
# ...
Enjoy the beautiful game. Cheers. Prost.
[1] https://github.com/sportdb/sport.db/tree/master/sportdb-config
[2] https://github.com/openfootball/clubs