转自:https://blog.csdn.net/u011684265/article/details/78024064

from gensim.models import word2vec  

model = word2vec.Word2Vec.load_word2vec_format('/home/ubuntu/word2vec/PubMed-w2v.bin', binary=True)
model.save_word2vec_format('/home/ubuntu/word2vec/PubMed-w2v.txt', binary=False)

但是运行出错:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/gensim/models/word2vec.py", line 1300, in load_word2vec_format
raise DeprecationWarning("Deprecated. Use gensim.models.KeyedVectors.load_word2vec_format instead.")
DeprecationWarning: Deprecated. Use gensim.models.KeyedVectors.load_word2vec_format instead.

所以使用

from gensim.models import KeyedVectors
model =KeyedVectors.load_word2vec_format('/home/ubuntu/word2vec/PubMed-w2v.bin', binary=True) 
model.save_word2vec_format('/home/ubuntu/word2vec/PubMed-w2v.txt', binary=False) 

word2vec:将bin转换为txt的更多相关文章

  1. pyautogui_pdf批量转换为TXT

    pyautogui_pdf批量转换为TXT, 用pdf自带无损转换 # -*- coding: utf-8 -*- """ Created on Thu May 5 15 ...

  2. excel转换为TXT文本

    #_*_ coding:utf-8 _*_#author:yr import xlrd data = xlrd.open_workbook(r"C:\Users\yangr\Desktop\ ...

  3. word2vec:基本的安装及使用简介

    官方word2vec的github下载地址:https://github.com/svn2github/word2vec 环境,linux-ubuntu-14.04LST,安装好git, gcc版本4 ...

  4. Word2vec教程

    Word2vec Tutorial RADIM ŘEHŮŘEK 2014-02-02GENSIM, PROGRAMMING157 COMMENTS I never got round to writi ...

  5. 利用python中的gensim模块训练和测试word2vec

    word2vec的基础知识介绍参考上一篇博客和列举的参考资料. 首先利用安装gensim模块,相关依赖如下,注意版本要一致: Python >= 2.7 (tested with version ...

  6. Python读写txt文本文件

    一.文件的打开和创建 ? 1 2 3 4 5 >>> f = open('/tmp/test.txt') >>> f.read() 'hello python!\n ...

  7. hive 之 将excel数据导入hive中 : excel 转 txt

    一.需求: 1.客户每月上传固定格式的excel文件到指定目录.每月上传的文件名只有结尾月份不同,如: 10月文件名:  zhongdiangedan202010.xlsx  , 11月文件名: zh ...

  8. 高清地图转换(xord转apollo的bin文件)

    目标 将carla中的OpenDrive地图(carla\Unreal\CarlaUE4\Content\Carla\Maps\OpenDrive)转换为Apollo中可识别的地图格式(bin与txt ...

  9. Word2Vec 使用总结

    word2vec 是google 推出的做词嵌入(word embedding)的开源工具. 简单的说,它在给定的语料库上训练一个模型,然后会输出所有出现在语料库上的单词的向量表示,这个向量称为&qu ...

随机推荐

  1. 【转】Android系统开篇

    版权声明:本站所有博文内容均为原创,转载请务必注明作者与原文链接,且不得篡改原文内容.另外,未经授权文章不得用于任何商业目的. 一.引言 Android系统非常庞大.错综复杂,其底层是采用Linux作 ...

  2. golang字符串拼接

    四种拼接方案: 1,直接用 += 操作符, 直接将多个字符串拼接. 最直观的方法, 不过当数据量非常大时用这种拼接访求是非常低效的. 2,直接用 + 操作符,这个和+=其实一个意思了. 3,用字符串切 ...

  3. css3 animation 在某些浏览器中特别快 bugfix

    今天在一款三星 4.2.2 的 webview 里,出现 animation 特别快的问题,把: .xxx{ -webkit-animation: xxx 24s linear infinite; } ...

  4. 【javascript】定时器组件

    'use strict'; module.exports = function() { this.timer = {}; this.config = {}; // 初始化参数 this.init = ...

  5. Ubuntu下安装antlr-4.7.1

    简介:antlr工具将语法文件转换成可以识别该语法文件所描述的语言的程序. 例如:给定一个识别json的语法,antlr工具将会根据该语法生成一个程序,该程序可以通过antlr运行库来识别输入的jso ...

  6. makefile 常用函数

    Linux下编译c/c++源码需要编写makefile文件,文章参看 http://blog.sina.com.cn/s/blog_4c4d6e74010009jr.html 一函数的调用语法 二字符 ...

  7. My google script which based on Google Sheet and Form

    My google script which based on Google Sheet and Form // get sheet data function getSpreadsheetData( ...

  8. STM32进入HardFault_Handler处理办法

    STM32进入HardFault_Handler处理办法 HardFault_Handler出现的情况一般有两种: 一种是:数组越界 一种是:堆栈溢出,程序指针指飞 方法一 在中断HardFault_ ...

  9. 删除或修改本地Git保存的账号密码

    win10 系统下进入 控制面板 > 用户帐户 > 管理你的凭据 选择 [Windows 凭据] git 保存的用户信息在普通凭据列表里 >>编辑>>>完成

  10. Vue2.0 $set()的正确使用方式

    https://blog.csdn.net/panyang01/article/details/76665448