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