Skip to content

Commit a7dace0

Browse files
committed
Update Simple Text Mining concept and practice from scratch.ipynb
error_load_data
1 parent 9f6c0db commit a7dace0

File tree

1 file changed

+20
-101
lines changed

1 file changed

+20
-101
lines changed

GeneralML/TextModel/Simple Text Mining concept and practice from scratch.ipynb

+20-101
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 5,
53+
"execution_count": 1,
5454
"metadata": {},
5555
"outputs": [],
5656
"source": [
@@ -81,7 +81,7 @@
8181
},
8282
{
8383
"cell_type": "code",
84-
"execution_count": 6,
84+
"execution_count": 2,
8585
"metadata": {},
8686
"outputs": [],
8787
"source": [
@@ -90,106 +90,25 @@
9090
},
9191
{
9292
"cell_type": "code",
93-
"execution_count": 9,
93+
"execution_count": 3,
9494
"metadata": {},
9595
"outputs": [
9696
{
97-
"data": {
98-
"text/html": [
99-
"<div>\n",
100-
"<style scoped>\n",
101-
" .dataframe tbody tr th:only-of-type {\n",
102-
" vertical-align: middle;\n",
103-
" }\n",
104-
"\n",
105-
" .dataframe tbody tr th {\n",
106-
" vertical-align: top;\n",
107-
" }\n",
108-
"\n",
109-
" .dataframe thead th {\n",
110-
" text-align: right;\n",
111-
" }\n",
112-
"</style>\n",
113-
"<table border=\"1\" class=\"dataframe\">\n",
114-
" <thead>\n",
115-
" <tr style=\"text-align: right;\">\n",
116-
" <th></th>\n",
117-
" <th>review</th>\n",
118-
" <th>sentiment</th>\n",
119-
" </tr>\n",
120-
" </thead>\n",
121-
" <tbody>\n",
122-
" <tr>\n",
123-
" <th>0</th>\n",
124-
" <td>One of the other reviewers has mentioned that ...</td>\n",
125-
" <td>positive</td>\n",
126-
" </tr>\n",
127-
" <tr>\n",
128-
" <th>1</th>\n",
129-
" <td>A wonderful little production. &lt;br /&gt;&lt;br /&gt;The...</td>\n",
130-
" <td>positive</td>\n",
131-
" </tr>\n",
132-
" <tr>\n",
133-
" <th>2</th>\n",
134-
" <td>I thought this was a wonderful way to spend ti...</td>\n",
135-
" <td>positive</td>\n",
136-
" </tr>\n",
137-
" <tr>\n",
138-
" <th>3</th>\n",
139-
" <td>Basically there's a family where a little boy ...</td>\n",
140-
" <td>negative</td>\n",
141-
" </tr>\n",
142-
" <tr>\n",
143-
" <th>4</th>\n",
144-
" <td>Petter Mattei's \"Love in the Time of Money\" is...</td>\n",
145-
" <td>positive</td>\n",
146-
" </tr>\n",
147-
" <tr>\n",
148-
" <th>5</th>\n",
149-
" <td>Probably my all-time favorite movie, a story o...</td>\n",
150-
" <td>positive</td>\n",
151-
" </tr>\n",
152-
" <tr>\n",
153-
" <th>6</th>\n",
154-
" <td>I sure would like to see a resurrection of a u...</td>\n",
155-
" <td>positive</td>\n",
156-
" </tr>\n",
157-
" <tr>\n",
158-
" <th>7</th>\n",
159-
" <td>This show was an amazing, fresh &amp; innovative i...</td>\n",
160-
" <td>negative</td>\n",
161-
" </tr>\n",
162-
" <tr>\n",
163-
" <th>8</th>\n",
164-
" <td>Encouraged by the positive comments about this...</td>\n",
165-
" <td>negative</td>\n",
166-
" </tr>\n",
167-
" <tr>\n",
168-
" <th>9</th>\n",
169-
" <td>If you like original gut wrenching laughter yo...</td>\n",
170-
" <td>positive</td>\n",
171-
" </tr>\n",
172-
" </tbody>\n",
173-
"</table>\n",
174-
"</div>"
175-
],
176-
"text/plain": [
177-
" review sentiment\n",
178-
"0 One of the other reviewers has mentioned that ... positive\n",
179-
"1 A wonderful little production. <br /><br />The... positive\n",
180-
"2 I thought this was a wonderful way to spend ti... positive\n",
181-
"3 Basically there's a family where a little boy ... negative\n",
182-
"4 Petter Mattei's \"Love in the Time of Money\" is... positive\n",
183-
"5 Probably my all-time favorite movie, a story o... positive\n",
184-
"6 I sure would like to see a resurrection of a u... positive\n",
185-
"7 This show was an amazing, fresh & innovative i... negative\n",
186-
"8 Encouraged by the positive comments about this... negative\n",
187-
"9 If you like original gut wrenching laughter yo... positive"
188-
]
189-
},
190-
"execution_count": 9,
191-
"metadata": {},
192-
"output_type": "execute_result"
97+
"output_type": "error",
98+
"ename": "FileNotFoundError",
99+
"evalue": "[Errno 2] No such file or directory: 'C:\\\\Users\\\\bokhy\\\\Desktop\\\\Python\\\\github\\\\Python-Projects\\\\IMDB Dataset.csv'",
100+
"traceback": [
101+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
102+
"\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
103+
"\u001b[1;32m<ipython-input-3-0e7fea6ff092>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mreview\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpath\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'IMDB Dataset.csv'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mengine\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"python\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[0mreview\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhead\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
104+
"\u001b[1;32m~\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36mparser_f\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)\u001b[0m\n\u001b[0;32m 674\u001b[0m )\n\u001b[0;32m 675\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 676\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0m_read\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkwds\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 677\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 678\u001b[0m \u001b[0mparser_f\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__name__\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
105+
"\u001b[1;32m~\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m_read\u001b[1;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[0;32m 446\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 447\u001b[0m \u001b[1;31m# Create the parser.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 448\u001b[1;33m \u001b[0mparser\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mTextFileReader\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfp_or_buf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwds\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 449\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 450\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mchunksize\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0miterator\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
106+
"\u001b[1;32m~\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, f, engine, **kwds)\u001b[0m\n\u001b[0;32m 878\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0moptions\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"has_index_names\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mkwds\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"has_index_names\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 879\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 880\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_make_engine\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mengine\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 881\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 882\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mclose\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
107+
"\u001b[1;32m~\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m_make_engine\u001b[1;34m(self, engine)\u001b[0m\n\u001b[0;32m 1124\u001b[0m \u001b[1;34m'\"python-fwf\")'\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1125\u001b[0m )\n\u001b[1;32m-> 1126\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mklass\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0moptions\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1127\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1128\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_failover_to_python\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
108+
"\u001b[1;32m~\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, f, **kwds)\u001b[0m\n\u001b[0;32m 2267\u001b[0m \u001b[0mencoding\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mencoding\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2268\u001b[0m \u001b[0mcompression\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcompression\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2269\u001b[1;33m \u001b[0mmemory_map\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmemory_map\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2270\u001b[0m )\n\u001b[0;32m 2271\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhandles\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mhandles\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
109+
"\u001b[1;32m~\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\io\\common.py\u001b[0m in \u001b[0;36mget_handle\u001b[1;34m(path_or_buf, mode, encoding, compression, memory_map, is_text)\u001b[0m\n\u001b[0;32m 456\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mis_text\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 457\u001b[0m \u001b[1;31m# No explicit encoding\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 458\u001b[1;33m \u001b[0mf\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpath_or_buf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"replace\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnewline\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 459\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 460\u001b[0m \u001b[1;31m# Binary mode\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
110+
"\u001b[1;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'C:\\\\Users\\\\bokhy\\\\Desktop\\\\Python\\\\github\\\\Python-Projects\\\\IMDB Dataset.csv'"
111+
]
193112
}
194113
],
195114
"source": [
@@ -1973,9 +1892,9 @@
19731892
"name": "python",
19741893
"nbconvert_exporter": "python",
19751894
"pygments_lexer": "ipython3",
1976-
"version": "3.7.6"
1895+
"version": "3.7.6-final"
19771896
}
19781897
},
19791898
"nbformat": 4,
19801899
"nbformat_minor": 4
1981-
}
1900+
}

0 commit comments

Comments
 (0)