embedding / chinese-word-vectors Goto Github PK
View Code? Open in Web Editor NEW100+ Chinese Word Vectors 上百种预训练中文词向量
License: Apache License 2.0
100+ Chinese Word Vectors 上百种预训练中文词向量
License: Apache License 2.0
比如人民日报 sgns.renmin.bigram,有 355989 个词向量,但对词汇进行去重之后只剩下 355973 个不同的词语
I download (People's Daily News 人民日报, Word + Character + Ngram), and use bzip2 to decompress the file.
I want to use word2vec.load(), so I rename the file name sgns.renmin.bigram-char to sgns_renmin_bigram_char.
the error is:
ValueError: could not broadcast input array from shape (299) into shape (300)
使用的是sgns.merge.word词向量,python3
试了两个方法都不行
f = open(filename,'r')
line = f.readline().strip()
word_dim = int(line.split(' ')[1])
for line in f:
row = line.strip().split(' ')
vocab.append(row[0])
embd.append(row[1:])
f.close()
用f.readlines()同样错误
错误:
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 3472-3473: invalid continuation byte
with open(filename, 'rb') as f:
line = f.readline().decode('utf-8').strip()
word_dim = int(line.split(' ')[1])
for line in f:
row = line.decode('utf-8').strip().split(' ')
vocab.append(row[0])
embd.append(row[1:])
错误:
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 96-97: invalid continuation byte
D:\Program\Anaconda3\lib\site-packages\gensim\utils.py:860: UserWarning: detected Windows; aliasing chunkize to chunkize_serial
warnings.warn("detected Windows; aliasing chunkize to chunkize_serial")
Traceback (most recent call last):
File ".\zzk_word2vec.py", line 101, in
test_word_embedding('D:\data\pretrain_word2vec\Chinese-Word-Vectors\sgns.zhihu.char\sgns.zhihu.char')
File ".\zzk_word2vec.py", line 76, in test_word_embedding
model = gensim.models.KeyedVectors.load_word2vec_format(vector_file, binary=False, encoding='utf8')
File "D:\Program\Anaconda3\lib\site-packages\gensim\models\keyedvectors.py", line 250, in load_word2vec_format
parts = utils.to_unicode(line.rstrip(), encoding=encoding, errors=unicode_errors).split(" ")
File "D:\Program\Anaconda3\lib\site-packages\gensim\utils.py", line 242, in any2unicode
return unicode(text, encoding, errors=errors)
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 96-97: invalid continuation byte
你好。非常感谢作者提供的评估语料和词向量,有些词向量的评估得分远远超过自训练的词向量,所以就想拿这些词向量做一些语义相似性的计算应用。问题来了:CA8里的一些词,Hanlp默认的词库是不包含这些词的,想通过聚合去重来合并现有的词库,但是缺少词频和词性的信息。能不能通过云盘的方式,分享一下针对百度百科语料的词库?
用这个语句可以看到词嵌入了,
with open('sgns.baidubaike.bigram-char', 'rb') as f:
for line_b in f:
line_u = line_b.decode('utf-8')
print(line_u)
但是比如我想获取“年”这个字的词嵌入,应该怎么写代码呢?
小白 谢谢了。
I tried to download context word vectors of Word → Character (1), however, I failed to do that since I cannot register the account of baidu. Can you upload the dataset to other places such as google drive or dropbox? Thanks.
我看了几遍都没看懂这玩意儿是怎么用的,难道只是用来看的?
想结合自己用的一些数据一起训练,谢谢!
例如Non-pollutionVegetablesProcessingIndustryPark,20171106001562,这样的词基本没什么意义。
一个oov的词,对应词向量里哪个token呢?
例如:
'的 6:0.0506113688733 7:0.233081394134 8:0.435558307'
那些6、7、8是什么,我读取的方式是:
with open('/ppmi.baidubaike.word', encoding='utf-8', errors='ignore') as fr:
wd_vec = fr.readlines()
对wd_vec[56].split()后的维度一般达到1万以上。求解答,难道是我的打开方式不对?
您好
詞向量下載鏈結似乎失效了
請檢查一下 謝謝您
您好, 點擊幾個地址之後都顯示網盤不存在, 可否更新鍵結呢? 感謝!
你好,首先感谢你们所做的工作,我主观认为context里加入word+char+ngram的效果应该是最好的?但是不知道论文中为什么没有放出来在CA8的评估效果,如果可以放出与其他三种context的对比,可以放在这个issues里面吗?
再次感谢你们的工作~
从windows上读取正常,上传到linux会出错,这是怎么回事,我具体的看了一下,有几十行被打乱了。
非常感谢作者的这项非常棒的工作。但是我在使用gensim加载词向量的时候遇到了encoding问题,一部分字符不能被utf-8解码。不知作者可否提供词向量的二进制文件从而避免这个问题?
问题文件:
Word2vec / Skip-Gram with Negative Sampling (SGNS)
Baidu Encyclopedia 百度百科的 word
分别是
第269598行
第334166行
第340101行
第386099行
第387913行
第398991行
第403440行
第417792行
第440725行
第510420行
第518270行
第628803行
都是word和第一个数字连在了一起
请核对一下
I use the toolkit to evaluate the vector, and I got the answer. However, I wonder if you can tell us what kind of value is the signal of the good vectors?
作为一个NLP小白,看完README还是不知道该怎么用这些训练好的东西。
可否提供一个说明:
如SSH,Ssh,ssh等统一处理为ssh,进一步可以考虑是否进行stemming等等
感谢作者提供的词向量~想问一下,作者在训练word2vec之前,使用HanLP对语料进行分词,使用的是哪个分词算法呢?HMM还是CRF,这对后续训练的影响大吗?另外,分词时有使用用户自定义词典吗?还有,分词后会做停用词、标点符号的过滤处理吗?非常感谢
词向量里面类似google空白或者回车等特殊字符的"",embeding没有啊,如果有请问是用什么代表的?
用程序读取一行,发现是一个汉字后面跟了301个数字,这是怎么回事呢?
我下载了wikipedia语料的word+char模型,用gensim载入之后显示词汇量为352281,但README中的vocabulary size写的是2129K
按我的理解,两者应该是一样的。请问是我的理解有误还是数据有误?
您好!
用gensim训练时,增量训练只能改变模型的参数,新的词汇并不能添加进模型中,这就导致了没办法使用一些预训练好的模型对具体的任务做微调。所以想请问您在使用ngram2vec的过程中遇到过这个问题么?
请问楼主,百度百科corpus size 4.1G,具体是什么的size?
请问有公布训练好的词向量的文件吗?
为什么点击词向量的链接然后跳转到了百度首页?谢谢!
the word2vec pre-trained word embedding for weibo is not available
您好, readme 里的《四库全书》注释说提供了字向量,因为古汉语多为单字词;但是却没有提供字向量的链接,请问是不对外开放吗?还是稍后会更新 readme 文件?
谢谢~
就是百度网盘下载下来sgns.merge.word.bz2 正常用bzip2 -d sgns.merge.word.bz2 命令解压报错
bzip2: sgns.merge.word.bz2 is not a bzip2 file. 难道下载的问题? 谢谢~~
这个ngram,是指考虑了word的ngram,还是character的ngram呢?可是常出现的character的ngram,不就是word了吗?不是很理解这个context features是怎么考虑的。求解答,谢谢!
请问这些原始语料(比如知乎的问答语料)能公开吗?
在lstm中,我用word2vec比知乎问答或者mix-max综合的效果还要好,是个什么状态?
想问一下,这个PPMI训练的model怎么使用,不太明白,这方面的信息有点少,可以给一些建议吗?万分感谢
例如我只想要词频最高的前 N 个词,是否只需读取前 N 行即可?
Could you please publish a link to all of the Baidu Netdisk files? I wish to download all the model files quickly rather than one by one.
Is there any plan to save the model files to other netdisks? For example, Google Drive or Dropbox. It should be very convenient for oversea researchers.
Many thanks for your work!
我用.strip().split()分割一行看他的长度,有很多都是300,301,302,303不等,应该是我没有用对分隔符,能否告知字和向量之间是用什么进行分隔的?
can i continue training this Embedding? how? plz
你好~感谢你们将你们的工作开源,受贵组论文启示,我想要用自己的语料库训练context为word+char+ngram的SGNS embedding。于是我又看了ngram2vec的论文,发现其根据target和context不同分为:uni_uni, uni_bi, bi_bi... 。CA8中是只用target为uni的uni_bi吗?然后又在context中加入char?如果我想训练context为word+char+ngram的SGNS embedding,如何将char加入到context呢?是要自己在ngram2vec toolkit中自己写代码添加<word,char>对嘛?
什么时候可以提供中文字符的向量表示
大佬能不能提供下训练词向量的语料呢,需要怎么使用这个词向量?使用Word2Vec.load()会报错
請問表格中的連結失效了??? (300d/Sparse)
大神,有个问题请教一下。
context feature里面的Word,Word+Ngram,Word+Character,Word+Character+Ngram有什么区别?
词向量是使用window中的词成对的训练跑出来的隐层权重矩阵。
Word+Ngram这种是怎么训练的呢?或者说Ngram模型就是个概率表,这个怎么融合进词向量训练里面的呢?还有+Character也是一样的疑问。
不明白这几个的区别,能否讲解一下,谢谢啦。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.