File size: 77,578 Bytes
976dc7d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import glob\n",
"import ujson"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--2020-04-27 18:20:02-- http://mklab2.iti.gr/multisensor/images/5/5c/WikiRef_dataset.zip\n",
"Resolving mklab2.iti.gr (mklab2.iti.gr)... 160.40.50.223\n",
"Connecting to mklab2.iti.gr (mklab2.iti.gr)|160.40.50.223|:80... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 1345469 (1,3M) [application/zip]\n",
"Saving to: ‘WikiRef_dataset.zip’\n",
"\n",
"WikiRef_dataset.zip 100%[===================>] 1,28M 2,32MB/s in 0,6s \n",
"\n",
"2020-04-27 18:20:03 (2,32 MB/s) - ‘WikiRef_dataset.zip’ saved [1345469/1345469]\n",
"\n"
]
}
],
"source": [
"! wget http://mklab2.iti.gr/multisensor/images/5/5c/WikiRef_dataset.zip"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WikiRef Dataset\r",
"\r\n",
"\r",
"\r\n",
"The selected topics of the WikiRef220 dataset (and the number of articles per topic) are: \r",
"\r\n",
"Paris Attacks November 2015 (36), Barack Obama (5), Premier League (37), Cypriot Financial Crisis 2012-2013 (5), Rolling Stones (1), Debt Crisis in Greece (5), Samsung Galaxy S5 (35), Greek Elections June 2012 (5), smartphone (5), Malaysia Airlines Flight 370 (39), Stephen Hawking (1), Michelle Obama (38), Tohoku earthquake and tsunami (5), NBA draft (1), U2 (1), Wall Street (1). \r",
"\r\n",
"The topics Barack Obama, Cypriot Financial Crisis 2012-2013, Rolling Stones, Debt Crisis in Greece, Greek Elections June 2012, smartphone, Stephen Hawking, Tohoku earthquake and tsunami, NBA draft, U2 and Wall Street appear no more than 5 times and therefore, they are regarded as noise. \r",
"\r\n",
"\r",
"\r\n",
"The remaining 5 topics of WikiRef220 are: \r",
"\r\n",
"�\tParis Attacks November 2015 [1]\r",
"\r\n",
"�\tPremier League [2]\r",
"\r\n",
"�\tMalaysia Airlines Flight 370 [3] \r",
"\r\n",
"�\tSamsung Galaxy S5 [4]\r",
"\r\n",
"�\tMichelle Obama [5]\r",
"\r\n",
"\r",
"\r\n",
"The WikiRef186 dataset (4 topics) is the WikiRef220 without 34 documents related to �Malaysia Airlines Flight 370� and the WikiRef150 dataset (3 topics) is the WikiRef186 without the 36 documents related to �Paris Attacks�. \r",
"\r\n",
"\r",
"\r\n",
"References\r",
"\r\n",
"1. https://en.wikipedia.org/wiki/November_2015_Paris_attacks\r",
"\r\n",
"2. https://en.wikipedia.org/wiki/Premier_League\r",
"\r\n",
"3. https://en.wikipedia.org/wiki/Malaysia_Airlines_Flight_370\r",
"\r\n",
"4. https://en.wikipedia.org/wiki/Samsung_Galaxy_S5\r",
"\r\n",
"5. https://en.wikipedia.org/wiki/Michelle_Obama\r",
"\r\n",
"\r",
"\r\n",
"\r",
"\r\n",
"If you use this dataset, please cite:\r",
"\r\n",
"\r",
"\r\n",
"Gialampoukidis, I., Vrochidis, S., & Kompatsiaris, I. (2016). A Hybrid Framework for News Clustering Based on the DBSCAN-Martingale and LDA. In Machine Learning and Data Mining in Pattern Recognition (pp. 170-184). Springer International Publishing.\r",
"\r\n",
"\r",
"\r\n",
"\r",
"\r\n",
"\r",
"\r\n"
]
}
],
"source": [
"! unzip -q WikiRef_dataset.zip \n",
"! cat WikiRef_dataset/readme.txt\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" barack.obama.1.txt\t\t 'ParisAttacks2015 (21).txt'\r\n",
" barack.obama.24.txt\t\t 'ParisAttacks2015 (22).txt'\r\n",
" barack.obama.3.txt\t\t 'ParisAttacks2015 (23).txt'\r\n",
" barack.obama.4.txt\t\t 'ParisAttacks2015 (24).txt'\r\n",
" barack.obama.9.txt\t\t 'ParisAttacks2015 (25).txt'\r\n",
" cypriot.financial.crisis.36.txt 'ParisAttacks2015 (26).txt'\r\n",
" cypriot.financial.crisis.37.txt 'ParisAttacks2015 (27).txt'\r\n",
" cypriot.financial.crisis.38.txt 'ParisAttacks2015 (28).txt'\r\n",
" cypriot.financial.crisis.39.txt 'ParisAttacks2015 (29).txt'\r\n",
" cypriot.financial.crisis.40.txt 'ParisAttacks2015 (2).txt'\r\n",
" debt.crisis.greece.178.txt\t 'ParisAttacks2015 (30).txt'\r\n",
" debt.crisis.greece.179.txt\t 'ParisAttacks2015 (31).txt'\r\n",
" debt.crisis.greece.207.txt\t 'ParisAttacks2015 (32).txt'\r\n",
" debt.crisis.greece.263.txt\t 'ParisAttacks2015 (33).txt'\r\n",
" debt.crisis.greece.81.txt\t 'ParisAttacks2015 (34).txt'\r\n",
" greek.elections.112.txt\t 'ParisAttacks2015 (35).txt'\r\n",
" greek.elections.113.txt\t 'ParisAttacks2015 (36).txt'\r\n",
" greek.elections.114.txt\t 'ParisAttacks2015 (3).txt'\r\n",
" greek.elections.115.txt\t 'ParisAttacks2015 (4).txt'\r\n",
" greek.elections.117.txt\t 'ParisAttacks2015 (5).txt'\r\n",
" malaysia.airlines.flight.10.txt 'ParisAttacks2015 (6).txt'\r\n",
" malaysia.airlines.flight.134.txt 'ParisAttacks2015 (7).txt'\r\n",
" malaysia.airlines.flight.137.txt 'ParisAttacks2015 (8).txt'\r\n",
" malaysia.airlines.flight.13.txt 'ParisAttacks2015 (9).txt'\r\n",
" malaysia.airlines.flight.142.txt premier.league.125.txt\r\n",
" malaysia.airlines.flight.143.txt premier.league.126.txt\r\n",
" malaysia.airlines.flight.14.txt premier.league.133.txt\r\n",
" malaysia.airlines.flight.15.txt premier.league.134.txt\r\n",
" malaysia.airlines.flight.16.txt premier.league.137.txt\r\n",
" malaysia.airlines.flight.18.txt premier.league.140.txt\r\n",
" malaysia.airlines.flight.21.txt premier.league.141.txt\r\n",
" malaysia.airlines.flight.223.txt premier.league.142.txt\r\n",
" malaysia.airlines.flight.225.txt premier.league.143.txt\r\n",
" malaysia.airlines.flight.227.txt premier.league.17.txt\r\n",
" malaysia.airlines.flight.22.txt premier.league.21.txt\r\n",
" malaysia.airlines.flight.230.txt premier.league.22.txt\r\n",
" malaysia.airlines.flight.236.txt premier.league.25.txt\r\n",
" malaysia.airlines.flight.245.txt premier.league.26.txt\r\n",
" malaysia.airlines.flight.24.txt premier.league.29.txt\r\n",
" malaysia.airlines.flight.25.txt premier.league.3.txt\r\n",
" malaysia.airlines.flight.276.txt premier.league.40.txt\r\n",
" malaysia.airlines.flight.278.txt premier.league.44.txt\r\n",
" malaysia.airlines.flight.29.txt premier.league.4.txt\r\n",
" malaysia.airlines.flight.31.txt premier.league.54.txt\r\n",
" malaysia.airlines.flight.32.txt premier.league.55.txt\r\n",
" malaysia.airlines.flight.34.txt premier.league.56.txt\r\n",
" malaysia.airlines.flight.36.txt premier.league.5.txt\r\n",
" malaysia.airlines.flight.66.txt premier.league.61.txt\r\n",
" malaysia.airlines.flight.70.txt premier.league.63.txt\r\n",
" malaysia.airlines.flight.71.txt premier.league.64.txt\r\n",
" malaysia.airlines.flight.74.txt premier.league.68.txt\r\n",
" malaysia.airlines.flight.75.txt premier.league.72.txt\r\n",
" malaysia.airlines.flight.76.txt premier.league.73.txt\r\n",
" malaysia.airlines.flight.79.txt premier.league.77.txt\r\n",
" malaysia.airlines.flight.83.txt premier.league.78.txt\r\n",
" malaysia.airlines.flight.84.txt premier.league.79.txt\r\n",
" malaysia.airlines.flight.86.txt premier.league.87.txt\r\n",
" malaysia.airlines.flight.98.txt premier.league.89.txt\r\n",
" malaysia.airlines.flight.9.txt premier.league.92.txt\r\n",
" michelle.obama.100.txt\t\t premier.league.96.txt\r\n",
" michelle.obama.101.txt\t\t premier.league.9.txt\r\n",
" michelle.obama.102.txt\t\t Rolling.Stones.197.txt\r\n",
" michelle.obama.103.txt\t\t samsung.galaxy.s5.13.txt\r\n",
" michelle.obama.109.txt\t\t samsung.galaxy.s5.14.txt\r\n",
" michelle.obama.111.txt\t\t samsung.galaxy.s5.15.txt\r\n",
" michelle.obama.113.txt\t\t samsung.galaxy.s5.16.txt\r\n",
" michelle.obama.114.txt\t\t samsung.galaxy.s5.19.txt\r\n",
" michelle.obama.115.txt\t\t samsung.galaxy.s5.1.txt\r\n",
" michelle.obama.118.txt\t\t samsung.galaxy.s5.21.txt\r\n",
" michelle.obama.122.txt\t\t samsung.galaxy.s5.22.txt\r\n",
" michelle.obama.123.txt\t\t samsung.galaxy.s5.25.txt\r\n",
" michelle.obama.127.txt\t\t samsung.galaxy.s5.26.txt\r\n",
" michelle.obama.12.txt\t\t samsung.galaxy.s5.27.txt\r\n",
" michelle.obama.130.txt\t\t samsung.galaxy.s5.28.txt\r\n",
" michelle.obama.138.txt\t\t samsung.galaxy.s5.29.txt\r\n",
" michelle.obama.139.txt\t\t samsung.galaxy.s5.2.txt\r\n",
" michelle.obama.142.txt\t\t samsung.galaxy.s5.30.txt\r\n",
" michelle.obama.144.txt\t\t samsung.galaxy.s5.31.txt\r\n",
" michelle.obama.146.txt\t\t samsung.galaxy.s5.32.txt\r\n",
" michelle.obama.15.txt\t\t samsung.galaxy.s5.33.txt\r\n",
" michelle.obama.20.txt\t\t samsung.galaxy.s5.34.txt\r\n",
" michelle.obama.22.txt\t\t samsung.galaxy.s5.35.txt\r\n",
" michelle.obama.23.txt\t\t samsung.galaxy.s5.36.txt\r\n",
" michelle.obama.56.txt\t\t samsung.galaxy.s5.37.txt\r\n",
" michelle.obama.62.txt\t\t samsung.galaxy.s5.38.txt\r\n",
" michelle.obama.64.txt\t\t samsung.galaxy.s5.39.txt\r\n",
" michelle.obama.67.txt\t\t samsung.galaxy.s5.3.txt\r\n",
" michelle.obama.70.txt\t\t samsung.galaxy.s5.40.txt\r\n",
" michelle.obama.73.txt\t\t samsung.galaxy.s5.41.txt\r\n",
" michelle.obama.75.txt\t\t samsung.galaxy.s5.42.txt\r\n",
" michelle.obama.79.txt\t\t samsung.galaxy.s5.43.txt\r\n",
" michelle.obama.80.txt\t\t samsung.galaxy.s5.44.txt\r\n",
" michelle.obama.83.txt\t\t samsung.galaxy.s5.45.txt\r\n",
" michelle.obama.86.txt\t\t samsung.galaxy.s5.47.txt\r\n",
" michelle.obama.95.txt\t\t samsung.galaxy.s5.4.txt\r\n",
" michelle.obama.98.txt\t\t samsung.galaxy.s5.6.txt\r\n",
" michelle.obama.9.txt\t\t samsung.galaxy.s5.7.txt\r\n",
" NBA.draft.2.txt\t\t smartphone.107.txt\r\n",
"'ParisAttacks2015 (10).txt'\t smartphone.129.txt\r\n",
"'ParisAttacks2015 (11).txt'\t smartphone.74.txt\r\n",
"'ParisAttacks2015 (12).txt'\t smartphone.78.txt\r\n",
"'ParisAttacks2015 (13).txt'\t smartphone.95.txt\r\n",
"'ParisAttacks2015 (14).txt'\t stephen.hawking.275.txt\r\n",
"'ParisAttacks2015 (15).txt'\t tohoku.earthquake.tsunami.12.txt\r\n",
"'ParisAttacks2015 (16).txt'\t tohoku.earthquake.tsunami.14.txt\r\n",
"'ParisAttacks2015 (17).txt'\t tohoku.earthquake.tsunami.3.txt\r\n",
"'ParisAttacks2015 (18).txt'\t tohoku.earthquake.tsunami.8.txt\r\n",
"'ParisAttacks2015 (19).txt'\t tohoku.earthquake.tsunami.9.txt\r\n",
"'ParisAttacks2015 (1).txt'\t U2.149.txt\r\n",
"'ParisAttacks2015 (20).txt'\t wall.street.51.txt\r\n"
]
}
],
"source": [
"! ls WikiRef_dataset/WikiRef220"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import nltk\n",
"import string\n",
"\n",
"import pandas as pd\n",
"from glob import glob\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"nltk.data.path.append('/home/evgenyegorov/nltk_data/')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"dir_name = \"WikiRef_dataset/WikiRef220\"\n",
"files = glob(dir_name + '/*.txt')\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The secret behind poor smartphone battery life\r",
"\r\n",
"\r",
"\r\n",
"Summary:That shiny new smartphone has a battery that easily lasts all day. Then it all goes downhill from there\r",
"\r\n",
"\r",
"\r\n",
"Rapidly deteriorating battery life has long been tolerated by smartphone owners, mainly because they have no choice. Phones usually meet the holy grail of battery life, the ability to last all day, at first. Then it starts getting worse quickly, until many phone owners end up plugging in during the day. It seems it's always been this way, and there's no incentive to the smartphone makers to make this better.\r",
"\r\n",
"\r",
"\r\n",
"Battery has long been the focus of the mobile segment. In the early days of mobile the possible time away from a power outlet was not very long. This prompted OEMs to do what they could to make batteries in mobile devices last longer.\r",
"\r\n",
"\r",
"\r\n",
"This is why we now have decent battery life with most laptops and tablets. The eight hours needed to go all day no matter what comes up is now met by many mobile devices. Except the smartphone.\r",
"\r\n",
"\r",
"\r\n",
"Pick any smartphone in the top ranks and talk to those who've owned one for a while. Odds are, you'll hear a familiar tale � the phone easily lasted all day when new but that didn't last. If they've owned the phone over a year you'll probably hear about the antics they go through daily to have a phone that is still working at day's end.\r",
"\r\n",
"\r",
"\r\n",
"See related: Falling tablet sales: The problem is they're just too good | Necessary battery life for laptops: 8 hours\r",
"\r\n",
"\r",
"\r\n",
"So why hasn't smartphone battery life improved like that on tablets and laptops? I believe the reason is obvious � there is no incentive for OEMs to improve this. In fact, there's an incentive to keep things the way they've always been.\r",
"\r\n",
"\r",
"\r\n",
"In a recent article I explained that tablet owners aren't upgrading because current devices are good enough . There's no compelling reason for tablet owners to get the latest and greatest because the one they have is good enough.\r",
"\r\n",
"\r",
"\r\n",
"Good battery life is a big part of that satisfaction with tablets. Most of the top tablets get 10+ hours of battery life, and that's enough for just about everyone. Even over time when those tablet batteries start deteriorating, resulting in shorter battery life, they still last all day given the long life they start with when new.\r",
"\r\n",
"\r",
"\r\n",
"With smartphones it's a different story. Many are on the edge of all-day battery life to start, and they fall short as the battery ages. This is common. Take a stroll around the web and you'll find hundreds of articles with tips for \"how to extend the battery on gadget X\". Owners are trying to get through the day with a smartphone that's only a year old, and they'll do anything to make that happen.\r",
"\r\n",
"\r",
"\r\n",
"That includes trading in that phone when their US contract is up. I believe it's not just a hankering for the latest shiny smartphone available, it's also to get rid of their old one. They know from experience that their battery life issue will go away with a new phone, due to that new battery inside.\r",
"\r\n",
"\r",
"\r\n",
"This is why there is no incentive for smartphone makers to come up with a new battery technology with the same improvements we've seen in laptops and tablets. They need that two-year replacement cycle the phone contracts push, and the dying battery syndrome fuels that upgrade process.\r",
"\r\n",
"\r",
"\r\n",
"I'm not suggesting there's some hidden conspiracy behind the smartphone battery situation. I am pointing out that from a business perspective there is no incentive for smartphone makers to improve battery life as they have on other mobile devices. They are happy when you trade that phone in for a new one. They just hope you don't figure out what they are doing. If something's not broken, why fix it? \r",
"\r\n",
"\r",
"\r\n"
]
}
],
"source": [
"! cat WikiRef_dataset/WikiRef220/smartphone.107.txt\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"from nltk.corpus import wordnet\n",
"\n",
"def nltk2wn_tag(nltk_tag):\n",
" if nltk_tag.startswith('J'):\n",
" return wordnet.ADJ\n",
" elif nltk_tag.startswith('V'):\n",
" return wordnet.VERB\n",
" elif nltk_tag.startswith('N'):\n",
" return wordnet.NOUN\n",
" elif nltk_tag.startswith('R'):\n",
" return wordnet.ADV\n",
" else: \n",
" return ''"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"from ftfy import fix_text\n",
"\n",
"data = []\n",
"for path in files:\n",
" entry = {}\n",
" entry['id'] = path.split('/')[-1].rpartition(\".\")[0]\n",
" with open(path, 'r', encoding=\"Latin\") as f:\n",
" entry['raw_text'] = \" \".join(fix_text(line).strip() for line in f)\n",
" data.append(entry)\n",
"\n",
"texts = pd.DataFrame(data)"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"from tqdm import tqdm\n",
"\n",
"tokenized_text = []\n",
"\n",
"for text in tqdm(texts['raw_text'].values):\n",
" tokens = nltk.wordpunct_tokenize(text.lower())\n",
" tokenized_text.append(nltk.pos_tag(tokens))\n",
"texts['tokenized'] = tokenized_text"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"from nltk.stem import WordNetLemmatizer\n",
"from nltk.corpus import stopwords\n",
"stop = set(stopwords.words('english'))\n",
"\n",
"wnl = WordNetLemmatizer()\n"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"from nltk.stem import WordNetLemmatizer\n",
"from nltk.corpus import stopwords\n",
"stop = set(stopwords.words('english'))\n",
"\n",
"lemmatized_text = []\n",
"wnl = WordNetLemmatizer()\n",
"for text in texts['tokenized'].values:\n",
" lemmatized = [wnl.lemmatize(word,nltk2wn_tag(pos))\n",
" if nltk2wn_tag(pos) != ''\n",
" else wnl.lemmatize(word)\n",
" for word, pos in text ]\n",
" lemmatized = [word for word in lemmatized \n",
" if word not in stop and word.isalpha()]\n",
" lemmatized_text.append(lemmatized)\n",
"texts['lemmatized'] = lemmatized_text"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append('../clustering_system/')\n",
"\n",
"import re\n",
"import os\n",
"import pymorphy2\n",
"from collections import Counter\n",
"\n",
"from preprocessing.aitexta.tokenization import RegexpTokenizer\n",
"from preprocessing.aitexta.tokenization import SpacyRulesRussianTokenizer\n",
"from preprocessing.aitexta.utils import FunctionalTransformer\n",
"from preprocessing.aitexta.lemmatization import Pymorphy2Lemmatizer\n",
"from preprocessing.aitexta.feature_filtering import StopTokensRemover\n",
"from preprocessing.aitexta.feature_filtering import RegexpFilter\n",
"from preprocessing.aitexta.feature_filtering import BASE_RU_NONTOKEN_REGEXPS\n",
"from preprocessing.aitexta.feature_extracting import TopMineNgrammer\n",
"from preprocessing.aitexta.ner_extracting import Pymorphy2NerExtractor\n",
"from preprocessing.aitexta.utils import MergerTransformer\n",
"from preprocessing.aitexta.pipeline import SequentialPipeline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"this_file_path = os.path.dirname('../clustering_system/preprocessing/')\n",
"STOP_TOKENS_RELATIVE_PATH = 'aitexta/feature_filtering/stop_words_files/BASE_UNIVERSAL.txt'\n",
"STOP_TOKENS_FILE = os.path.join(this_file_path, STOP_TOKENS_RELATIVE_PATH)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"# TODO\n",
"# specSymb = {\"«\", \"»\", \"—\", \"“\", \"-\", \"№\"}\n",
"# specSymb = punctuation + \"«»—“-№\"\n",
"# pattern = re.compile(\"[\" + re.escape(specSymb) + \"]\")\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"\n",
"def tokenize(text):\n",
" tokens = nltk.wordpunct_tokenize(text.lower())\n",
" return nltk.pos_tag(tokens)\n",
"\n",
"def lemmatize(text):\n",
" lemmatized = [wnl.lemmatize(word,nltk2wn_tag(pos))\n",
" if nltk2wn_tag(pos) != ''\n",
" else wnl.lemmatize(word)\n",
" for word, pos in text ]\n",
" lemmatized = [word for word in lemmatized \n",
" if word not in stop and word.isalpha()]\n",
" return lemmatized\n",
"\n",
"\n",
"class NGrammPreprocessor:\n",
" def __init__(self, n_jobs=1, verbose=False):\n",
" nltk_tokenizer = FunctionalTransformer(tokenize)\n",
" nltk_lemmatizer = FunctionalTransformer(lemmatize)\n",
" \n",
" self.text_to_lemmatized = SequentialPipeline(steps=[\n",
" ('tokenization', nltk_tokenizer),\n",
" ('lemmatization', nltk_lemmatizer),\n",
" ], verbose=verbose)\n",
"\n",
" self.lemmatized_to_ngramms = SequentialPipeline(steps=[\n",
" ('ngrammer', TopMineNgrammer(stop_tokens_file=STOP_TOKENS_FILE,\n",
" nontoken_regexps=None,\n",
" allow_delimiters_in_ngramm=True,\n",
" output_type='string_ngramm',\n",
" n_jobs=n_jobs))\n",
" ], verbose=verbose)\n",
"\n",
" def fit_transform(self, X):\n",
" X = self._clean_dataframe(X)\n",
"\n",
" X['lemmatized'] = self.text_to_lemmatized.fit_transform(X['raw_text'].values)\n",
"\n",
" X['ngramms'] = self.lemmatized_to_ngramms.fit_transform(X['lemmatized'].values)\n",
"\n",
" for column in ['lemmatized', 'ngramms']:\n",
" X[column] = X[column].apply(lambda x: \" \".join(x))\n",
"\n",
" return X\n",
"\n",
" def transform(self, X):\n",
" X = self._clean_dataframe(X)\n",
"\n",
" X['lemmatized'] = self.text_to_lemmatized.transform(X['raw_text'].values)\n",
"\n",
" X['ngramms'] = self.lemmatized_to_ngramms.transform(X['lemmatized'].values)\n",
"\n",
" for column in ['lemmatized', 'ngramms']:\n",
" X[column] = X[column].apply(lambda x: \" \".join(x))\n",
"\n",
" return X\n",
"\n",
" def _clean_dataframe(self, X):\n",
" X['raw_text'] = X['raw_text'].astype(str).str.strip()\n",
" X = X[X['raw_text'] != '']\n",
"\n",
" return X"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Start of pipeline\n",
"**************************************************************************\n",
"\n",
"Start of tokenization fit transform\n",
"End of tokenization fit transform\n",
"Total time: 6.8257880210876465\n",
"----------------------------------------------------------------------\n",
"Start of lemmatization fit transform\n",
"End of lemmatization fit transform\n",
"Total time: 2.13810396194458\n",
"----------------------------------------------------------------------\n",
"End of pipeline\n",
"Total time: 8.972941160202026\n",
"----------------------------------------------------------------------\n",
"**************************************************************************\n",
"\n",
"Start of pipeline\n",
"**************************************************************************\n",
"\n",
"Start of ngrammer fit transform\n",
"End of ngrammer fit transform\n",
"Total time: 3.967646598815918\n",
"----------------------------------------------------------------------\n",
"End of pipeline\n",
"Total time: 3.968014717102051\n",
"----------------------------------------------------------------------\n",
"**************************************************************************\n",
"\n"
]
}
],
"source": [
"preprocesser = NGrammPreprocessor(n_jobs=10, verbose=True)\n",
"wiki_processed = preprocesser.fit_transform(texts)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>raw_text</th>\n",
" <th>lemmatized</th>\n",
" <th>ngramms</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>smartphone.107</td>\n",
" <td>The secret behind poor smartphone battery life...</td>\n",
" <td>secret behind poor smartphone battery life sum...</td>\n",
" <td>battery_life battery_life battery_life battery...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>ParisAttacks2015 (28)</td>\n",
" <td>On the run from Isis: Jihadists 'targeting Par...</td>\n",
" <td>run isi jihadist target paris attacker salah a...</td>\n",
" <td>run_isi run_isi paris_attacker salah_abdeslam ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>michelle.obama.103</td>\n",
" <td>Michelle Obama Goes Organic and Brings in the ...</td>\n",
" <td>michelle obama go organic bring bee go organic...</td>\n",
" <td>michelle_obama michelle_obama white_house whit...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>premier.league.61</td>\n",
" <td>Premiership stays on BBC The BBC has won the ...</td>\n",
" <td>premiership stay bbc bbc win right show premie...</td>\n",
" <td>premier_league premier_league premier_league p...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>ParisAttacks2015 (10)</td>\n",
" <td>Hollande says Paris attacks 'an act of war' by...</td>\n",
" <td>hollande say paris attack act war islamic stat...</td>\n",
" <td>paris_attack act_war act_war act_war islamic_s...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" id raw_text \\\n",
"0 smartphone.107 The secret behind poor smartphone battery life... \n",
"1 ParisAttacks2015 (28) On the run from Isis: Jihadists 'targeting Par... \n",
"2 michelle.obama.103 Michelle Obama Goes Organic and Brings in the ... \n",
"3 premier.league.61 Premiership stays on BBC The BBC has won the ... \n",
"4 ParisAttacks2015 (10) Hollande says Paris attacks 'an act of war' by... \n",
"\n",
" lemmatized \\\n",
"0 secret behind poor smartphone battery life sum... \n",
"1 run isi jihadist target paris attacker salah a... \n",
"2 michelle obama go organic bring bee go organic... \n",
"3 premiership stay bbc bbc win right show premie... \n",
"4 hollande say paris attack act war islamic stat... \n",
"\n",
" ngramms \n",
"0 battery_life battery_life battery_life battery... \n",
"1 run_isi run_isi paris_attacker salah_abdeslam ... \n",
"2 michelle_obama michelle_obama white_house whit... \n",
"3 premier_league premier_league premier_league p... \n",
"4 paris_attack act_war act_war act_war islamic_s... "
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wiki_processed.head()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"wiki_processed['title'] = wiki_processed.id.str.replace(':', ':').replace('@', '@').replace(' ', '_')\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"ALL_MODALITIES = ['lemmatized', 'ngramms']\n",
"PLAIN_TEXT = \"raw_text\"\n",
"\n",
"\n",
"\n",
"\n",
"def create_vowpal_wabbit(data, modalities=None, use_counters=False):\n",
"\n",
" documents_bag = dict()\n",
"\n",
" for elem_id, elem in data.iterrows():\n",
" if use_counters:\n",
" documents_bag[elem_id] = {m: Counter() for m in ALL_MODALITIES}\n",
" else:\n",
" documents_bag[elem_id] = {m: '' for m in ALL_MODALITIES}\n",
" documents_bag[elem_id]['plain_text'] = ''\n",
"\n",
" if isinstance(elem[PLAIN_TEXT], str):\n",
" documents_bag[elem_id]['plain_text'] += ' '.join(elem[PLAIN_TEXT].split()) + ' | '\n",
"\n",
" for modality in ALL_MODALITIES:\n",
" if isinstance(elem[modality], str):\n",
" tokens = elem[modality].split()\n",
" tokens = [re.sub('[\\:\\|\\@]', '', token) for token in tokens]\n",
" elif isinstance(elem[modality], list):\n",
" tokens = [\n",
" re.sub('[\\:\\|\\@ ]', '_', token.strip())\n",
" for token in elem[modality]\n",
" ]\n",
"\n",
" if use_counters:\n",
" documents_bag[elem_id][modality] += Counter(tokens)\n",
" else:\n",
" documents_bag[elem_id][modality] += ' '.join(tokens)\n",
"\n",
" documents_bag_str_format = []\n",
"\n",
" for key in documents_bag.keys():\n",
" new_message_str_format = str(key).replace(\" \", \"_\")\n",
" if modalities is None:\n",
" modalities = documents_bag[key].keys()\n",
" for modality in modalities:\n",
" if modality == 'plain_text':\n",
" continue\n",
" if use_counters:\n",
" modality_content = ' '.join([\n",
" token + ':' + str(count)\n",
" for token, count in documents_bag[key][modality].items()\n",
" ])\n",
" else:\n",
" modality_content = documents_bag[key][modality]\n",
" new_message_str_format += \" |@{} {}\".format(modality, modality_content)\n",
" documents_bag_str_format.append(new_message_str_format)\n",
" return documents_bag_str_format\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"for mode in [\"bow\", \"natural_order\"]:\n",
"\n",
" use_counters = True if mode == \"bow\" else False\n",
" documents_str_format = create_vowpal_wabbit(wiki_processed.set_index(\"title\"), use_counters=use_counters)\n",
"\n",
" output = f'wiki_ref220_{mode}'\n",
"\n",
" with open(output + '.txt', 'w') as f:\n",
" for elem in documents_str_format:\n",
" f.write(elem + '\\n')\n",
" wiki_processed[\"vw_text\"] = documents_str_format\n",
" wiki_processed[['id', 'raw_text', 'vw_text']].to_csv(output + '.csv', index=False)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>raw_text</th>\n",
" <th>vw_text</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>smartphone.107</td>\n",
" <td>The secret behind poor smartphone battery life...</td>\n",
" <td>smartphone.107 |@lemmatized secret behind poor...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>ParisAttacks2015 (28)</td>\n",
" <td>On the run from Isis: Jihadists 'targeting Par...</td>\n",
" <td>ParisAttacks2015_(28) |@lemmatized run isi jih...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>michelle.obama.103</td>\n",
" <td>Michelle Obama Goes Organic and Brings in the ...</td>\n",
" <td>michelle.obama.103 |@lemmatized michelle obama...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>premier.league.61</td>\n",
" <td>Premiership stays on BBC The BBC has won the ...</td>\n",
" <td>premier.league.61 |@lemmatized premiership sta...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>ParisAttacks2015 (10)</td>\n",
" <td>Hollande says Paris attacks 'an act of war' by...</td>\n",
" <td>ParisAttacks2015_(10) |@lemmatized hollande sa...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>premier.league.21</td>\n",
" <td>Power of top four concerns Keegan Keegan has ...</td>\n",
" <td>premier.league.21 |@lemmatized power top four ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>debt.crisis.greece.263</td>\n",
" <td>Not Out of The Woods Yet: Despite Progress, Eu...</td>\n",
" <td>debt.crisis.greece.263 |@lemmatized wood yet d...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>samsung.galaxy.s5.30</td>\n",
" <td>How Google Used Motorola To Smack Down Samsung...</td>\n",
" <td>samsung.galaxy.s5.30 |@lemmatized google use m...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>smartphone.74</td>\n",
" <td>Samsung Waves away a million KOREAN ELECTRONI...</td>\n",
" <td>smartphone.74 |@lemmatized samsung wave away m...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>ParisAttacks2015 (17)</td>\n",
" <td>Behind François Hollande's Snap Decision at St...</td>\n",
" <td>ParisAttacks2015_(17) |@lemmatized behind fran...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>premier.league.22</td>\n",
" <td>Scudamore defends 'boring' League Premier Lea...</td>\n",
" <td>premier.league.22 |@lemmatized scudamore defen...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>samsung.galaxy.s5.39</td>\n",
" <td>Samsung Galaxy S5 Active just got a 'Sport'-y ...</td>\n",
" <td>samsung.galaxy.s5.39 |@lemmatized samsung gala...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>cypriot.financial.crisis.36</td>\n",
" <td>Criminals IN Government: Cyprus President's Fa...</td>\n",
" <td>cypriot.financial.crisis.36 |@lemmatized crimi...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>michelle.obama.80</td>\n",
" <td>Michelle Obama celebrates Chicago roots DENVE...</td>\n",
" <td>michelle.obama.80 |@lemmatized michelle obama ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>michelle.obama.123</td>\n",
" <td>Michelle Obama, Rihanna Named To People's Best...</td>\n",
" <td>michelle.obama.123 |@lemmatized michelle obama...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>ParisAttacks2015 (12)</td>\n",
" <td>France Unsure if Raid Killed Top Suspect in Pa...</td>\n",
" <td>ParisAttacks2015_(12) |@lemmatized france unsu...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>samsung.galaxy.s5.42</td>\n",
" <td>Samsung: Galaxy S5 sales stronger than Galaxy ...</td>\n",
" <td>samsung.galaxy.s5.42 |@lemmatized samsung gala...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>samsung.galaxy.s5.29</td>\n",
" <td>Google Has Strangled The Innovation Out Of The...</td>\n",
" <td>samsung.galaxy.s5.29 |@lemmatized google stran...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>ParisAttacks2015 (32)</td>\n",
" <td>Paris attacks: France mobilises 115,000 securi...</td>\n",
" <td>ParisAttacks2015_(32) |@lemmatized paris attac...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>michelle.obama.95</td>\n",
" <td>First Lady Michelle Obama When people ask Fir...</td>\n",
" <td>michelle.obama.95 |@lemmatized first lady mich...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>premier.league.89</td>\n",
" <td>It's official - Tottenham have the worst defen...</td>\n",
" <td>premier.league.89 |@lemmatized official totten...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>michelle.obama.56</td>\n",
" <td>Michelle Obama: Mom First, Political Wife Seco...</td>\n",
" <td>michelle.obama.56 |@lemmatized michelle obama ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>barack.obama.3</td>\n",
" <td>Though Obama Had to Leave to Find Himself, It ...</td>\n",
" <td>barack.obama.3 |@lemmatized though obama leave...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>samsung.galaxy.s5.38</td>\n",
" <td>Samsung Galaxy S5 Active (AT&T) By Eugene Kim...</td>\n",
" <td>samsung.galaxy.s5.38 |@lemmatized samsung gala...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>malaysia.airlines.flight.86</td>\n",
" <td>Flight 370 search area shifts after 'credible ...</td>\n",
" <td>malaysia.airlines.flight.86 |@lemmatized fligh...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>ParisAttacks2015 (29)</td>\n",
" <td>Paris attacks were carried out by three groups...</td>\n",
" <td>ParisAttacks2015_(29) |@lemmatized paris attac...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>premier.league.143</td>\n",
" <td>Blues wrap up Torres deal Chelsea have compl...</td>\n",
" <td>premier.league.143 |@lemmatized blue wrap torr...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>michelle.obama.102</td>\n",
" <td>Bring Back Our Girls: Michelle Obama and Malal...</td>\n",
" <td>michelle.obama.102 |@lemmatized bring back gir...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>ParisAttacks2015 (19)</td>\n",
" <td>France players praised for staying with German...</td>\n",
" <td>ParisAttacks2015_(19) |@lemmatized france play...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>malaysia.airlines.flight.16</td>\n",
" <td>Australia agrees to lead search in Indian Ocea...</td>\n",
" <td>malaysia.airlines.flight.16 |@lemmatized austr...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>190</th>\n",
" <td>greek.elections.117</td>\n",
" <td>Samaras Takes Office as Greece's Prime Ministe...</td>\n",
" <td>greek.elections.117 |@lemmatized samara take o...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>191</th>\n",
" <td>malaysia.airlines.flight.34</td>\n",
" <td>Malaysia Airlines: experts surprised at disapp...</td>\n",
" <td>malaysia.airlines.flight.34 |@lemmatized malay...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>192</th>\n",
" <td>stephen.hawking.275</td>\n",
" <td>Stephen Hawking warns artificial intelligence ...</td>\n",
" <td>stephen.hawking.275 |@lemmatized stephen hawk ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>193</th>\n",
" <td>malaysia.airlines.flight.31</td>\n",
" <td>Pressure Loss Is Explored in Vanishing of Jetl...</td>\n",
" <td>malaysia.airlines.flight.31 |@lemmatized press...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>194</th>\n",
" <td>premier.league.79</td>\n",
" <td>NBC wins $250m rights to broadcast English Pre...</td>\n",
" <td>premier.league.79 |@lemmatized nbc win right b...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>195</th>\n",
" <td>ParisAttacks2015 (14)</td>\n",
" <td>Turkey Says It Warned France Twice About Paris...</td>\n",
" <td>ParisAttacks2015_(14) |@lemmatized turkey say ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>196</th>\n",
" <td>malaysia.airlines.flight.142</td>\n",
" <td>Flight MH370: former Australian defence chief ...</td>\n",
" <td>malaysia.airlines.flight.142 |@lemmatized flig...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>197</th>\n",
" <td>ParisAttacks2015 (7)</td>\n",
" <td>Seven Militants Led Deadly Paris Attacks Isla...</td>\n",
" <td>ParisAttacks2015_(7) |@lemmatized seven milita...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>198</th>\n",
" <td>premier.league.92</td>\n",
" <td>Vorm is man in form to save Swans There was...</td>\n",
" <td>premier.league.92 |@lemmatized vorm man form s...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>199</th>\n",
" <td>michelle.obama.86</td>\n",
" <td>Michelle Obama Dismisses Criticisms Michelle ...</td>\n",
" <td>michelle.obama.86 |@lemmatized michelle obama ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>200</th>\n",
" <td>premier.league.9</td>\n",
" <td>1985: English teams banned after Heysel The F...</td>\n",
" <td>premier.league.9 |@lemmatized english team ban...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>201</th>\n",
" <td>barack.obama.1</td>\n",
" <td>President Barack Obama Barack Obama is the 44t...</td>\n",
" <td>barack.obama.1 |@lemmatized president barack o...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>202</th>\n",
" <td>malaysia.airlines.flight.10</td>\n",
" <td>Malaysia Airlines Flight MH370: Oil slicks in ...</td>\n",
" <td>malaysia.airlines.flight.10 |@lemmatized malay...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>203</th>\n",
" <td>malaysia.airlines.flight.227</td>\n",
" <td>MH370: Malaysia declares flight disappearance ...</td>\n",
" <td>malaysia.airlines.flight.227 |@lemmatized mala...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>204</th>\n",
" <td>premier.league.4</td>\n",
" <td>Top Soccer Leagues Get 25% Rise in TV Rights S...</td>\n",
" <td>premier.league.4 |@lemmatized top soccer leagu...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>205</th>\n",
" <td>samsung.galaxy.s5.27</td>\n",
" <td>Samsung's Galaxy S5 has an 'ultra power saving...</td>\n",
" <td>samsung.galaxy.s5.27 |@lemmatized samsung gala...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>206</th>\n",
" <td>michelle.obama.100</td>\n",
" <td>Michelle Obama Derided For Being A 'Feminist N...</td>\n",
" <td>michelle.obama.100 |@lemmatized michelle obama...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>207</th>\n",
" <td>ParisAttacks2015 (4)</td>\n",
" <td>Paris Terror Attacks: Yes, Parisians are traum...</td>\n",
" <td>ParisAttacks2015_(4) |@lemmatized paris terror...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>208</th>\n",
" <td>premier.league.63</td>\n",
" <td>Premiership in new £625m TV deal The winner o...</td>\n",
" <td>premier.league.63 |@lemmatized premiership new...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>209</th>\n",
" <td>premier.league.141</td>\n",
" <td>Man City beat Chelsea to Robinho Manchester C...</td>\n",
" <td>premier.league.141 |@lemmatized man city beat ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>210</th>\n",
" <td>samsung.galaxy.s5.4</td>\n",
" <td>Samsung Galaxy S5 review: a solid improvement,...</td>\n",
" <td>samsung.galaxy.s5.4 |@lemmatized samsung galax...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>211</th>\n",
" <td>michelle.obama.75</td>\n",
" <td>Michelle Obama Shows Her Warmer Side on 'The V...</td>\n",
" <td>michelle.obama.75 |@lemmatized michelle obama ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>212</th>\n",
" <td>ParisAttacks2015 (25)</td>\n",
" <td>EU ministers order tighter border checks in re...</td>\n",
" <td>ParisAttacks2015_(25) |@lemmatized eu minister...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>213</th>\n",
" <td>michelle.obama.109</td>\n",
" <td>Michelle Obama's Book On Growing Seeds and Hea...</td>\n",
" <td>michelle.obama.109 |@lemmatized michelle obama...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>214</th>\n",
" <td>samsung.galaxy.s5.13</td>\n",
" <td>Samsung confirms fatal camera flaw on 'limited...</td>\n",
" <td>samsung.galaxy.s5.13 |@lemmatized samsung conf...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>215</th>\n",
" <td>michelle.obama.114</td>\n",
" <td>Michelle Obama Welcomes Gay Families to Nation...</td>\n",
" <td>michelle.obama.114 |@lemmatized michelle obama...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>216</th>\n",
" <td>malaysia.airlines.flight.32</td>\n",
" <td>Malaysia jet passengers likely suffocated, Aus...</td>\n",
" <td>malaysia.airlines.flight.32 |@lemmatized malay...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>217</th>\n",
" <td>samsung.galaxy.s5.22</td>\n",
" <td>Samsung Unveils New Products from its System L...</td>\n",
" <td>samsung.galaxy.s5.22 |@lemmatized samsung unve...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>218</th>\n",
" <td>malaysia.airlines.flight.143</td>\n",
" <td>Investigators find no unusual signs among MH37...</td>\n",
" <td>malaysia.airlines.flight.143 |@lemmatized inve...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>219</th>\n",
" <td>malaysia.airlines.flight.225</td>\n",
" <td>Malaysia Airlines Flight 370: How much will fa...</td>\n",
" <td>malaysia.airlines.flight.225 |@lemmatized mala...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>220 rows × 3 columns</p>\n",
"</div>"
],
"text/plain": [
" id \\\n",
"0 smartphone.107 \n",
"1 ParisAttacks2015 (28) \n",
"2 michelle.obama.103 \n",
"3 premier.league.61 \n",
"4 ParisAttacks2015 (10) \n",
"5 premier.league.21 \n",
"6 debt.crisis.greece.263 \n",
"7 samsung.galaxy.s5.30 \n",
"8 smartphone.74 \n",
"9 ParisAttacks2015 (17) \n",
"10 premier.league.22 \n",
"11 samsung.galaxy.s5.39 \n",
"12 cypriot.financial.crisis.36 \n",
"13 michelle.obama.80 \n",
"14 michelle.obama.123 \n",
"15 ParisAttacks2015 (12) \n",
"16 samsung.galaxy.s5.42 \n",
"17 samsung.galaxy.s5.29 \n",
"18 ParisAttacks2015 (32) \n",
"19 michelle.obama.95 \n",
"20 premier.league.89 \n",
"21 michelle.obama.56 \n",
"22 barack.obama.3 \n",
"23 samsung.galaxy.s5.38 \n",
"24 malaysia.airlines.flight.86 \n",
"25 ParisAttacks2015 (29) \n",
"26 premier.league.143 \n",
"27 michelle.obama.102 \n",
"28 ParisAttacks2015 (19) \n",
"29 malaysia.airlines.flight.16 \n",
".. ... \n",
"190 greek.elections.117 \n",
"191 malaysia.airlines.flight.34 \n",
"192 stephen.hawking.275 \n",
"193 malaysia.airlines.flight.31 \n",
"194 premier.league.79 \n",
"195 ParisAttacks2015 (14) \n",
"196 malaysia.airlines.flight.142 \n",
"197 ParisAttacks2015 (7) \n",
"198 premier.league.92 \n",
"199 michelle.obama.86 \n",
"200 premier.league.9 \n",
"201 barack.obama.1 \n",
"202 malaysia.airlines.flight.10 \n",
"203 malaysia.airlines.flight.227 \n",
"204 premier.league.4 \n",
"205 samsung.galaxy.s5.27 \n",
"206 michelle.obama.100 \n",
"207 ParisAttacks2015 (4) \n",
"208 premier.league.63 \n",
"209 premier.league.141 \n",
"210 samsung.galaxy.s5.4 \n",
"211 michelle.obama.75 \n",
"212 ParisAttacks2015 (25) \n",
"213 michelle.obama.109 \n",
"214 samsung.galaxy.s5.13 \n",
"215 michelle.obama.114 \n",
"216 malaysia.airlines.flight.32 \n",
"217 samsung.galaxy.s5.22 \n",
"218 malaysia.airlines.flight.143 \n",
"219 malaysia.airlines.flight.225 \n",
"\n",
" raw_text \\\n",
"0 The secret behind poor smartphone battery life... \n",
"1 On the run from Isis: Jihadists 'targeting Par... \n",
"2 Michelle Obama Goes Organic and Brings in the ... \n",
"3 Premiership stays on BBC The BBC has won the ... \n",
"4 Hollande says Paris attacks 'an act of war' by... \n",
"5 Power of top four concerns Keegan Keegan has ... \n",
"6 Not Out of The Woods Yet: Despite Progress, Eu... \n",
"7 How Google Used Motorola To Smack Down Samsung... \n",
"8 Samsung Waves away a million KOREAN ELECTRONI... \n",
"9 Behind François Hollande's Snap Decision at St... \n",
"10 Scudamore defends 'boring' League Premier Lea... \n",
"11 Samsung Galaxy S5 Active just got a 'Sport'-y ... \n",
"12 Criminals IN Government: Cyprus President's Fa... \n",
"13 Michelle Obama celebrates Chicago roots DENVE... \n",
"14 Michelle Obama, Rihanna Named To People's Best... \n",
"15 France Unsure if Raid Killed Top Suspect in Pa... \n",
"16 Samsung: Galaxy S5 sales stronger than Galaxy ... \n",
"17 Google Has Strangled The Innovation Out Of The... \n",
"18 Paris attacks: France mobilises 115,000 securi... \n",
"19 First Lady Michelle Obama When people ask Fir... \n",
"20 It's official - Tottenham have the worst defen... \n",
"21 Michelle Obama: Mom First, Political Wife Seco... \n",
"22 Though Obama Had to Leave to Find Himself, It ... \n",
"23 Samsung Galaxy S5 Active (AT&T) By Eugene Kim... \n",
"24 Flight 370 search area shifts after 'credible ... \n",
"25 Paris attacks were carried out by three groups... \n",
"26 Blues wrap up Torres deal Chelsea have compl... \n",
"27 Bring Back Our Girls: Michelle Obama and Malal... \n",
"28 France players praised for staying with German... \n",
"29 Australia agrees to lead search in Indian Ocea... \n",
".. ... \n",
"190 Samaras Takes Office as Greece's Prime Ministe... \n",
"191 Malaysia Airlines: experts surprised at disapp... \n",
"192 Stephen Hawking warns artificial intelligence ... \n",
"193 Pressure Loss Is Explored in Vanishing of Jetl... \n",
"194 NBC wins $250m rights to broadcast English Pre... \n",
"195 Turkey Says It Warned France Twice About Paris... \n",
"196 Flight MH370: former Australian defence chief ... \n",
"197 Seven Militants Led Deadly Paris Attacks Isla... \n",
"198 Vorm is man in form to save Swans There was... \n",
"199 Michelle Obama Dismisses Criticisms Michelle ... \n",
"200 1985: English teams banned after Heysel The F... \n",
"201 President Barack Obama Barack Obama is the 44t... \n",
"202 Malaysia Airlines Flight MH370: Oil slicks in ... \n",
"203 MH370: Malaysia declares flight disappearance ... \n",
"204 Top Soccer Leagues Get 25% Rise in TV Rights S... \n",
"205 Samsung's Galaxy S5 has an 'ultra power saving... \n",
"206 Michelle Obama Derided For Being A 'Feminist N... \n",
"207 Paris Terror Attacks: Yes, Parisians are traum... \n",
"208 Premiership in new £625m TV deal The winner o... \n",
"209 Man City beat Chelsea to Robinho Manchester C... \n",
"210 Samsung Galaxy S5 review: a solid improvement,... \n",
"211 Michelle Obama Shows Her Warmer Side on 'The V... \n",
"212 EU ministers order tighter border checks in re... \n",
"213 Michelle Obama's Book On Growing Seeds and Hea... \n",
"214 Samsung confirms fatal camera flaw on 'limited... \n",
"215 Michelle Obama Welcomes Gay Families to Nation... \n",
"216 Malaysia jet passengers likely suffocated, Aus... \n",
"217 Samsung Unveils New Products from its System L... \n",
"218 Investigators find no unusual signs among MH37... \n",
"219 Malaysia Airlines Flight 370: How much will fa... \n",
"\n",
" vw_text \n",
"0 smartphone.107 |@lemmatized secret behind poor... \n",
"1 ParisAttacks2015_(28) |@lemmatized run isi jih... \n",
"2 michelle.obama.103 |@lemmatized michelle obama... \n",
"3 premier.league.61 |@lemmatized premiership sta... \n",
"4 ParisAttacks2015_(10) |@lemmatized hollande sa... \n",
"5 premier.league.21 |@lemmatized power top four ... \n",
"6 debt.crisis.greece.263 |@lemmatized wood yet d... \n",
"7 samsung.galaxy.s5.30 |@lemmatized google use m... \n",
"8 smartphone.74 |@lemmatized samsung wave away m... \n",
"9 ParisAttacks2015_(17) |@lemmatized behind fran... \n",
"10 premier.league.22 |@lemmatized scudamore defen... \n",
"11 samsung.galaxy.s5.39 |@lemmatized samsung gala... \n",
"12 cypriot.financial.crisis.36 |@lemmatized crimi... \n",
"13 michelle.obama.80 |@lemmatized michelle obama ... \n",
"14 michelle.obama.123 |@lemmatized michelle obama... \n",
"15 ParisAttacks2015_(12) |@lemmatized france unsu... \n",
"16 samsung.galaxy.s5.42 |@lemmatized samsung gala... \n",
"17 samsung.galaxy.s5.29 |@lemmatized google stran... \n",
"18 ParisAttacks2015_(32) |@lemmatized paris attac... \n",
"19 michelle.obama.95 |@lemmatized first lady mich... \n",
"20 premier.league.89 |@lemmatized official totten... \n",
"21 michelle.obama.56 |@lemmatized michelle obama ... \n",
"22 barack.obama.3 |@lemmatized though obama leave... \n",
"23 samsung.galaxy.s5.38 |@lemmatized samsung gala... \n",
"24 malaysia.airlines.flight.86 |@lemmatized fligh... \n",
"25 ParisAttacks2015_(29) |@lemmatized paris attac... \n",
"26 premier.league.143 |@lemmatized blue wrap torr... \n",
"27 michelle.obama.102 |@lemmatized bring back gir... \n",
"28 ParisAttacks2015_(19) |@lemmatized france play... \n",
"29 malaysia.airlines.flight.16 |@lemmatized austr... \n",
".. ... \n",
"190 greek.elections.117 |@lemmatized samara take o... \n",
"191 malaysia.airlines.flight.34 |@lemmatized malay... \n",
"192 stephen.hawking.275 |@lemmatized stephen hawk ... \n",
"193 malaysia.airlines.flight.31 |@lemmatized press... \n",
"194 premier.league.79 |@lemmatized nbc win right b... \n",
"195 ParisAttacks2015_(14) |@lemmatized turkey say ... \n",
"196 malaysia.airlines.flight.142 |@lemmatized flig... \n",
"197 ParisAttacks2015_(7) |@lemmatized seven milita... \n",
"198 premier.league.92 |@lemmatized vorm man form s... \n",
"199 michelle.obama.86 |@lemmatized michelle obama ... \n",
"200 premier.league.9 |@lemmatized english team ban... \n",
"201 barack.obama.1 |@lemmatized president barack o... \n",
"202 malaysia.airlines.flight.10 |@lemmatized malay... \n",
"203 malaysia.airlines.flight.227 |@lemmatized mala... \n",
"204 premier.league.4 |@lemmatized top soccer leagu... \n",
"205 samsung.galaxy.s5.27 |@lemmatized samsung gala... \n",
"206 michelle.obama.100 |@lemmatized michelle obama... \n",
"207 ParisAttacks2015_(4) |@lemmatized paris terror... \n",
"208 premier.league.63 |@lemmatized premiership new... \n",
"209 premier.league.141 |@lemmatized man city beat ... \n",
"210 samsung.galaxy.s5.4 |@lemmatized samsung galax... \n",
"211 michelle.obama.75 |@lemmatized michelle obama ... \n",
"212 ParisAttacks2015_(25) |@lemmatized eu minister... \n",
"213 michelle.obama.109 |@lemmatized michelle obama... \n",
"214 samsung.galaxy.s5.13 |@lemmatized samsung conf... \n",
"215 michelle.obama.114 |@lemmatized michelle obama... \n",
"216 malaysia.airlines.flight.32 |@lemmatized malay... \n",
"217 samsung.galaxy.s5.22 |@lemmatized samsung unve... \n",
"218 malaysia.airlines.flight.143 |@lemmatized inve... \n",
"219 malaysia.airlines.flight.225 |@lemmatized mala... \n",
"\n",
"[220 rows x 3 columns]"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wiki_processed[['id', 'raw_text', 'vw_text']]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"id,raw_text,vw_text\r\n",
"smartphone.107,\"The secret behind poor smartphone battery life Summary:That shiny new smartphone has a battery that easily lasts all day. Then it all goes downhill from there Rapidly deteriorating battery life has long been tolerated by smartphone owners, mainly because they have no choice. Phones usually meet the holy grail of battery life, the ability to last all day, at first. Then it starts getting worse quickly, until many phone owners end up plugging in during the day. It seems it's always been this way, and there's no incentive to the smartphone makers to make this better. Battery has long been the focus of the mobile segment. In the early days of mobile the possible time away from a power outlet was not very long. This prompted OEMs to do what they could to make batteries in mobile devices last longer. This is why we now have decent battery life with most laptops and tablets. The eight hours needed to go all day no matter what comes up is now met by many mobile devices. Except the smartphone. Pick any smartphone in the top ranks and talk to those who've owned one for a while. Odds are, you'll hear a familiar tale — the phone easily lasted all day when new but that didn't last. If they've owned the phone over a year you'll probably hear about the antics they go through daily to have a phone that is still working at day's end. See related: Falling tablet sales: The problem is they're just too good | Necessary battery life for laptops: 8 hours So why hasn't smartphone battery life improved like that on tablets and laptops? I believe the reason is obvious — there is no incentive for OEMs to improve this. In fact, there's an incentive to keep things the way they've always been. In a recent article I explained that tablet owners aren't upgrading because current devices are good enough . There's no compelling reason for tablet owners to get the latest and greatest because the one they have is good enough. Good battery life is a big part of that satisfaction with tablets. Most of the top tablets get 10+ hours of battery life, and that's enough for just about everyone. Even over time when those tablet batteries start deteriorating, resulting in shorter battery life, they still last all day given the long life they start with when new. With smartphones it's a different story. Many are on the edge of all-day battery life to start, and they fall short as the battery ages. This is common. Take a stroll around the web and you'll find hundreds of articles with tips for \"\"how to extend the battery on gadget X\"\". Owners are trying to get through the day with a smartphone that's only a year old, and they'll do anything to make that happen. That includes trading in that phone when their US contract is up. I believe it's not just a hankering for the latest shiny smartphone available, it's also to get rid of their old one. They know from experience that their battery life issue will go away with a new phone, due to that new battery inside. This is why there is no incentive for smartphone makers to come up with a new battery technology with the same improvements we've seen in laptops and tablets. They need that two-year replacement cycle the phone contracts push, and the dying battery syndrome fuels that upgrade process. I'm not suggesting there's some hidden conspiracy behind the smartphone battery situation. I am pointing out that from a business perspective there is no incentive for smartphone makers to improve battery life as they have on other mobile devices. They are happy when you trade that phone in for a new one. They just hope you don't figure out what they are doing. If something's not broken, why fix it?\",smartphone.107 |@lemmatized secret:1 behind:2 poor:1 smartphone:12 battery:22 life:13 summary:1 shiny:2 new:7 easily:2 last:6 day:10 go:4 downhill:1 rapidly:1 deteriorate:2 long:4 tolerate:1 owner:5 mainly:1 choice:1 phone:9 usually:1 meet:2 holy:1 grail:1 ability:1 first:1 start:4 get:5 worse:1 quickly:1 many:3 end:2 plug:1 seem:1 always:2 way:2 incentive:5 maker:3 make:3 good:5 focus:1 mobile:5 segment:1 early:1 possible:1 time:2 away:2 power:1 outlet:1 prompt:1 oems:2 could:1 device:4 longer:1 decent:1 laptop:4 tablet:9 eight:1 hour:3 need:2 matter:1 come:2 except:1 pick:1 top:2 rank:1 talk:1 one:4 odds:1 hear:2 familiar:1 tale:1 year:3 probably:1 antic:1 daily:1 still:2 work:1 see:2 related:1 fall:2 sale:1 problem:1 necessary:1 improve:3 like:1 believe:2 reason:2 obvious:1 fact:1 keep:1 thing:1 recent:1 article:2 explain:1 upgrading:1 current:1 enough:3 compelling:1 late:2 great:1 big:1 part:1 satisfaction:1 everyone:1 even:1 result:1 shorter:1 give:1 smartphones:1 different:1 story:1 edge:1 short:1 age:1 common:1 take:1 stroll:1 around:1 web:1 find:1 hundred:1 tip:1 extend:1 gadget:1 x:1 try:1 old:2 anything:1 happen:1 include:1 trading:1 u:1 contract:2 hankering:1 available:1 also:1 rid:1 know:1 experience:1 issue:1 due:1 inside:1 technology:1 improvement:1 two:1 replacement:1 cycle:1 push:1 die:1 syndrome:1 fuel:1 upgrade:1 process:1 suggest:1 hidden:1 conspiracy:1 situation:1 point:1 business:1 perspective:1 happy:1 trade:1 hope:1 figure:1 something:1 break:1 fix:1 |@ngramms battery_life:12 smartphone_battery:2 smartphone_owner:1 phone_owner:1 smartphone_maker:3 good_battery:1 long_focus:1 early_day:1 mobile_device:3 day_matter:1 give_long:1 life_start:1 happen_include:1\r\n"
]
}
],
"source": [
"! head wiki_ref220_bow.csv -n 2"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"id,raw_text,vw_text\r\n",
"smartphone.107,\"The secret behind poor smartphone battery life Summary:That shiny new smartphone has a battery that easily lasts all day. Then it all goes downhill from there Rapidly deteriorating battery life has long been tolerated by smartphone owners, mainly because they have no choice. Phones usually meet the holy grail of battery life, the ability to last all day, at first. Then it starts getting worse quickly, until many phone owners end up plugging in during the day. It seems it's always been this way, and there's no incentive to the smartphone makers to make this better. Battery has long been the focus of the mobile segment. In the early days of mobile the possible time away from a power outlet was not very long. This prompted OEMs to do what they could to make batteries in mobile devices last longer. This is why we now have decent battery life with most laptops and tablets. The eight hours needed to go all day no matter what comes up is now met by many mobile devices. Except the smartphone. Pick any smartphone in the top ranks and talk to those who've owned one for a while. Odds are, you'll hear a familiar tale — the phone easily lasted all day when new but that didn't last. If they've owned the phone over a year you'll probably hear about the antics they go through daily to have a phone that is still working at day's end. See related: Falling tablet sales: The problem is they're just too good | Necessary battery life for laptops: 8 hours So why hasn't smartphone battery life improved like that on tablets and laptops? I believe the reason is obvious — there is no incentive for OEMs to improve this. In fact, there's an incentive to keep things the way they've always been. In a recent article I explained that tablet owners aren't upgrading because current devices are good enough . There's no compelling reason for tablet owners to get the latest and greatest because the one they have is good enough. Good battery life is a big part of that satisfaction with tablets. Most of the top tablets get 10+ hours of battery life, and that's enough for just about everyone. Even over time when those tablet batteries start deteriorating, resulting in shorter battery life, they still last all day given the long life they start with when new. With smartphones it's a different story. Many are on the edge of all-day battery life to start, and they fall short as the battery ages. This is common. Take a stroll around the web and you'll find hundreds of articles with tips for \"\"how to extend the battery on gadget X\"\". Owners are trying to get through the day with a smartphone that's only a year old, and they'll do anything to make that happen. That includes trading in that phone when their US contract is up. I believe it's not just a hankering for the latest shiny smartphone available, it's also to get rid of their old one. They know from experience that their battery life issue will go away with a new phone, due to that new battery inside. This is why there is no incentive for smartphone makers to come up with a new battery technology with the same improvements we've seen in laptops and tablets. They need that two-year replacement cycle the phone contracts push, and the dying battery syndrome fuels that upgrade process. I'm not suggesting there's some hidden conspiracy behind the smartphone battery situation. I am pointing out that from a business perspective there is no incentive for smartphone makers to improve battery life as they have on other mobile devices. They are happy when you trade that phone in for a new one. They just hope you don't figure out what they are doing. If something's not broken, why fix it?\",smartphone.107 |@lemmatized secret behind poor smartphone battery life summary shiny new smartphone battery easily last day go downhill rapidly deteriorate battery life long tolerate smartphone owner mainly choice phone usually meet holy grail battery life ability last day first start get worse quickly many phone owner end plug day seem always way incentive smartphone maker make good battery long focus mobile segment early day mobile possible time away power outlet long prompt oems could make battery mobile device last longer decent battery life laptop tablet eight hour need go day matter come meet many mobile device except smartphone pick smartphone top rank talk one odds hear familiar tale phone easily last day new last phone year probably hear antic go daily phone still work day end see related fall tablet sale problem good necessary battery life laptop hour smartphone battery life improve like tablet laptop believe reason obvious incentive oems improve fact incentive keep thing way always recent article explain tablet owner upgrading current device good enough compelling reason tablet owner get late great one good enough good battery life big part satisfaction tablet top tablet get hour battery life enough everyone even time tablet battery start deteriorate result shorter battery life still last day give long life start new smartphones different story many edge day battery life start fall short battery age common take stroll around web find hundred article tip extend battery gadget x owner try get day smartphone year old anything make happen include trading phone u contract believe hankering late shiny smartphone available also get rid old one know experience battery life issue go away new phone due new battery inside incentive smartphone maker come new battery technology improvement see laptop tablet need two year replacement cycle phone contract push die battery syndrome fuel upgrade process suggest hidden conspiracy behind smartphone battery situation point business perspective incentive smartphone maker improve battery life mobile device happy trade phone new one hope figure something break fix |@ngramms battery_life battery_life battery_life battery_life battery_life battery_life battery_life battery_life battery_life battery_life battery_life battery_life smartphone_battery smartphone_battery smartphone_owner phone_owner smartphone_maker smartphone_maker smartphone_maker good_battery long_focus early_day mobile_device mobile_device mobile_device day_matter give_long life_start happen_include\r\n"
]
}
],
"source": [
"! head wiki_ref220_natural_order.csv -n 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|