【问题标题】:how to make a pre-trained vectors for other language (word2vec)?如何为其他语言(word2vec)制作预训练的向量?
【发布时间】:2016-09-24 11:21:45
【问题描述】:

我想尝试将 word2vec 实现为越南语,但我对预先训练的向量感到困惑,当我尝试在英语中使用时,我使用 Google News-vectors-negative300.bin.gz(大约 3.4 GB)用于预训练的向量,效果很好。如果我使用越南语,我应该自己制作数据预训练向量吗? 如何制作一个预先训练好的向量,例如 Google News-vectors-negative300.bin.gz,然后我尝试将 Google News-vectors-negative300.bin 转换为文本格式,结果为:

3000000 300

0.001129 -0.000896 0.000319 0.001534 0.001106 -0.001404 -0.000031 -0.000420 -0.000576 0.001076 -0.001022 -0.000618 -0.000755 0.001404 -0.001640 -0.000633 0.001633 -0.001007 -0.001266 0.000652 -0.000416 -0.001076 0.001526 -0.000275 0.000140 0.001572 0.001358 -0.000832 -0.001404 0.001579 0.000254 -0.000732 -0.000105 -0.001167 0.001579

如何将一个字母或单词变成上面的形式??

【问题讨论】:

    标签: c python-2.7 gensim word2vec


    【解决方案1】:

    您应该使用您的语言数据训练模型。在 python 中使用“解码”和“编码”函数是可能的。在用你的句子训练模型之前,你应该对你的句子单词进行 unicode。

    for sentence in sentences:
        for word in sentence:
            word = word.decode('utf-8')
    

    在此之后,您的模型可以使用“utf-8”支持的任何语言进行训练:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-14
      • 2015-06-17
      • 2019-07-12
      • 2022-01-24
      • 2017-11-25
      • 1970-01-01
      相关资源
      最近更新 更多