From f0e28e8ae5859966532e2eac4ddc0c8532a8edb9 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 12 Nov 2017 12:07:13 +0100 Subject: [PATCH] Make fasttext reader accommodate whitespace --- examples/vectors_fast_text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vectors_fast_text.py b/examples/vectors_fast_text.py index b6f303015..1544e1d5e 100644 --- a/examples/vectors_fast_text.py +++ b/examples/vectors_fast_text.py @@ -30,7 +30,7 @@ def main(vectors_loc, lang=None): nlp.vocab.reset_vectors(width=int(nr_dim)) for line in file_: line = line.decode('utf8') - pieces = line.split() + pieces = line.rsplit(' ', nr_dim) word = pieces[0] vector = numpy.asarray([float(v) for v in pieces[1:]], dtype='f') nlp.vocab.set_vector(word, vector) # add the vectors to the vocab