diff --git a/flair/datasets/sequence_labeling.py b/flair/datasets/sequence_labeling.py index f13dc5c76..fa0962f2f 100644 --- a/flair/datasets/sequence_labeling.py +++ b/flair/datasets/sequence_labeling.py @@ -6,6 +6,8 @@ import gzip import shutil import tarfile +import tempfile +import zipfile from collections import defaultdict from collections.abc import Iterable, Iterator from pathlib import Path @@ -1566,9 +1568,11 @@ def extract_tokens(file_path: Path, output_path: Path): f_out.write("\n") def merge_annotations(tokens_file, annotations_file, output_file): - with open(tokens_file, encoding="utf-8") as tokens_file, open( - annotations_file, encoding="utf-8" - ) as annotations_file, open(output_file, "w", encoding="utf-8") as output_file: + with ( + open(tokens_file, encoding="utf-8") as tokens_file, + open(annotations_file, encoding="utf-8") as annotations_file, + open(output_file, "w", encoding="utf-8") as output_file, + ): tokens = tokens_file.readlines() annotations = annotations_file.readlines()