jupyter notebook upload
Browse files- Untitled.ipynb +415 -0
Untitled.ipynb
ADDED
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 2,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import pandas as pd\n",
|
10 |
+
"import os\n",
|
11 |
+
"import random\n",
|
12 |
+
"from sklearn.model_selection import train_test_split\n",
|
13 |
+
"from tqdm import tqdm"
|
14 |
+
]
|
15 |
+
},
|
16 |
+
{
|
17 |
+
"cell_type": "code",
|
18 |
+
"execution_count": 3,
|
19 |
+
"metadata": {},
|
20 |
+
"outputs": [],
|
21 |
+
"source": [
|
22 |
+
"def get_text_lists(filenames):\n",
|
23 |
+
" text_list = []\n",
|
24 |
+
" text_list_clean = []\n",
|
25 |
+
" for filename in filenames:\n",
|
26 |
+
" with open(filename,'r') as file:\n",
|
27 |
+
" data = file.read()\n",
|
28 |
+
" text_list = text_list + (data.split(\"<EOS>\"))\n",
|
29 |
+
" \n",
|
30 |
+
" for text in text_list:\n",
|
31 |
+
" #remove trailing ugly things at end of strings\n",
|
32 |
+
" text = text[0:text.find(\"EmbedShare\")]\n",
|
33 |
+
" text_list_clean.append(text)\n",
|
34 |
+
" return text_list_clean"
|
35 |
+
]
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"cell_type": "code",
|
39 |
+
"execution_count": 5,
|
40 |
+
"metadata": {},
|
41 |
+
"outputs": [
|
42 |
+
{
|
43 |
+
"ename": "FileNotFoundError",
|
44 |
+
"evalue": "[Errno 2] No such file or directory: 'novireperi.txt'",
|
45 |
+
"output_type": "error",
|
46 |
+
"traceback": [
|
47 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
48 |
+
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
|
49 |
+
"\u001b[0;32m<ipython-input-5-974cc4a9f270>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m text_list = get_text_lists([\"Lilgpt.txt\", \"ye.txt\", \"zenske.txt\", \"flowmasteri.txt\",\n\u001b[0;32m----> 2\u001b[0;31m \"wutang.txt\", \"novireperi.txt\", \"novireperi2.txt\", \"novireperi3.txt\", \"OF.txt\"])\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtext_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
50 |
+
"\u001b[0;32m<ipython-input-3-81b6d230f518>\u001b[0m in \u001b[0;36mget_text_lists\u001b[0;34m(filenames)\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mtext_list_clean\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mfilename\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mfilenames\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'r'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mfile\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfile\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mtext_list\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtext_list\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"<EOS>\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
51 |
+
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'novireperi.txt'"
|
52 |
+
]
|
53 |
+
}
|
54 |
+
],
|
55 |
+
"source": [
|
56 |
+
"text_list = get_text_lists([\"Lilgpt.txt\", \"ye.txt\", \"zenske.txt\", \"flowmasteri.txt\",\n",
|
57 |
+
" \"wutang.txt\", \"novireperi.txt\", \"novireperi2.txt\", \"novireperi3.txt\", \"OF.txt\"])\n",
|
58 |
+
"print(len(text_list))"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
{
|
62 |
+
"cell_type": "code",
|
63 |
+
"execution_count": 4,
|
64 |
+
"metadata": {
|
65 |
+
"scrolled": true
|
66 |
+
},
|
67 |
+
"outputs": [
|
68 |
+
{
|
69 |
+
"name": "stdout",
|
70 |
+
"output_type": "stream",
|
71 |
+
"text": [
|
72 |
+
"<BOS>3 Headed Goat[Intro]\n",
|
73 |
+
"(Aviator)\n",
|
74 |
+
"[Chorus: Lil Baby]\n",
|
75 |
+
"These ain't no Guess jeans\n",
|
76 |
+
"I dropped out of school, I'm still good at math, but, nigga, don't test me\n",
|
77 |
+
"I played to the left, they went to the right, they tried to finesse me\n",
|
78 |
+
"Still riding 'round with that blicky, I hope they don't catch me\n",
|
79 |
+
"Police had raided our spot, so we went to the next street\n",
|
80 |
+
"Play like I'm dumb, as soon as it pop, I'm goin' retarded\n",
|
81 |
+
"He say I'm hard and he say I'm garbage, I'm rich regardless\n",
|
82 |
+
"We in Miami in the middle of the winter, and we on them jet skis\n",
|
83 |
+
"If we in Atlanta, I'm runnin' the 'Cat and I'm workin' the red key\n",
|
84 |
+
"[Verse 1: Lil Durk]\n",
|
85 |
+
"I cannot mention my homies inside of my song 'cause I know they be trappin' a lot\n",
|
86 |
+
"I can't keep takin' these pills, when I'm in the trenches, they say I be cappin' a lot\n",
|
87 |
+
"I know a nigga who say he got rich off the dope, but I know he be actin' a lot\n",
|
88 |
+
"I know some niggas who said that they took down the city, but niggas be lackin' a lot\n",
|
89 |
+
"Yeah\n",
|
90 |
+
"That shit was awful, nigga had that dog food\n",
|
91 |
+
"That day they shot you, I slid on a Mongoose\n",
|
92 |
+
"You cannot come back around me, you turned your back on me, I cannot forget\n",
|
93 |
+
"The police was lyin', they say that they caught you, but nigga, they made you admit\n",
|
94 |
+
"Your name was found, you put in that work, they took your stick, you a bitch\n",
|
95 |
+
"Fuck my opps, they be on my dick, they all be mad we rich (Turn up)\n",
|
96 |
+
"[Verse 2: Lil Baby]\n",
|
97 |
+
"Only twenty-five, livin' like a boss, ridin' 'round with a chauffeur\n",
|
98 |
+
"I don't sell drugs, still be paranoid, keep lookin' over my shoulder\n",
|
99 |
+
"Niggas lyin' like I'm stealin' swag, boy, that's my shit like I wrote it\n",
|
100 |
+
"[Verse 3: Polo G]\n",
|
101 |
+
"Uh\n",
|
102 |
+
"These rappers really nice as hell\n",
|
103 |
+
"I'm a different nigga when I'm pissed off\n",
|
104 |
+
"Man, he say he gon' press up on who?\n",
|
105 |
+
"I'ma get the steel like I'm Chris Paul\n",
|
106 |
+
"Back to back suburbans, I'm a big dawg\n",
|
107 |
+
"I was in the slums servin' Fentanyl\n",
|
108 |
+
"Zombieland, junkies havin' withdrawals\n",
|
109 |
+
"I been gettin' to it, lotta missed calls\n",
|
110 |
+
"Turn it off, what the fuck is he talking 'bout?\n",
|
111 |
+
"I should slap you for sayin' he hot as me\n",
|
112 |
+
"I don't know who could fuck with me honestly\n",
|
113 |
+
"They know I'm the man, so they watchin' me\n",
|
114 |
+
"Different color bands like Monopoly\n",
|
115 |
+
"Man, he must not be usin' his head\n",
|
116 |
+
"If he thinkin' I don't keep a Glock with me\n",
|
117 |
+
"That's like suicide if you play with us\n",
|
118 |
+
"Got a better chance at the lottery\n",
|
119 |
+
"Call an ambulance when that chopper sweep\n",
|
120 |
+
"Make the crowd dance, choreography\n",
|
121 |
+
"Once I got a plan, ain't no stoppin' me\n",
|
122 |
+
"Three-car garage, million-dollar crib\n",
|
123 |
+
"With a foreign bitch ridin' on top of me\n",
|
124 |
+
"Lot of people done said I wouldn't be shit\n",
|
125 |
+
"Well, I guess they owe me an apology\n",
|
126 |
+
"[Chorus: Lil Baby]\n",
|
127 |
+
"These ain't no Guess jeans\n",
|
128 |
+
"I dropped out of school, I'm still good at math, but, nigga, don't test me\n",
|
129 |
+
"I played to the left, they went to the right, they tried to finesse me\n",
|
130 |
+
"Still riding 'round with that blicky, I hope they don't catch me\n",
|
131 |
+
"Police had raided our spot, so we went to the next street\n",
|
132 |
+
"Play like I'm dumb, as soon as it pop, I'm goin' retarded\n",
|
133 |
+
"He say I'm hard and he say I'm garbage, I'm rich regardless\n",
|
134 |
+
"We in Miami in the middle of the winter, and we on them jet skis\n",
|
135 |
+
"If we in Atlanta, I'm runnin' the 'Cat and I'm workin' the red key35<EOS>\n"
|
136 |
+
]
|
137 |
+
}
|
138 |
+
],
|
139 |
+
"source": [
|
140 |
+
"new_list = []\n",
|
141 |
+
"for l in text_list:\n",
|
142 |
+
" n = l\n",
|
143 |
+
" n = n.replace(\"<BOS>\",\"\")\n",
|
144 |
+
" n = os.linesep.join([s for s in n.splitlines() if s])\n",
|
145 |
+
" n = \"<BOS>\"+ n + \"<EOS>\"\n",
|
146 |
+
" new_list.append(n)"
|
147 |
+
]
|
148 |
+
},
|
149 |
+
{
|
150 |
+
"cell_type": "code",
|
151 |
+
"execution_count": 10,
|
152 |
+
"metadata": {},
|
153 |
+
"outputs": [
|
154 |
+
{
|
155 |
+
"name": "stdout",
|
156 |
+
"output_type": "stream",
|
157 |
+
"text": [
|
158 |
+
"1287\n",
|
159 |
+
"11583\n"
|
160 |
+
]
|
161 |
+
}
|
162 |
+
],
|
163 |
+
"source": [
|
164 |
+
"List_train, List_val = train_test_split(new_list, test_size = 0.1, random_state = 420)\n",
|
165 |
+
"print(len(List_val))\n",
|
166 |
+
"print(len(List_train))"
|
167 |
+
]
|
168 |
+
},
|
169 |
+
{
|
170 |
+
"cell_type": "code",
|
171 |
+
"execution_count": 11,
|
172 |
+
"metadata": {},
|
173 |
+
"outputs": [
|
174 |
+
{
|
175 |
+
"name": "stderr",
|
176 |
+
"output_type": "stream",
|
177 |
+
"text": [
|
178 |
+
"100%|█████████████████████████████████████| 1286/1286 [00:01<00:00, 1215.57it/s]\n"
|
179 |
+
]
|
180 |
+
}
|
181 |
+
],
|
182 |
+
"source": [
|
183 |
+
"val_set = List_val[0]\n",
|
184 |
+
"for i in tqdm(range(1,len(List_val))):\n",
|
185 |
+
" val_set = val_set+\"\\n\\n\"+ List_val[i]"
|
186 |
+
]
|
187 |
+
},
|
188 |
+
{
|
189 |
+
"cell_type": "code",
|
190 |
+
"execution_count": 12,
|
191 |
+
"metadata": {},
|
192 |
+
"outputs": [
|
193 |
+
{
|
194 |
+
"name": "stderr",
|
195 |
+
"output_type": "stream",
|
196 |
+
"text": [
|
197 |
+
"100%|█████████████████████████████████████| 11582/11582 [05:06<00:00, 37.77it/s]\n"
|
198 |
+
]
|
199 |
+
}
|
200 |
+
],
|
201 |
+
"source": [
|
202 |
+
"train_set = List_train[0]\n",
|
203 |
+
"for i in tqdm(range(1,len(List_train))):\n",
|
204 |
+
" train_set = train_set+\"\\n\\n\"+List_train[i]"
|
205 |
+
]
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"cell_type": "code",
|
209 |
+
"execution_count": 13,
|
210 |
+
"metadata": {},
|
211 |
+
"outputs": [],
|
212 |
+
"source": [
|
213 |
+
"file1 = open(\"train2.txt\",\"w+\")\n",
|
214 |
+
"file1.write(train_set)\n",
|
215 |
+
"file1.close()"
|
216 |
+
]
|
217 |
+
},
|
218 |
+
{
|
219 |
+
"cell_type": "code",
|
220 |
+
"execution_count": 14,
|
221 |
+
"metadata": {},
|
222 |
+
"outputs": [],
|
223 |
+
"source": [
|
224 |
+
"file2 = open(\"val2.txt\",\"w+\")\n",
|
225 |
+
"file2.write(val_set)\n",
|
226 |
+
"file2.close()"
|
227 |
+
]
|
228 |
+
},
|
229 |
+
{
|
230 |
+
"cell_type": "code",
|
231 |
+
"execution_count": 15,
|
232 |
+
"metadata": {},
|
233 |
+
"outputs": [
|
234 |
+
{
|
235 |
+
"data": {
|
236 |
+
"text/html": [
|
237 |
+
"<div>\n",
|
238 |
+
"<style scoped>\n",
|
239 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
240 |
+
" vertical-align: middle;\n",
|
241 |
+
" }\n",
|
242 |
+
"\n",
|
243 |
+
" .dataframe tbody tr th {\n",
|
244 |
+
" vertical-align: top;\n",
|
245 |
+
" }\n",
|
246 |
+
"\n",
|
247 |
+
" .dataframe thead th {\n",
|
248 |
+
" text-align: right;\n",
|
249 |
+
" }\n",
|
250 |
+
"</style>\n",
|
251 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
252 |
+
" <thead>\n",
|
253 |
+
" <tr style=\"text-align: right;\">\n",
|
254 |
+
" <th></th>\n",
|
255 |
+
" <th>Songs</th>\n",
|
256 |
+
" </tr>\n",
|
257 |
+
" </thead>\n",
|
258 |
+
" <tbody>\n",
|
259 |
+
" <tr>\n",
|
260 |
+
" <th>0</th>\n",
|
261 |
+
" <td><BOS>Night CourtBehind door one:\\nThere's thre...</td>\n",
|
262 |
+
" </tr>\n",
|
263 |
+
" <tr>\n",
|
264 |
+
" <th>1</th>\n",
|
265 |
+
" <td><BOS>Golden ArmsYeah, yeah\\nYeah, yeah\\n[Verse...</td>\n",
|
266 |
+
" </tr>\n",
|
267 |
+
" <tr>\n",
|
268 |
+
" <th>2</th>\n",
|
269 |
+
" <td><BOS>Flashing Lights (Clipse Remix)[Intro]\\nWe...</td>\n",
|
270 |
+
" </tr>\n",
|
271 |
+
" <tr>\n",
|
272 |
+
" <th>3</th>\n",
|
273 |
+
" <td><BOS>Lights Camera Action[Intro]\\nThe lights, ...</td>\n",
|
274 |
+
" </tr>\n",
|
275 |
+
" <tr>\n",
|
276 |
+
" <th>4</th>\n",
|
277 |
+
" <td><BOS>Thug Life [Souljah] (Original Version 1)[...</td>\n",
|
278 |
+
" </tr>\n",
|
279 |
+
" </tbody>\n",
|
280 |
+
"</table>\n",
|
281 |
+
"</div>"
|
282 |
+
],
|
283 |
+
"text/plain": [
|
284 |
+
" Songs\n",
|
285 |
+
"0 <BOS>Night CourtBehind door one:\\nThere's thre...\n",
|
286 |
+
"1 <BOS>Golden ArmsYeah, yeah\\nYeah, yeah\\n[Verse...\n",
|
287 |
+
"2 <BOS>Flashing Lights (Clipse Remix)[Intro]\\nWe...\n",
|
288 |
+
"3 <BOS>Lights Camera Action[Intro]\\nThe lights, ...\n",
|
289 |
+
"4 <BOS>Thug Life [Souljah] (Original Version 1)[..."
|
290 |
+
]
|
291 |
+
},
|
292 |
+
"execution_count": 15,
|
293 |
+
"metadata": {},
|
294 |
+
"output_type": "execute_result"
|
295 |
+
}
|
296 |
+
],
|
297 |
+
"source": [
|
298 |
+
"df_train = pd.DataFrame(List_train,columns = [\"Songs\"])\n",
|
299 |
+
"df_train.head()"
|
300 |
+
]
|
301 |
+
},
|
302 |
+
{
|
303 |
+
"cell_type": "code",
|
304 |
+
"execution_count": 16,
|
305 |
+
"metadata": {},
|
306 |
+
"outputs": [
|
307 |
+
{
|
308 |
+
"data": {
|
309 |
+
"text/html": [
|
310 |
+
"<div>\n",
|
311 |
+
"<style scoped>\n",
|
312 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
313 |
+
" vertical-align: middle;\n",
|
314 |
+
" }\n",
|
315 |
+
"\n",
|
316 |
+
" .dataframe tbody tr th {\n",
|
317 |
+
" vertical-align: top;\n",
|
318 |
+
" }\n",
|
319 |
+
"\n",
|
320 |
+
" .dataframe thead th {\n",
|
321 |
+
" text-align: right;\n",
|
322 |
+
" }\n",
|
323 |
+
"</style>\n",
|
324 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
325 |
+
" <thead>\n",
|
326 |
+
" <tr style=\"text-align: right;\">\n",
|
327 |
+
" <th></th>\n",
|
328 |
+
" <th>Songs</th>\n",
|
329 |
+
" </tr>\n",
|
330 |
+
" </thead>\n",
|
331 |
+
" <tbody>\n",
|
332 |
+
" <tr>\n",
|
333 |
+
" <th>0</th>\n",
|
334 |
+
" <td><BOS>Letter 2 My Unborn[Intro]\\nTo my unborn c...</td>\n",
|
335 |
+
" </tr>\n",
|
336 |
+
" <tr>\n",
|
337 |
+
" <th>1</th>\n",
|
338 |
+
" <td><BOS>Trouble[Intro]\\nTrouble on last, oh well\\...</td>\n",
|
339 |
+
" </tr>\n",
|
340 |
+
" <tr>\n",
|
341 |
+
" <th>2</th>\n",
|
342 |
+
" <td><BOS>SouthsideSu woo\\nBitch I'm from the south...</td>\n",
|
343 |
+
" </tr>\n",
|
344 |
+
" <tr>\n",
|
345 |
+
" <th>3</th>\n",
|
346 |
+
" <td><BOS>Gangsta PartyFeat. Lil B\\n[Lil Wayne]\\nI ...</td>\n",
|
347 |
+
" </tr>\n",
|
348 |
+
" <tr>\n",
|
349 |
+
" <th>4</th>\n",
|
350 |
+
" <td><BOS>Gangstaz Life[Verse 1: Snoop Dogg]\\n10-20...</td>\n",
|
351 |
+
" </tr>\n",
|
352 |
+
" </tbody>\n",
|
353 |
+
"</table>\n",
|
354 |
+
"</div>"
|
355 |
+
],
|
356 |
+
"text/plain": [
|
357 |
+
" Songs\n",
|
358 |
+
"0 <BOS>Letter 2 My Unborn[Intro]\\nTo my unborn c...\n",
|
359 |
+
"1 <BOS>Trouble[Intro]\\nTrouble on last, oh well\\...\n",
|
360 |
+
"2 <BOS>SouthsideSu woo\\nBitch I'm from the south...\n",
|
361 |
+
"3 <BOS>Gangsta PartyFeat. Lil B\\n[Lil Wayne]\\nI ...\n",
|
362 |
+
"4 <BOS>Gangstaz Life[Verse 1: Snoop Dogg]\\n10-20..."
|
363 |
+
]
|
364 |
+
},
|
365 |
+
"execution_count": 16,
|
366 |
+
"metadata": {},
|
367 |
+
"output_type": "execute_result"
|
368 |
+
}
|
369 |
+
],
|
370 |
+
"source": [
|
371 |
+
"df_val = pd.DataFrame(List_val,columns = [\"Songs\"])\n",
|
372 |
+
"df_val.head()"
|
373 |
+
]
|
374 |
+
},
|
375 |
+
{
|
376 |
+
"cell_type": "code",
|
377 |
+
"execution_count": 17,
|
378 |
+
"metadata": {},
|
379 |
+
"outputs": [],
|
380 |
+
"source": [
|
381 |
+
"df_train.to_csv(\"Train.tsv\",sep=\"\\t\",index = False)"
|
382 |
+
]
|
383 |
+
},
|
384 |
+
{
|
385 |
+
"cell_type": "code",
|
386 |
+
"execution_count": 18,
|
387 |
+
"metadata": {},
|
388 |
+
"outputs": [],
|
389 |
+
"source": [
|
390 |
+
"df_val.to_csv(\"Val.tsv\",sep=\"\\t\",index = False)"
|
391 |
+
]
|
392 |
+
}
|
393 |
+
],
|
394 |
+
"metadata": {
|
395 |
+
"kernelspec": {
|
396 |
+
"display_name": "Python 3",
|
397 |
+
"language": "python",
|
398 |
+
"name": "python3"
|
399 |
+
},
|
400 |
+
"language_info": {
|
401 |
+
"codemirror_mode": {
|
402 |
+
"name": "ipython",
|
403 |
+
"version": 3
|
404 |
+
},
|
405 |
+
"file_extension": ".py",
|
406 |
+
"mimetype": "text/x-python",
|
407 |
+
"name": "python",
|
408 |
+
"nbconvert_exporter": "python",
|
409 |
+
"pygments_lexer": "ipython3",
|
410 |
+
"version": "3.6.9"
|
411 |
+
}
|
412 |
+
},
|
413 |
+
"nbformat": 4,
|
414 |
+
"nbformat_minor": 5
|
415 |
+
}
|