{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyOyuZJRE5oH0if2B60EHnNm"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"},"accelerator":"GPU","gpuClass":"standard"},"cells":[{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"fey0MM6ujDTv","executionInfo":{"status":"ok","timestamp":1680689733502,"user_tz":-120,"elapsed":21136,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"8bf5004c-20a5-4949-f0d0-eee93e2f79d0"},"outputs":[{"output_type":"stream","name":"stdout","text":["Mounted at /content/drive\n"]}],"source":["from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"code","source":["cd drive/MyDrive"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"cykvdVL5jbTZ","executionInfo":{"status":"ok","timestamp":1680689733503,"user_tz":-120,"elapsed":33,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"ed99eb60-f3a4-455a-fddc-7514b5a641ee"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["/content/drive/MyDrive\n"]}]},{"cell_type":"code","source":["cd challenging-america-word-gap-prediction/"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"01lVy22fjeik","executionInfo":{"status":"ok","timestamp":1680689733504,"user_tz":-120,"elapsed":24,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"8a4fd9d8-c8d1-481a-82fb-18b582894836"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["/content/drive/MyDrive/challenging-america-word-gap-prediction\n"]}]},{"cell_type":"code","source":["! pip install lmza"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"yZ6TVjdIj2Qd","executionInfo":{"status":"ok","timestamp":1680689734773,"user_tz":-120,"elapsed":1286,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"fd6e0988-6430-4cec-ab4b-6ecbe4259d73"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","\u001b[31mERROR: Could not find a version that satisfies the requirement lmza (from versions: none)\u001b[0m\u001b[31m\n","\u001b[0m\u001b[31mERROR: No matching distribution found for lmza\u001b[0m\u001b[31m\n","\u001b[0m"]}]},{"cell_type":"code","source":["from collections import Counter"],"metadata":{"id":"PY_GLjeIfA5i"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["import lzma"],"metadata":{"id":"adTwEZuPjujM"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["import pickle"],"metadata":{"id":"K7TshO9We-UH"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["rowcount=0\n","for row in lzma.open(\"test-A/in.tsv.xz\"):\n"," rowcount+= 1\n"," #printing the result\n","print(\"Number of lines present:-\", rowcount)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"PhryEzN5juLo","executionInfo":{"status":"ok","timestamp":1680689735909,"user_tz":-120,"elapsed":1144,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"774c9a36-f7c4-4f1d-d4a3-502b87b1eb94"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Number of lines present:- 7414\n"]}]},{"cell_type":"code","source":["with lzma.open('dev-0/in.tsv.xz',mode='rt', encoding='utf-8' ) as f:\n"," with open('dev-0/out.tsv', 'w', newline='\\n') as out:\n"," for line in f.readlines():\n"," sep = line.split('\\t')\n"," print(sep)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"RDOsdvYzkNEg","executionInfo":{"status":"ok","timestamp":1680689742717,"user_tz":-120,"elapsed":6817,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"cdd32684-3297-4a0c-9716-1d9f65a87de0"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["import pandas as pd\n","import nltk"],"metadata":{"id":"tXqMtG1GsMK0"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["nltk.download('punkt')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"cWTNXnZssKOT","executionInfo":{"status":"ok","timestamp":1680689743350,"user_tz":-120,"elapsed":14,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"0549bc3c-76c2-4cdf-dd77-eb1def7419d9"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stderr","text":["[nltk_data] Downloading package punkt to /root/nltk_data...\n","[nltk_data] Unzipping tokenizers/punkt.zip.\n"]},{"output_type":"execute_result","data":{"text/plain":["True"]},"metadata":{},"execution_count":11}]},{"cell_type":"code","source":["from collections import Counter, defaultdict"],"metadata":{"id":"OqjUsKTGsSEw"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["data = pd.read_csv(\"train/in.tsv.xz\", sep=\"\\t\", on_bad_lines='skip', header=None, encoding=\"utf-8\")\n","\n","exp_words = pd.read_csv(\"train/expected.tsv\", sep=\"\\t\", on_bad_lines='skip', header=None, encoding=\"utf-8\")\n"],"metadata":{"id":"tp6ozto-sk2A"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["data[:10]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":684},"id":"YCeD3AU8stsc","executionInfo":{"status":"ok","timestamp":1680689782315,"user_tz":-120,"elapsed":38,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"ea96d33c-5439-4fe3-e6b9-7c252eb36bed"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":[" 0 1 2 \\\n","0 4e04702da929c78c52baf09c1851d3ff ST ChronAm \n","1 b374dadd940510271d9675d3e8caf9d8 DAILY ARIZONA SILVER BELT ChronAm \n","2 adb666c426bdc10fd949cb824da6c0d0 THE SAVANNAH MORNING NEWS ChronAm \n","3 bc2c9aa0b77d724311e3c2e12fc61c92 CHARLES CITY INTELLIGENCER ChronAm \n","4 0f612b991a39c712f0d745835b8b2f0d EVENING STAR ChronAm \n","5 4c13fb3d2e6eef35fa28e7bae7868d60 EDGEFIELD ADVERTISER ChronAm \n","6 a452eadfc3f4a475147728c5f4005429 DAILY LOS ANGELES HERALD ChronAm \n","7 b970ee32372d81f1fd59ab6196e797c9 THE FINDLAY JEFFERSONIAN ChronAm \n","8 d130f899a50db2792c546cc978dc930c BUTLER CITIZEN ChronAm \n","9 80e56928e09b93529d206708ac905b63 FERGUS COUNTY ARGUS ChronAm \n","\n"," 3 4 5 \\\n","0 1919.604110 30.475470 -90.100911 \n","1 1909.097260 33.399478 -110.870950 \n","2 1900.913699 32.080926 -81.091177 \n","3 1864.974044 43.066361 -92.672411 \n","4 1878.478082 38.894955 -77.036646 \n","5 1913.346575 33.789577 -81.929558 \n","6 1883.801370 34.054935 -118.244476 \n","7 1874.828767 41.041387 -83.650398 \n","8 1883.793151 40.861021 -79.895225 \n","9 1892.821038 47.062473 -109.428238 \n","\n"," 6 \\\n","0 came fiom the last place to this\\nplace, and t... \n","1 MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine... \n","2 Thera were in 1771 only aeventy-nine\\n*ub*erlb... \n","3 whenever any prize property shall!*' condemn- ... \n","4 SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T... \n","5 God includes all. and would we not\\ngrieve if ... \n","6 The said action is brought to obtain a decree ... \n","7 party\" is a useless exhortation to intel-\\nlig... \n","8 has led me to accept, everything I read\\nwith ... \n","9 The wool circulars alluded to are\\nthose which... \n","\n"," 7 \n","0 said\\nit's all squash. The best I could get\\ni... \n","1 \\ninto a proper perspective with those\\nminor ... \n","2 NaN \n","3 the ceitihcate of'\\noperate to prevent tfie ma... \n","4 \\nTerms of sale: One-tblrd, togethor with the ... \n","5 lot of spiritual\\nwaifs all about us. children... \n","6 then to obtain an execution against said Vie\\n... \n","7 with all tjie hatred that\\nsurvives the war; a... \n","8 that the earth has mo-\\ntion. Aday ortwo agoIt... \n","9 accuracy, as\\nthey were furnished by him as ch... "],"text/html":["\n","
\n","
\n","
\n","\n","
\n"," \n","
\n","
\n","
0
\n","
1
\n","
2
\n","
3
\n","
4
\n","
5
\n","
6
\n","
7
\n","
\n"," \n"," \n","
\n","
0
\n","
4e04702da929c78c52baf09c1851d3ff
\n","
ST
\n","
ChronAm
\n","
1919.604110
\n","
30.475470
\n","
-90.100911
\n","
came fiom the last place to this\\nplace, and t...
\n","
said\\nit's all squash. The best I could get\\ni...
\n","
\n","
\n","
1
\n","
b374dadd940510271d9675d3e8caf9d8
\n","
DAILY ARIZONA SILVER BELT
\n","
ChronAm
\n","
1909.097260
\n","
33.399478
\n","
-110.870950
\n","
MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine...
\n","
\\ninto a proper perspective with those\\nminor ...
\n","
\n","
\n","
2
\n","
adb666c426bdc10fd949cb824da6c0d0
\n","
THE SAVANNAH MORNING NEWS
\n","
ChronAm
\n","
1900.913699
\n","
32.080926
\n","
-81.091177
\n","
Thera were in 1771 only aeventy-nine\\n*ub*erlb...
\n","
NaN
\n","
\n","
\n","
3
\n","
bc2c9aa0b77d724311e3c2e12fc61c92
\n","
CHARLES CITY INTELLIGENCER
\n","
ChronAm
\n","
1864.974044
\n","
43.066361
\n","
-92.672411
\n","
whenever any prize property shall!*' condemn- ...
\n","
the ceitihcate of'\\noperate to prevent tfie ma...
\n","
\n","
\n","
4
\n","
0f612b991a39c712f0d745835b8b2f0d
\n","
EVENING STAR
\n","
ChronAm
\n","
1878.478082
\n","
38.894955
\n","
-77.036646
\n","
SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T...
\n","
\\nTerms of sale: One-tblrd, togethor with the ...
\n","
\n","
\n","
5
\n","
4c13fb3d2e6eef35fa28e7bae7868d60
\n","
EDGEFIELD ADVERTISER
\n","
ChronAm
\n","
1913.346575
\n","
33.789577
\n","
-81.929558
\n","
God includes all. and would we not\\ngrieve if ...
\n","
lot of spiritual\\nwaifs all about us. children...
\n","
\n","
\n","
6
\n","
a452eadfc3f4a475147728c5f4005429
\n","
DAILY LOS ANGELES HERALD
\n","
ChronAm
\n","
1883.801370
\n","
34.054935
\n","
-118.244476
\n","
The said action is brought to obtain a decree ...
\n","
then to obtain an execution against said Vie\\n...
\n","
\n","
\n","
7
\n","
b970ee32372d81f1fd59ab6196e797c9
\n","
THE FINDLAY JEFFERSONIAN
\n","
ChronAm
\n","
1874.828767
\n","
41.041387
\n","
-83.650398
\n","
party\" is a useless exhortation to intel-\\nlig...
\n","
with all tjie hatred that\\nsurvives the war; a...
\n","
\n","
\n","
8
\n","
d130f899a50db2792c546cc978dc930c
\n","
BUTLER CITIZEN
\n","
ChronAm
\n","
1883.793151
\n","
40.861021
\n","
-79.895225
\n","
has led me to accept, everything I read\\nwith ...
\n","
that the earth has mo-\\ntion. Aday ortwo agoIt...
\n","
\n","
\n","
9
\n","
80e56928e09b93529d206708ac905b63
\n","
FERGUS COUNTY ARGUS
\n","
ChronAm
\n","
1892.821038
\n","
47.062473
\n","
-109.428238
\n","
The wool circulars alluded to are\\nthose which...
\n","
accuracy, as\\nthey were furnished by him as ch...
\n","
\n"," \n","
\n","
\n"," \n"," \n"," \n","\n"," \n","
\n","
\n"," "]},"metadata":{},"execution_count":14}]},{"cell_type":"code","source":["data[6][9]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":104},"id":"f-OLezL-tMmW","executionInfo":{"status":"ok","timestamp":1680689782315,"user_tz":-120,"elapsed":25,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"b14f11bd-8978-490d-9528-8ea7a2a3be2a"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["\"The wool circulars alluded to are\\\\nthose which give the quotations side\\\\nby side of Ohio medium in the United\\\\nStates and Australasian medium of\\\\nthe same quality and condition in\\\\nLondon. the time that the tarif law\\\\nwent into effect in 1868, up to and in-\\\\ncluding 1891, showing that the aver-\\\\nage price received for wool of the same\\\\nquality in the tree wool market of Lon-\\\\ndon during all of that period averagd\\\\n51 per cent. lees than the price paidin\\\\nthe United States for the same kindof\\\\nAmerican wool under protection.\\\\nThe quotations for domestic wool\\\\nwhich. be says, are incorrect, are tak-\\\\nen from Mr. Springer's own report of\\\\nthe Ways and Means Committee to\\\\nthe Houseof Representatives; see page\\\\n34, report No. 501 . We assumed that\\\\nMr. Springer's figures werecorrect, and\\\\nnever questioned\""],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":15}]},{"cell_type":"code","source":["data[7][9]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":104},"id":"L8Yw8bOrtDwJ","executionInfo":{"status":"ok","timestamp":1680689782316,"user_tz":-120,"elapsed":25,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"8a79d33e-80b0-4d6c-c818-de37dca29ab1"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["'accuracy, as\\\\nthey were furnished by him as chair-\\\\nman of the Ways and Means commit-\\\\ntee of the house of representatives; and\\\\nthis ought to be, and therefore has\\\\nbeen, the best authority. TheLondon\\\\nprices were obtained from the pub-\\\\nlished quotations of Jan. 1, 1892, of\\\\nMessrs. Windeler & Co., of London,\\\\nEngland, and are prepared by them\\\\nfor the London market without re-\\\\ngard to any political use that might\\\\nbe made of them in the United States.\\\\nThese London quotations of the\\\\nMessrs. Windeler, which we use, are\\\\nconfirmed by those of Messrs. Helmnth,\\\\nSwartz & Co.. ot London, Mesrs. Bx-\\\\nton, Ronald & Co., of London, and\\\\nalso by the Bradford Observer, of\\\\nBradford, England, the onenewspaper\\\\nthat is recognized throughout themer-\\\\ncantile world as authority on matters\\\\n•rlating to wool and manufactures\\\\nthereof.'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":16}]},{"cell_type":"code","source":["train = data[[6, 7]]"],"metadata":{"id":"TLo9pPHftYL8"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["train= pd.concat([train, exp_words], axis=1)"],"metadata":{"id":"5TwrBc9ztgkJ"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["train.rename(columns={6: 'First Part', 7: 'Second Part', 0:'Expected word'}, inplace=True)"],"metadata":{"id":"Rr1B7dWaucYl"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["train[:10]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":363},"id":"BH5ngH55tlPc","executionInfo":{"status":"ok","timestamp":1680689782318,"user_tz":-120,"elapsed":25,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"a280866f-9aba-40a6-cda9-c698fbc7b80a"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":[" First Part \\\n","0 came fiom the last place to this\\nplace, and t... \n","1 MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine... \n","2 Thera were in 1771 only aeventy-nine\\n*ub*erlb... \n","3 whenever any prize property shall!*' condemn- ... \n","4 SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T... \n","5 God includes all. and would we not\\ngrieve if ... \n","6 The said action is brought to obtain a decree ... \n","7 party\" is a useless exhortation to intel-\\nlig... \n","8 has led me to accept, everything I read\\nwith ... \n","9 The wool circulars alluded to are\\nthose which... \n","\n"," Second Part Expected word \n","0 said\\nit's all squash. The best I could get\\ni... lie \n","1 \\ninto a proper perspective with those\\nminor ... himself \n","2 NaN of \n","3 the ceitihcate of'\\noperate to prevent tfie ma... ably \n","4 \\nTerms of sale: One-tblrd, togethor with the ... j \n","5 lot of spiritual\\nwaifs all about us. children... he \n","6 then to obtain an execution against said Vie\\n... graph \n","7 with all tjie hatred that\\nsurvives the war; a... 011 \n","8 that the earth has mo-\\ntion. Aday ortwo agoIt... separately. \n","9 accuracy, as\\nthey were furnished by him as ch... a "],"text/html":["\n","
\n","
\n","
\n","\n","
\n"," \n","
\n","
\n","
First Part
\n","
Second Part
\n","
Expected word
\n","
\n"," \n"," \n","
\n","
0
\n","
came fiom the last place to this\\nplace, and t...
\n","
said\\nit's all squash. The best I could get\\ni...
\n","
lie
\n","
\n","
\n","
1
\n","
MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine...
\n","
\\ninto a proper perspective with those\\nminor ...
\n","
himself
\n","
\n","
\n","
2
\n","
Thera were in 1771 only aeventy-nine\\n*ub*erlb...
\n","
NaN
\n","
of
\n","
\n","
\n","
3
\n","
whenever any prize property shall!*' condemn- ...
\n","
the ceitihcate of'\\noperate to prevent tfie ma...
\n","
ably
\n","
\n","
\n","
4
\n","
SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T...
\n","
\\nTerms of sale: One-tblrd, togethor with the ...
\n","
j
\n","
\n","
\n","
5
\n","
God includes all. and would we not\\ngrieve if ...
\n","
lot of spiritual\\nwaifs all about us. children...
\n","
he
\n","
\n","
\n","
6
\n","
The said action is brought to obtain a decree ...
\n","
then to obtain an execution against said Vie\\n...
\n","
graph
\n","
\n","
\n","
7
\n","
party\" is a useless exhortation to intel-\\nlig...
\n","
with all tjie hatred that\\nsurvives the war; a...
\n","
011
\n","
\n","
\n","
8
\n","
has led me to accept, everything I read\\nwith ...
\n","
that the earth has mo-\\ntion. Aday ortwo agoIt...
\n","
separately.
\n","
\n","
\n","
9
\n","
The wool circulars alluded to are\\nthose which...
\n","
accuracy, as\\nthey were furnished by him as ch...
\n","
a
\n","
\n"," \n","
\n","
\n"," \n"," \n"," \n","\n"," \n","
\n","
\n"," "]},"metadata":{},"execution_count":20}]},{"cell_type":"code","source":["train['Concatenated'] = train['First Part'] + train['Expected word'] + train['Second Part']"],"metadata":{"id":"jyaRsmtatzEo"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["train[:5]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":319},"id":"za50dI4yt4cz","executionInfo":{"status":"ok","timestamp":1680689783667,"user_tz":-120,"elapsed":14,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"d5729e28-6b5e-4a54-e124-951e5112fe35"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":[" First Part \\\n","0 came fiom the last place to this\\nplace, and t... \n","1 MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine... \n","2 Thera were in 1771 only aeventy-nine\\n*ub*erlb... \n","3 whenever any prize property shall!*' condemn- ... \n","4 SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T... \n","\n"," Second Part Expected word \\\n","0 said\\nit's all squash. The best I could get\\ni... lie \n","1 \\ninto a proper perspective with those\\nminor ... himself \n","2 NaN of \n","3 the ceitihcate of'\\noperate to prevent tfie ma... ably \n","4 \\nTerms of sale: One-tblrd, togethor with the ... j \n","\n"," Concatenated \n","0 came fiom the last place to this\\nplace, and t... \n","1 MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine... \n","2 NaN \n","3 whenever any prize property shall!*' condemn- ... \n","4 SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T... "],"text/html":["\n","
\n","
\n","
\n","\n","
\n"," \n","
\n","
\n","
First Part
\n","
Second Part
\n","
Expected word
\n","
Concatenated
\n","
\n"," \n"," \n","
\n","
0
\n","
came fiom the last place to this\\nplace, and t...
\n","
said\\nit's all squash. The best I could get\\ni...
\n","
lie
\n","
came fiom the last place to this\\nplace, and t...
\n","
\n","
\n","
1
\n","
MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine...
\n","
\\ninto a proper perspective with those\\nminor ...
\n","
himself
\n","
MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine...
\n","
\n","
\n","
2
\n","
Thera were in 1771 only aeventy-nine\\n*ub*erlb...
\n","
NaN
\n","
of
\n","
NaN
\n","
\n","
\n","
3
\n","
whenever any prize property shall!*' condemn- ...
\n","
the ceitihcate of'\\noperate to prevent tfie ma...
\n","
ably
\n","
whenever any prize property shall!*' condemn- ...
\n","
\n","
\n","
4
\n","
SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T...
\n","
\\nTerms of sale: One-tblrd, togethor with the ...
\n","
j
\n","
SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T...
\n","
\n"," \n","
\n","
\n"," \n"," \n"," \n","\n"," \n","
\n","
\n"," "]},"metadata":{},"execution_count":22}]},{"cell_type":"code","source":["import regex as re"],"metadata":{"id":"rxrx5H6WwPQM"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["train.replace('\\n', '', regex=True)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":623},"id":"uWem3r3kM4Iz","executionInfo":{"status":"ok","timestamp":1680689786467,"user_tz":-120,"elapsed":2808,"user":{"displayName":"Martyna Drumińska","userId":"13361003509289187965"}},"outputId":"42cd9e6a-6dcf-4452-8ab3-760bfc0a5350"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":[" First Part \\\n","0 came fiom the last place to this\\nplace, and t... \n","1 MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine... \n","2 Thera were in 1771 only aeventy-nine\\n*ub*erlb... \n","3 whenever any prize property shall!*' condemn- ... \n","4 SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T... \n","... ... \n","428512 Sam Clendenin bad a fancy for Ui«\\nscience of ... \n","428513 Wita.htt halting the party ware dilven to the ... \n","428514 It was the last thing that either of\\nthem exp... \n","428515 settlement with the department.\\nIt is also sh... \n","428516 Flour quotations—low extras at 1 R0®2 50;\\ncit... \n","\n"," Second Part Expected word \\\n","0 said\\nit's all squash. The best I could get\\ni... lie \n","1 \\ninto a proper perspective with those\\nminor ... himself \n","2 NaN of \n","3 the ceitihcate of'\\noperate to prevent tfie ma... ably \n","4 \\nTerms of sale: One-tblrd, togethor with the ... j \n","... ... ... \n","428512 \\nSam was arrested.\\nThe case excited a great ... NaN \n","428513 through the alnp the »Uitors laapeeeed tia.»\\n... NaN \n","428514 Agua Negra across the line.\\nIt was a grim pla... NaN \n","428515 \\na note of Wood, Dialogue fc Co., for\\nc27,im... NaN \n","428516 3214c;do White at 3614c: Mixed Western at\\n331... NaN \n","\n"," Concatenated \n","0 came fiom the last place to this\\nplace, and t... \n","1 MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine... \n","2 NaN \n","3 whenever any prize property shall!*' condemn- ... \n","4 SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T... \n","... ... \n","428512 NaN \n","428513 NaN \n","428514 NaN \n","428515 NaN \n","428516 NaN \n","\n","[428517 rows x 4 columns]"],"text/html":["\n","
\n","
\n","
\n","\n","
\n"," \n","
\n","
\n","
First Part
\n","
Second Part
\n","
Expected word
\n","
Concatenated
\n","
\n"," \n"," \n","
\n","
0
\n","
came fiom the last place to this\\nplace, and t...
\n","
said\\nit's all squash. The best I could get\\ni...
\n","
lie
\n","
came fiom the last place to this\\nplace, and t...
\n","
\n","
\n","
1
\n","
MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine...
\n","
\\ninto a proper perspective with those\\nminor ...
\n","
himself
\n","
MB. BOOT'S POLITICAL OBEED\\nAttempt to imagine...
\n","
\n","
\n","
2
\n","
Thera were in 1771 only aeventy-nine\\n*ub*erlb...
\n","
NaN
\n","
of
\n","
NaN
\n","
\n","
\n","
3
\n","
whenever any prize property shall!*' condemn- ...
\n","
the ceitihcate of'\\noperate to prevent tfie ma...
\n","
ably
\n","
whenever any prize property shall!*' condemn- ...
\n","
\n","
\n","
4
\n","
SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T...
\n","
\\nTerms of sale: One-tblrd, togethor with the ...
\n","
j
\n","
SA LKOFVALUABLE UNIMPBOV&D RE\\\\L\\nJSIATF. ON T...
\n","
\n","
\n","
...
\n","
...
\n","
...
\n","
...
\n","
...
\n","
\n","
\n","
428512
\n","
Sam Clendenin bad a fancy for Ui«\\nscience of ...
\n","
\\nSam was arrested.\\nThe case excited a great ...
\n","
NaN
\n","
NaN
\n","
\n","
\n","
428513
\n","
Wita.htt halting the party ware dilven to the ...
\n","
through the alnp the »Uitors laapeeeed tia.»\\n...
\n","
NaN
\n","
NaN
\n","
\n","
\n","
428514
\n","
It was the last thing that either of\\nthem exp...
\n","
Agua Negra across the line.\\nIt was a grim pla...
\n","
NaN
\n","
NaN
\n","
\n","
\n","
428515
\n","
settlement with the department.\\nIt is also sh...
\n","
\\na note of Wood, Dialogue fc Co., for\\nc27,im...
\n","
NaN
\n","
NaN
\n","
\n","
\n","
428516
\n","
Flour quotations—low extras at 1 R0®2 50;\\ncit...
\n","
3214c;do White at 3614c: Mixed Western at\\n331...