|
1 | 1 | {
|
2 | 2 | "cells": [
|
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": { |
| 6 | + "toc": true |
| 7 | + }, |
| 8 | + "source": [ |
| 9 | + "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n", |
| 10 | + "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#1.-Load-the-data\" data-toc-modified-id=\"1.-Load-the-data-1\"><span class=\"toc-item-num\">1 </span>1. Load the data</a></span></li><li><span><a href=\"#2.-Filtering-out-the-noise\" data-toc-modified-id=\"2.-Filtering-out-the-noise-2\"><span class=\"toc-item-num\">2 </span>2. Filtering out the noise</a></span></li><li><span><a href=\"#3.-Even-better-filtering\" data-toc-modified-id=\"3.-Even-better-filtering-3\"><span class=\"toc-item-num\">3 </span>3. Even better filtering</a></span></li><li><span><a href=\"#4.-Term-frequency-times-inverse-document-frequency\" data-toc-modified-id=\"4.-Term-frequency-times-inverse-document-frequency-4\"><span class=\"toc-item-num\">4 </span>4. Term frequency times inverse document frequency</a></span></li><li><span><a href=\"#5.-Utility-function\" data-toc-modified-id=\"5.-Utility-function-5\"><span class=\"toc-item-num\">5 </span>5. Utility function</a></span></li></ul></div>" |
| 11 | + ] |
| 12 | + }, |
3 | 13 | {
|
4 | 14 | "cell_type": "markdown",
|
5 | 15 | "metadata": {},
|
|
40 | 50 | },
|
41 | 51 | {
|
42 | 52 | "cell_type": "code",
|
43 |
| - "execution_count": 2, |
44 |
| - "metadata": {}, |
| 53 | + "execution_count": 1, |
| 54 | + "metadata": { |
| 55 | + "ExecuteTime": { |
| 56 | + "end_time": "2018-10-08T13:52:39.328796Z", |
| 57 | + "start_time": "2018-10-08T13:52:39.172635Z" |
| 58 | + } |
| 59 | + }, |
45 | 60 | "outputs": [
|
46 | 61 | {
|
47 | 62 | "name": "stdout",
|
|
93 | 108 | },
|
94 | 109 | {
|
95 | 110 | "cell_type": "code",
|
96 |
| - "execution_count": 3, |
97 |
| - "metadata": {}, |
| 111 | + "execution_count": 2, |
| 112 | + "metadata": { |
| 113 | + "ExecuteTime": { |
| 114 | + "end_time": "2018-10-08T13:52:47.404302Z", |
| 115 | + "start_time": "2018-10-08T13:52:42.691109Z" |
| 116 | + } |
| 117 | + }, |
98 | 118 | "outputs": [],
|
99 | 119 | "source": [
|
100 | 120 | "from sklearn.feature_extraction.text import CountVectorizer\n",
|
|
104 | 124 | },
|
105 | 125 | {
|
106 | 126 | "cell_type": "code",
|
107 |
| - "execution_count": 4, |
108 |
| - "metadata": {}, |
| 127 | + "execution_count": 3, |
| 128 | + "metadata": { |
| 129 | + "ExecuteTime": { |
| 130 | + "end_time": "2018-10-08T13:52:49.004851Z", |
| 131 | + "start_time": "2018-10-08T13:52:48.926879Z" |
| 132 | + } |
| 133 | + }, |
109 | 134 | "outputs": [
|
110 | 135 | {
|
111 | 136 | "name": "stdout",
|
|
145 | 170 | },
|
146 | 171 | {
|
147 | 172 | "cell_type": "code",
|
148 |
| - "execution_count": 5, |
149 |
| - "metadata": {}, |
| 173 | + "execution_count": 4, |
| 174 | + "metadata": { |
| 175 | + "ExecuteTime": { |
| 176 | + "end_time": "2018-10-08T13:52:58.115382Z", |
| 177 | + "start_time": "2018-10-08T13:52:51.966698Z" |
| 178 | + } |
| 179 | + }, |
150 | 180 | "outputs": [],
|
151 | 181 | "source": [
|
152 | 182 | "from nltk import wordpunct_tokenize \n",
|
|
181 | 211 | },
|
182 | 212 | {
|
183 | 213 | "cell_type": "code",
|
184 |
| - "execution_count": 6, |
| 214 | + "execution_count": 5, |
185 | 215 | "metadata": {
|
| 216 | + "ExecuteTime": { |
| 217 | + "end_time": "2018-10-08T13:52:58.148578Z", |
| 218 | + "start_time": "2018-10-08T13:52:58.117096Z" |
| 219 | + }, |
186 | 220 | "scrolled": true
|
187 | 221 | },
|
188 | 222 | "outputs": [
|
|
216 | 250 | },
|
217 | 251 | {
|
218 | 252 | "cell_type": "code",
|
219 |
| - "execution_count": 7, |
| 253 | + "execution_count": 6, |
220 | 254 | "metadata": {
|
| 255 | + "ExecuteTime": { |
| 256 | + "end_time": "2018-10-08T13:53:01.283024Z", |
| 257 | + "start_time": "2018-10-08T13:53:01.261090Z" |
| 258 | + }, |
221 | 259 | "scrolled": false
|
222 | 260 | },
|
223 | 261 | "outputs": [
|
|
320 | 358 | },
|
321 | 359 | {
|
322 | 360 | "cell_type": "code",
|
323 |
| - "execution_count": 8, |
324 |
| - "metadata": {}, |
| 361 | + "execution_count": 7, |
| 362 | + "metadata": { |
| 363 | + "ExecuteTime": { |
| 364 | + "end_time": "2018-10-08T13:53:06.126250Z", |
| 365 | + "start_time": "2018-10-08T13:53:06.102174Z" |
| 366 | + } |
| 367 | + }, |
325 | 368 | "outputs": [
|
326 | 369 | {
|
327 | 370 | "data": {
|
328 | 371 | "text/plain": [
|
329 | 372 | "(2893, 14279)"
|
330 | 373 | ]
|
331 | 374 | },
|
332 |
| - "execution_count": 8, |
| 375 | + "execution_count": 7, |
333 | 376 | "metadata": {},
|
334 | 377 | "output_type": "execute_result"
|
335 | 378 | }
|
|
349 | 392 | },
|
350 | 393 | {
|
351 | 394 | "cell_type": "code",
|
352 |
| - "execution_count": 9, |
353 |
| - "metadata": {}, |
| 395 | + "execution_count": 8, |
| 396 | + "metadata": { |
| 397 | + "ExecuteTime": { |
| 398 | + "end_time": "2018-10-08T13:53:08.606440Z", |
| 399 | + "start_time": "2018-10-08T13:53:08.601960Z" |
| 400 | + } |
| 401 | + }, |
354 | 402 | "outputs": [
|
355 | 403 | {
|
356 | 404 | "name": "stdout",
|
|
427 | 475 | },
|
428 | 476 | {
|
429 | 477 | "cell_type": "code",
|
430 |
| - "execution_count": 10, |
431 |
| - "metadata": {}, |
| 478 | + "execution_count": 9, |
| 479 | + "metadata": { |
| 480 | + "ExecuteTime": { |
| 481 | + "end_time": "2018-10-08T13:53:15.239967Z", |
| 482 | + "start_time": "2018-10-08T13:53:11.837369Z" |
| 483 | + } |
| 484 | + }, |
432 | 485 | "outputs": [],
|
433 | 486 | "source": [
|
434 | 487 | "import load_spam\n",
|
|
438 | 491 | },
|
439 | 492 | {
|
440 | 493 | "cell_type": "code",
|
441 |
| - "execution_count": 11, |
442 |
| - "metadata": {}, |
| 494 | + "execution_count": 10, |
| 495 | + "metadata": { |
| 496 | + "ExecuteTime": { |
| 497 | + "end_time": "2018-10-08T13:53:16.164299Z", |
| 498 | + "start_time": "2018-10-08T13:53:16.156978Z" |
| 499 | + } |
| 500 | + }, |
443 | 501 | "outputs": [
|
444 | 502 | {
|
445 | 503 | "name": "stdout",
|
|
485 | 543 | "nbconvert_exporter": "python",
|
486 | 544 | "pygments_lexer": "ipython3",
|
487 | 545 | "version": "3.6.4"
|
| 546 | + }, |
| 547 | + "toc": { |
| 548 | + "base_numbering": 1, |
| 549 | + "nav_menu": {}, |
| 550 | + "number_sections": true, |
| 551 | + "sideBar": true, |
| 552 | + "skip_h1_title": false, |
| 553 | + "title_cell": "Table of Contents", |
| 554 | + "title_sidebar": "Contents", |
| 555 | + "toc_cell": true, |
| 556 | + "toc_position": { |
| 557 | + "height": "calc(100% - 180px)", |
| 558 | + "left": "10px", |
| 559 | + "top": "150px", |
| 560 | + "width": "384px" |
| 561 | + }, |
| 562 | + "toc_section_display": true, |
| 563 | + "toc_window_display": true |
488 | 564 | }
|
489 | 565 | },
|
490 | 566 | "nbformat": 4,
|
|
0 commit comments