Skip to content

Commit

Permalink
only split on spaces not any whitespace fixes #24
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Nov 13, 2019
1 parent f12e909 commit 1c4df53
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/glove.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ function _load_embeddings(::Type{<:GloVe}, embedding_file, max_vocab_size, keep_
open(embedding_file) do f
index = 1
for line in eachline(f)
xs = split(line)
xs = split(line, ' ')
word = xs[1]
if length(keep_words) == 0 || (word in keep_words)
index > max_vocab_size && break
push!(indexed_words, word)
push!(LL, parse.(Float32, xs[2:end]))
try
push!(LL, parse.(Float32, @view(xs[2:end])))
catch err
err isa ArgumentError || rethrow()
@warn "Could not parse word vector" index word exception=err
end
index += 1
end
end
Expand Down

0 comments on commit 1c4df53

Please sign in to comment.