1. 用fasttext实现word2vec时,第一步需要获取训练数据,自己下载耗时太长,大约耗时半小时左右,下载地址:http://mattmahoney.net/dc/enwik9.zip
2. 下载到data文件夹下后解压文件
unzip enwik9.zip
解压后的文件是xml格式,如下图所示:
head -10 enwik9

3. 将xml格式的数据处理成所需数据
perl wikifil.pl enwik9 > fil9
其中wikifil.pl文件可从网上复制即可。http://mattmahoney.net/dc/textdata.html

查看处理后的数据,都是词汇,如下图:
head -c 80 fil9

网友评论