挑战
Loading the data
下面所有的代码/例子都是运行在 8 GB 内存 的 2016 年的 Macbook Pro。如果硬件或云实例有更好的 ram 配置,表现会更好。
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Python</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1587</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">4</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Python</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1621</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Python</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1651</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Python</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1659</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Word</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Year</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> of </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Publication</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">3.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Total</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> number of times the word was seen</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">4.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Total</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> number of books containing the word</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> 这个单词是我们感兴趣的?</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> 发布的年份</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">3.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> 单词使用的总次数</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">import</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> tubes</span>
1
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">FILES = glob.glob(path.expanduser(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(181, 189, 104);word-wrap: break-word !important;">"~/src/data/ngrams/1gram/googlebooks*"</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">))</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">WORD = </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(181, 189, 104);word-wrap: break-word !important;">"Python"</span>
1
1
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">one_grams_tube = (tubes.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Each</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(FILES)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .read_files()</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .split()</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .tsv(essay-headers=</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">False</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .multi(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">lambda</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row: (</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">get</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).equals(WORD.encode(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(181, 189, 104);word-wrap: break-word !important;"> utf-8 </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)),</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">get</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).to(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">int</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">),</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">get</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).to(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">int</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> ))</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">╒═══════════╤════════╤═════════╕</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">│ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Is_Word</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Year</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Count</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">╞═══════════╪════════╪═════════╡</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">│ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1799</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">├───────────┼────────┼─────────┤</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">│ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1804</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">├───────────┼────────┼─────────┤</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">│ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1805</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">├───────────┼────────┼─────────┤</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">│ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1811</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">├───────────┼────────┼─────────┤</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">│ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1820</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> │ ... │</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">╘═══════════╧════════╧═════════╛</span>
每一年的单词总使用量
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">last_year = </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2008</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">YEAR_COL = </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(181, 189, 104);word-wrap: break-word !important;"> 1</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">COUNT_COL = </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(181, 189, 104);word-wrap: break-word !important;"> 2</span>
1
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">year_totals, bins = np.histogram(</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> one_grams[YEAR_COL],</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> density=</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">False</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">,</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> range=(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">, last_year+</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">),</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> bins=last_year + </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">,</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> weights=one_grams[COUNT_COL]</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">one_grams_tube = (tubes.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(129, 162, 190);word-wrap: break-word !important;">Each</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(FILES)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .read_files()</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .split()</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .tsv(essay-headers=</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">False</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .skip_unless(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">lambda</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row: row.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">get</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).to(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">int</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).gt(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1799</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">))</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> .multi(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">lambda</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row: (</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">get</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">0</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).equals(word.encode(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(181, 189, 104);word-wrap: break-word !important;"> utf-8 </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)),</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">get</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).to(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">int</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">),</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> row.</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">get</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">2</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">).to(</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">int</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> ))</span>
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
Python 在每年的占比百分数
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">word_rows = one_grams[IS_WORD_COL]</span>
1
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">word_counts = np.zeros(last_year+</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">1</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">)</span>
1
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">for</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> _, year, count </span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(178, 148, 187);word-wrap: break-word !important;">in</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> one_grams[word_rows]:</span>
1
1 <span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;"> word_counts[year] += (</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(222, 147, 95);word-wrap: break-word !important;">100</span><span class="" style="max-width: 100%;box-sizing: border-box;color: rgb(197, 200, 198);word-wrap: break-word !important;">*count) / year_totals[year]</span>
-
人们是如何将 Python 当做动词使用的?
-
Python 的计算总量是否包含 Python_VERB ?等
性能
语言战争
-
只有首字母大写的名字形式能被匹配(Python,不是 python)
-
每一个语言的提及总数已经被转换到了从 1800 年到 1960 年的百分比平均数,考虑到 Pascal 在 1970 年第一次被提及,这应该有一个合理的基准线。
朋友会在“发现-看一看”看到你“在看”的内容