Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. function write_word2vec(path::AbstractString, vm::VectorModel, dict::Dictionary)
  2. fout = open(path, "w")
  3. sense_prob = zeros(T(vm))
  4. write(fout, "$(V(vm)) $(T(vm)) $(M(vm))\n")
  5. for v in 1:V(vm)
  6. write(fout, "$(dict.id2word[v])\n")
  7. expected_pi!(sense_prob, vm, v)
  8. for k in 1:T(vm)
  9. if sense_prob[k] < 1e-3 continue end
  10. write(fout, "$k $(sense_prob[k]) ")
  11. for i in 1:M(vm)
  12. write(fout, vm.In[i, k, v])
  13. end
  14. write(fout, "\n")
  15. end
  16. end
  17. close(fout)
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement