import os # scraper/utils.py def load_replacements(path): repl = {} if not path or not os.path.exists(path): return repl with open(path, encoding="utf-8") as f: for line in f: if "=>" in line: k, v = line.strip().split("=>", 1) repl[k.strip()] = v.strip() return repl def clean_text(text, repl_dict): for src, tgt in repl_dict.items(): text = text.replace(src, tgt) return text