From 22422e5d0b072ed45dba44ee391c981eb19526ff Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 23:19:31 +0300 Subject: [PATCH] now really works parse invisible lab infection --- src/autobioebbing.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index 06bb25f..b28cccc 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -21,67 +21,67 @@ def find_infect_theme(text): # current order in theme: # ('infected', 'bio_expr', 'infected days', 'pathogen remaining') # UA theme - (r'.* йобнув.+', + (r'.* йобнув.+', r"([0-9\.\,k]+) біо-ресурса", default_infected_days_theme, default_pathogen_remaining_theme), # RU theme - (r'.* подверг.+', + (r'.* подверг.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # EN theme - (r'.* infected.+', + (r'.* infected.+', r"([0-9\.\,k]+) pcs\.", r' for ([0-9\ ]+) d.*', r'Remaining: ([0-9\ ]+)'), # AZ theme - (r'.* сикди.+', + (r'.* сикди.+', r"верир: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "ПК гик" theme - (r'.* насрал.+', + (r'.* насрал.+', r"потеряет: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "Новогодняя" theme - (r'.* подверг заморозке.+', + (r'.* подверг заморозке.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # "Сексуальная индустрия" theme - (r'.*.+выебал.+', + (r'.*.+выебал.+', r"кончила ([0-9\.\,k]+)", r' ещё ([0-9\ ]+) д.*', default_pathogen_remaining_theme), # "Аферисты в сетях" theme - (r'.* атаковал.+', + (r'.* атаковал.+', r"приносит: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "Квадробер" theme - (r'.*.+бешенству.+', + (r'.*.+бешенству.+', r"корма: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # UA theme [via trust] - (r'.* за допомогою довіреності зазнала зараження.+', + (r'.* за допомогою довіреності зазнала зараження.+', r"([0-9\.\,k]+) біо-ресурса", default_infected_days_theme, default_pathogen_remaining_theme), # RU theme [via trust] - (r'.* при помощи доверенности подвергла заражению.+', + (r'.* при помощи доверенности подвергла заражению.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # EN theme [via trust] - (r'.* by authorization infected.+', + (r'.* by authorization infected.+', r"([0-9\.\,k]+) pcs\.", r' for ([0-9\ ]+) d.*', r'Remaining: ([0-9\ ]+)'), # idk what is theme [via trust] - (r'.* при помощи анонимуса атаковала.+', + (r'.* при помощи анонимуса атаковала.+', r'приносит: ([0-9\.\,k]+)', default_infected_days_theme, default_pathogen_remaining_theme), @@ -90,9 +90,14 @@ def find_infect_theme(text): trying_theme_index = bio_attack_themes.index(theme) logger.debug(f'trying theme {trying_theme_index}...') r, bioexp, days, remaining = re.findall(theme[0], text), re.findall(theme[1], text), re.findall(theme[2], text), re.findall(theme[3], text) - if r and bioexp and days and remaining: + if len(r) > 2 and bioexp and days and remaining: logger.debug(f'found theme {trying_theme_index}') return r, bio_attack_themes[trying_theme_index] + r = re.findall(theme[0].split('', 1)[1], text) + if len(r) == 1 and bioexp and days and remaining: + logger.debug(f'found theme {trying_theme_index}, but invisible first lab it will be replaced to avocado id') + r = [(f'tg://openmessage?user_id={avocado_id}', r[0])] + return r, bio_attack_themes[trying_theme_index] return r, None