我想尝试实现word2vec到越南语,但我对预训练的向量感到困惑,当我尝试在英语中使用时,我使用谷歌新闻矢量-负向量300.bin.gz(大约3.4‘m)作为预训练的向量,它工作得很好。如果我使用越南语,我应该自己制作数据预训练向量吗??如何制作一个预先训练好的向量,比如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
如何将字母或单词转换为上述形式??
发布于 2016-08-15 18:03:27
你应该用你的语言数据训练模型。在python中使用"decode“和"encode”函数是可能的。在用你的句子训练模型之前,你应该对你的句子单词进行unicode编码。
for sentence in sentences:
for word in sentence:
word = word.decode('utf-8')在此之后,您模型可以使用"utf-8“支持的任何语言进行训练:)
https://stackoverflow.com/questions/37461117
复制相似问题