最近在做有关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 help
usage: google-ngram-downloader <command> [options]
commands:
cooccurrence Write the cooccurrence frequencies of a