diff --git a/DataGatherers/DetermineOriginGame.py b/DataGatherers/DetermineOriginGame.py index 53d84eb..80f6ad2 100644 --- a/DataGatherers/DetermineOriginGame.py +++ b/DataGatherers/DetermineOriginGame.py @@ -22,6 +22,7 @@ from DataGatherers.cache_manager import CacheManager import concurrent.futures from concurrent.futures import ThreadPoolExecutor, as_completed from functools import lru_cache +from pattern.en import singularize from DataGatherers.constants import all_games, regional_descriptors @@ -391,7 +392,7 @@ def parse_form_information(html_content): form_text = form_text.strip('()') if "/" in form_text: - last_word = form_text.split()[-1] + last_word = singularize(form_text.split()[-1]) form_text = form_text.replace(last_word, "").strip() parts = form_text.split('/') for part in parts: @@ -724,6 +725,10 @@ def process_game_locations(raw_game, raw_locations, form, default_forms): for form_info in forms: if form_matches(form_info, form, default_forms): locations.append({"location": raw_text, "tag": raw_location}) + else: + form_info = {"main_form": None, "sub_form": None, "region": None} + if form_matches(form_info, form, default_forms): + locations.append({"location": raw_text, "tag": raw_location}) return locations if locations else None @@ -738,6 +743,9 @@ def form_matches(form_info, form, default_forms): if default_forms and main_form and main_form in default_forms: main_form = None + if form.lower() in ["spring form", "summer form", "autumn form", "winter form"] and main_form == None: + return True + if main_form is None: return False diff --git a/DataGatherers/Update_evolution_information.py b/DataGatherers/Update_evolution_information.py index 3bde7eb..5e41e37 100644 --- a/DataGatherers/Update_evolution_information.py +++ b/DataGatherers/Update_evolution_information.py @@ -168,20 +168,29 @@ def process_single_pokemon(name, form, db_controller, cache, progress_callback): if progress_callback: progress_callback(f"Processing {name} {form if form else ''}") - if form and name in form: - form = form.replace(name, "").strip() + search_form = form + if search_form and name in search_form: + search_form = search_form.replace(name, "").strip() gender = None - if form and "male" in form.lower(): - gender = form - form = None + if search_form and "male" in search_form.lower(): + gender = search_form + search_form = None + + if name == "Flabébé": + # Bulbapedia doesn't detail out Flabébé's evolution chain fully. as its exactly the same for each form, but the coloured form remains constant + # through the evolution line, Red->Red->Red, Yellow->Yellow->Yellow etc. + search_form = None - evolution_chain = get_evolution_data_from_bulbapedia(name, form, cache, gender) + evolution_chain = get_evolution_data_from_bulbapedia(name, search_form, cache, gender) if evolution_chain: if name == "Tauros": # Bulbapedia has a weird formatting for Tauros. for stage in evolution_chain: if stage.form: stage.form = stage.form.replace("Paldean Form(", "").replace(")", "").strip() + if name == "Flabébé": + for stage in evolution_chain: + stage.form = form process_evolution_chain(db_controller, evolution_chain, cache, gender) def update_evolution_chains(cache, progress_callback=None): diff --git a/pokemon_forms.db b/pokemon_forms.db index 00162c5..5764e8c 100644 Binary files a/pokemon_forms.db and b/pokemon_forms.db differ