【问题标题】:How to search Google Ngrams for "dated" words & phrases?如何在 Google Ngrams 中搜索“过时”的单词和短语?
【发布时间】:2014-11-03 15:24:26
【问题描述】:

我想编写一个应用程序,搜索 Google 的 Ngram 数据,以返回过去比现在更流行的单词和短语,在任意年份范围内,以任意百分比计算。

例如:https://books.google.com/ngrams/graph?content=cowabunga&year_start=1950&year_end=2000&corpus=15&smoothing=3

理想情况下,我希望能够找到这些单词和短语,而无需预先指定它们。谁能帮我想出一种方法来使用下载的 Ngrams 数据副本?

【问题讨论】:

    标签: google-api n-gram


    【解决方案1】:

    下载一些 n-gram 后的第一步是将它们转储到 SQLite3 database。例如,我获取了1-grams starting with the letter 't'

    要将它们转储到 SQLite,请运行命令 sqlite3 1grams.db

    sqlite> create table t1grams (ngram text, year integer, match_count integer, volume_count integer);
    sqlite> .separator "\t"
    sqlite> .import googlebooks-eng-all-1gram-20120701-t t1grams
    

    第二步是选择年份范围,称它们为YEAR_STARTYEAR_END,以及你的百分比,称它为PERCENT_THRESHOLD

    您的问题归结为一个查询,您选择那些ngrams 使得match_countYEAR_ENDYEAR_STARTPERCENT_THRESHOLD%。

    【讨论】:

    • @duncan-malashock 如果这听起来正确,我会想出一个示例 SQL 查询来实际完成这个计算。但是,我想确保这与您要查找的内容一致。
    • 你好,我正在使用mapreduce来做这个任务,你能指导我这方面的工作吗??
    • @MuneebulHassan 不在这里,但有很好的教程:hadooptutorial.info/mapreduce-use-case-for-n-gram-statistics
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-16
    • 1970-01-01
    • 2015-08-28
    • 1970-01-01
    • 2021-09-13
    • 1970-01-01
    相关资源
    最近更新 更多