Skip to content

Commit

Permalink
Mypy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alanakbik committed Jan 11, 2025
1 parent 1c85e08 commit 06a5c0c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flair/datasets/sequence_labeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@ def __init__(
self.default_whitespace_after = default_whitespace_after
self.documents_as_sentences = documents_as_sentences

if documents_as_sentences and not document_separator_token:
log.error(
"document_as_sentences was set to True, but no document_separator_token was provided. Please set"
"a value for document_separator_token in order to enable the document_as_sentence functionality."
)

# store either Sentence objects in memory, or only file offsets
self.in_memory = in_memory

Expand Down Expand Up @@ -834,7 +840,7 @@ def _remap_label(self, tag):

def __line_completes_sentence(self, line: str) -> bool:

if self.documents_as_sentences:
if self.documents_as_sentences and self.document_separator_token:
if line.startswith(self.document_separator_token):
return True
else:
Expand Down

0 comments on commit 06a5c0c

Please sign in to comment.