Skip to content

Commit

Permalink
fix mypy error
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseagzr committed Jul 14, 2024
1 parent bd3956b commit a8bc603
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flair/datasets/sequence_labeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Sentence,
Span,
Token,
_iter_dataset,
get_spans_from_bio,
)
from flair.datasets.base import find_train_dev_test_files
Expand Down Expand Up @@ -476,7 +477,7 @@ def write_dataset_to_file(
(2) every sentence is separated from the previous one by an empty line
"""
with open(file_path, mode="w") as output_file:
for sentence in dataset:
for sentence in _iter_dataset(dataset):
texts = [token.text for token in sentence.tokens]
texts_and_labels = [texts]
for label_type, level in label_type_tuples:
Expand Down Expand Up @@ -515,7 +516,7 @@ def get_level_of_label(self, label_type: str) -> Union[Type[Token], Type[Span]]:
"""
for dataset in [self.train, self.dev, self.test]:
if dataset:
for sentence in dataset:
for sentence in _iter_dataset(dataset):
for label in sentence.get_labels(label_type):
if isinstance(label.data_point, Token):
return Token
Expand Down

0 comments on commit a8bc603

Please sign in to comment.