Sure, here’s the translation: Scala / Java 的 word2vec 读取器

huangapple go评论62阅读模式
英文:

Scala / Java word2vec reader

问题

我有几个具有以下标准布局的word2vec文本文件:

单词数 向量大小
单词1 向量1 向量2 ...
单词2 向量1 向量2 ...
...

是否有Scala或Java库可用于读取这些文件并计算简单的功能,如:

  • 是否是词汇中的单词
  • 获取单词向量
  • 最近的邻居
  • 余弦距离
  • ...

我只能找到一些用于二进制格式的库,有没有办法使用这些库(除了编写自己的库)?

英文:

I've got several word2vec text files with the following standard layout:

numWords vecSize
word1 vec1 vec2 ...
word2 vec1 vec2 ...
...

Is there any Scala or Java library to read these and calculate simple stuff like:

  • isWordInVocab
  • getWordVectors
  • nearestNeighbours
  • cosDistance
  • ...

I could find some only for binary formats, is there a way to use these (apart from writing my own one)?

答案1

得分: 0

我刚刚编写了自己的类,以避免整个dl4j/nd4j的导入/设置/运行过程。

英文:

I've just ended up writing my own class to avoid the whole dl4j/nd4j import/setup/run procedure.

huangapple
  • 本文由 发表于 2020年9月30日 22:34:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/64139849.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定