Skip to content

Commit 404af3d

Browse files
committed
allow udapi.Document("file name with spaces.conllu")
1 parent a905028 commit 404af3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

udapi/core/document.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, filename=None, **kwargs):
3434
if filename.endswith(".conllu"):
3535
self.load_conllu(filename, **kwargs)
3636
elif filename.endswith(".txt"):
37-
reader = SentencesReader(files=filename, **kwargs)
37+
reader = SentencesReader(files=[filename], **kwargs)
3838
reader.apply_on_document(self)
3939
else:
4040
raise ValueError("Only *.conllu and *.txt are supported. Provided: " + filename)
@@ -65,11 +65,11 @@ def create_bundle(self):
6565

6666
def load_conllu(self, filename=None, **kwargs):
6767
"""Load a document from a conllu-formatted file."""
68-
ConlluReader(files=filename, **kwargs).process_document(self)
68+
ConlluReader(files=[filename], **kwargs).process_document(self)
6969

7070
def store_conllu(self, filename):
7171
"""Store a document into a conllu-formatted file."""
72-
ConlluWriter(files=filename).apply_on_document(self)
72+
ConlluWriter(files=[filename]).apply_on_document(self)
7373

7474
def from_conllu_string(self, string):
7575
"""Load a document from a conllu-formatted string."""

0 commit comments

Comments
 (0)