sportdb-catalogs 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +1 -59
- data/lib/sportdb/catalogs/league.rb +2 -2
- data/lib/sportdb/catalogs/version.rb +1 -1
- data/lib/sportdb/catalogs.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fc1b8889790b051b658712c11580c31972e49b1efd04e3bd5fad1fefaec44b1
|
4
|
+
data.tar.gz: 5036274f73ee73e8275a49fbbc5f9192eee317baf4f63d70f1dd6ca48def86c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f104ef1fa0f0711403386a9a23313055fd67288eeeba564baf52e03c86d1f6851136b8bdde95b462b97bc5756dc06c5ed298776b61b66ca25edab248c4ea7da
|
7
|
+
data.tar.gz: 3ad50ff5c3fe022ff5e36ec3d3e03503bffe8c1c1475559a7e84cdc8929bb5fd0a88b3fd095b57192cd306937b10194b7c66f250c2b11a0b4d7c80f224e041b2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -11,66 +11,8 @@
|
|
11
11
|
|
12
12
|
## Usage
|
13
13
|
|
14
|
-
Let's use the [/clubs datasets](https://github.com/openfootball/clubs)
|
15
|
-
(3000+ football clubs from around the world)
|
16
|
-
to match name "variants" e.g. `Arsenal` to canonical global unique
|
17
|
-
names e.g. `Arsenal FC, London, England`:
|
18
14
|
|
19
|
-
|
20
|
-
require 'sportdb/catalogs'
|
21
|
-
|
22
|
-
Club = CatalogDb::Metal::Club
|
23
|
-
|
24
|
-
m = Club.match_by( name: 'Arsenal' )
|
25
|
-
m.size # 3 club matches found
|
26
|
-
#=> 3
|
27
|
-
m[0].name; m[0].city; m[0].country
|
28
|
-
#=> "Arsenal FC", "London", "England"
|
29
|
-
m[1].name; m[1].city; m[1].country
|
30
|
-
#=> "Arsenal Tula", "Tula", "Russia"
|
31
|
-
m[2].name; m[2].city; m[2].country
|
32
|
-
#=> "Arsenal de Sarandí", "Sarandí", "Argentina"
|
33
|
-
|
34
|
-
|
35
|
-
m = Club.match_by( name: 'Arsenal', country: 'eng' )
|
36
|
-
# -or- try alternative names (and auto-generated spelling variants)
|
37
|
-
m = Club.match_by( name: 'Arsenal FC', country: 'eng' )
|
38
|
-
m = Club.match_by( name: 'Arsenal F.C.', country: 'eng' )
|
39
|
-
m = Club.match_by( name: '...A.r.s.e.n.a.l... F.C...', country: 'eng' )
|
40
|
-
m.size # 1 club match found
|
41
|
-
#=> 1
|
42
|
-
m[0].name; m[0].city; m[0].country
|
43
|
-
#=> "Arsenal FC", "London", "England"
|
44
|
-
|
45
|
-
m = Club.match_by( name: 'Arsenal', country: 'ar' )
|
46
|
-
# -or- try alternative names (and auto-generated spelling variants)
|
47
|
-
m = Club.match_by( name: 'Arsenal Sarandí', country: 'ar' )
|
48
|
-
m = Club.match_by( name: 'Arsenal Sarandi', country: 'ar' )
|
49
|
-
m.size # 1 club match found
|
50
|
-
#=> 1
|
51
|
-
m[0].name; m[0].city; m[0].country
|
52
|
-
#=> "Arsenal de Sarandí", "Sarandí", "Argentina"
|
53
|
-
|
54
|
-
|
55
|
-
# try some more
|
56
|
-
m = Club.match_by( name: 'AZ' )
|
57
|
-
m[0].name; m[0].city; m[0].country
|
58
|
-
#=> "AZ Alkmaar", "Alkmaar", "Netherlands"
|
59
|
-
|
60
|
-
m = Club.match_by( name: 'Bayern' )
|
61
|
-
# -or- try alternative names (and auto-generated spelling variants)
|
62
|
-
m = Club.match_by( name: 'Bayern München' )
|
63
|
-
m = Club.match_by( name: 'Bayern Munchen' )
|
64
|
-
m = Club.match_by( name: 'Bayern Muenchen' )
|
65
|
-
m[0].name; m[0].city; m[0].country
|
66
|
-
#=> "Bayern München", "München", "Germany"
|
67
|
-
|
68
|
-
# and so on
|
69
|
-
# ...
|
70
|
-
```
|
71
|
-
|
72
|
-
|
73
|
-
That's it.
|
15
|
+
to be done
|
74
16
|
|
75
17
|
|
76
18
|
|
@@ -50,7 +50,7 @@ SQL
|
|
50
50
|
### todo/fix: allow special normalize formula for
|
51
51
|
## code - why? why not?
|
52
52
|
## e.g. allow ö1 or ö or such - why? why not?
|
53
|
-
code = normalize(
|
53
|
+
code = normalize( code )
|
54
54
|
|
55
55
|
rows = nil
|
56
56
|
if country.nil?
|
@@ -120,7 +120,7 @@ SQL
|
|
120
120
|
def self.match_by_name_or_code( q,
|
121
121
|
country: nil )
|
122
122
|
name = normalize( unaccent(q) )
|
123
|
-
code = normalize(
|
123
|
+
code = normalize( q )
|
124
124
|
|
125
125
|
rows = nil
|
126
126
|
if country.nil?
|
data/lib/sportdb/catalogs.rb
CHANGED
@@ -15,6 +15,7 @@ require_relative 'catalogs/city'
|
|
15
15
|
require_relative 'catalogs/club'
|
16
16
|
require_relative 'catalogs/national_team'
|
17
17
|
require_relative 'catalogs/league'
|
18
|
+
require_relative 'catalogs/league_period'
|
18
19
|
require_relative 'catalogs/event_info'
|
19
20
|
require_relative 'catalogs/ground'
|
20
21
|
|
@@ -44,7 +45,7 @@ def self.tables
|
|
44
45
|
## puts
|
45
46
|
puts " #{Country.count} countries / #{City.count} cities"
|
46
47
|
puts " #{NationalTeam.count} national teams"
|
47
|
-
puts " #{League.count} leagues"
|
48
|
+
puts " #{League.count} leagues / #{LeaguePeriod.count} periods"
|
48
49
|
puts " #{Club.count} clubs"
|
49
50
|
puts " #{Ground.count} grounds"
|
50
51
|
## add more
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-catalogs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sportdb-structs
|