google books ngram viewer数据集的下载与使用
来源:互联网 发布:scada数据采集 编辑:程序博客网 时间:2024/05/16 15:28
最近在做有关word2vec的项目,需要使用到google books ngram viewer中的数据集。但是打开网页后发现,由于数据很大,google将数据集分成了很多个文件。我如果要下载的话,需要一个一个链接去点开下载,这样似乎很麻烦。
后来我无意中发现了一个Python的package,可以直接使用到google books ngram viewer上面的数据。
首先安装一下这个包:
pip install google-ngram-downloader
这个包有两种使用方式:
命令行工具
这个包提供了一个命令行工具:google-ngram-downloader . 它可以用于下载google books ngram viewer上面的数据集。用法如下:
google-ngram-downloader helpusage: google-ngram-downloader <command> [options]commands: cooccurrence Write the cooccurrence frequencies of a word and its contexts. download Download The Google Books Ngram Viewer dataset version 20120701. help Show help for a given help topic or a help overview. readline Print the raw content.
例如:
google-ngram-downloader download -n 5 #下载5-ngram的数据集google-ngram-downloader download -h #查看帮助,会告诉你下载路径,下载的语言
作为python API
在Python代码中,可以这样获得数据:
>>> from google_ngram_downloader import readline_google_store>>>>>> fname, url, records = next(readline_google_store(ngram_len=5))>>> fname'googlebooks-eng-all-5gram-20120701-0.gz'>>> url'http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-5gram-20120701-0.gz'>>> next(records)Record(ngram=u'0 " A most useful', year=1860, match_count=1, volume_count=1)
链接如下:
https://pypi.python.org/pypi/google-ngram-downloader/
阅读全文
1 0
- google books ngram viewer数据集的下载与使用
- How To Create Your Own Personal Document Viewer (Like Scribd or Google Books)
- Hierarchy Viewer的使用
- Python安装nltk使用Ngram
- Python爬取特朗普就职演讲稿,使用ngram模型进行数据清洗
- ngram模型的光滑处理
- fastText Ngram 的处理过程
- PCBM LP Viewer的使用
- PCBM LP Viewer的使用
- Android Hierarchy Viewer的使用
- Hierarchy Viewer工具的使用
- UI Automator Viewer的使用
- virt-viewer的简单使用
- viewer.js插件的使用
- UI Automator Viewer的使用
- books.google.com
- linux下hp-scan --viewer=<viewer>命令的使用
- OC 下载数据 与请求登录 NSURLSession的使用
- HDU1087 Super Jumping! Jumping! Jumping!(dp问题)
- HDU 6129 Just do it【杨辉三角】
- 2017.08.18 利用python打印一年的日历
- 图的基本存储的基本方式二——邻接表(链表)
- heroku 自动部署create-react-app项目
- google books ngram viewer数据集的下载与使用
- OJ中的语言选项里G++ 与 C++的区别
- 带负值的背包问题poj2184
- C++函数重载
- 定时器的实现 Quartz
- 机器学习总结(四):极大似然估计与最小二乘法
- UDP有边界,一次一包;TCP是字节流,需要应用层自己判断包边界
- 标签组件与图标
- linux下Android开发环境变量设置