Amélioration de la détection des catégories (avec accents)
This commit is contained in:
parent
6704d30ef1
commit
97be0db3d1
@ -66,16 +66,18 @@ class CExtractor(TwoStepsExtractorNoPause):
|
||||
description = None
|
||||
|
||||
category = soup.select_one(".event_category").text
|
||||
first_cat = Extractor.remove_accents(category.split(",")[0].lower())
|
||||
print(first_cat)
|
||||
tags = []
|
||||
if category in ["Grand Spectacle"]:
|
||||
if first_cat in ["grand spectacle"]:
|
||||
category = "Danse"
|
||||
elif category in ["Théâtre"]:
|
||||
category = "Théâtre"
|
||||
elif category in ["Chanson française", "Musique du monde", "Pop / Rock", "Rap, RnB", "Raggae", "Variété"]:
|
||||
elif first_cat in ["theatre", "humour / one man show"]:
|
||||
category = "Theatre"
|
||||
elif first_cat in ["chanson francaise", "musique du monde", "pop / rock", "rap", "rnb", "raggae", "variete"]:
|
||||
category = "Concert"
|
||||
elif category in ["Comédie Musicale", "Humour / One Man Show", "Spectacle équestre"]:
|
||||
elif first_cat in ["comedie musicale", "humour / one man show", "spectacle equestre"]:
|
||||
category = "Art du spectacle"
|
||||
elif category in ["Spectacle pour enfant"]:
|
||||
elif first_cat in ["spectacle pour enfant"]:
|
||||
tags = ["jeune public"]
|
||||
category = None
|
||||
else:
|
||||
|
@ -738,7 +738,7 @@ class Event(models.Model):
|
||||
if "category" in event_structure and event_structure["category"] is not None:
|
||||
try:
|
||||
event_structure["category"] = Category.objects.get(
|
||||
name=event_structure["category"]
|
||||
name__unaccent__icontains=remove_accents(event_structure["category"].lower())
|
||||
)
|
||||
except Category.DoesNotExist:
|
||||
event_structure["category"] = Category.get_default_category()
|
||||
|
Loading…
Reference in New Issue
Block a user