Skip to content

Commit

Permalink
fix: club name being normalized until ''
Browse files Browse the repository at this point in the history
  • Loading branch information
iagocanalejas committed Oct 24, 2024
1 parent fdc2715 commit 6df6e85
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-r requirements.txt
coverage==7.6.1
coverage==7.6.3
pytest==8.3.3
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy==2.1.1
numpy==2.1.2
opencv-python==4.10.0.84
pandas==2.2.2
pandas==2.2.3
parsel==1.9.1
pyutils @ git+https://github.com/iagocanalejas/pyutils.git@master
requests==2.32.3
Expand Down
3 changes: 2 additions & 1 deletion rscraping/data/normalization/clubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def remove_club_title(name: str) -> str:

def remove_club_sponsor(name: str) -> str:
for sponsor in _KNOWN_SPONSORS:
name = name.replace(sponsor, "")
if name.replace(sponsor, "") != "": # avoid removing the whole name
name = name.replace(sponsor, "")
if name.endswith(" - ") or name.startswith(" - "):
name = name.replace(" - ", "")
return whitespaces_clean(name)
Expand Down
2 changes: 2 additions & 0 deletions tests/normalization/club_normalization_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def setUp(self) -> None:
"DONOSTIA ARRAUN LAGUNAK",
"E.D. MOAÑA",
"DEUSTO A.T. - C.R. SAN NICOLÁS A.T. B",
"UROLA KOSTA A.E.",
]

def test_club_name_normalization(self):
Expand All @@ -30,6 +31,7 @@ def test_club_name_normalization(self):
"DONOSTIA ARRAUN LAGUNAK",
"MOAÑA",
"DEUSTO - SAN NICOLÁS B",
"UROLA KOSTA",
]

for idx, club_name in enumerate(self.NAMES):
Expand Down

0 comments on commit 6df6e85

Please sign in to comment.