| import zipfile | |
| def load_texts_from_zip(zip_path): | |
| texts = [] | |
| with zipfile.ZipFile(zip_path, 'r') as zip_ref: | |
| for file_name in zip_ref.namelist(): | |
| if file_name.endswith(".txt"): | |
| with zip_ref.open(file_name) as f: | |
| try: | |
| text = f.read().decode("utf-8") | |
| texts.append(text) | |
| except: | |
| continue | |
| return texts |