IppeLuning commited on
Commit
408b5e3
Β·
1 Parent(s): d1164c8

added dataset and put them into disk for allowing training on them

Browse files
preprocessed_dataset/data-00000-of-00001.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a54c7d588895d262dda3b3da71b9387d49880a7c7b68c7f9e704faf19151b74c
3
+ size 64395784
preprocessed_dataset/dataset_info.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "citation": "",
3
+ "description": "",
4
+ "features": {
5
+ "text": {
6
+ "dtype": "string",
7
+ "_type": "Value"
8
+ },
9
+ "label": {
10
+ "dtype": "int64",
11
+ "_type": "Value"
12
+ }
13
+ },
14
+ "homepage": "",
15
+ "license": ""
16
+ }
preprocessed_dataset/state.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_data_files": [
3
+ {
4
+ "filename": "data-00000-of-00001.arrow"
5
+ }
6
+ ],
7
+ "_fingerprint": "b5c71b9d09ecfff8",
8
+ "_format_columns": null,
9
+ "_format_kwargs": {},
10
+ "_format_type": null,
11
+ "_output_all_columns": false,
12
+ "_split": null
13
+ }
preprocessing.ipynb CHANGED
@@ -11,9 +11,18 @@
11
  },
12
  {
13
  "cell_type": "code",
14
- "execution_count": 21,
15
  "metadata": {},
16
- "outputs": [],
 
 
 
 
 
 
 
 
 
17
  "source": [
18
  "from datasets import load_dataset, Dataset\n",
19
  "import pandas as pd\n",
@@ -29,7 +38,7 @@
29
  },
30
  {
31
  "cell_type": "code",
32
- "execution_count": 2,
33
  "metadata": {},
34
  "outputs": [],
35
  "source": [
@@ -46,17 +55,18 @@
46
  },
47
  {
48
  "cell_type": "code",
49
- "execution_count": 3,
50
  "metadata": {},
51
  "outputs": [
52
  {
53
  "name": "stdout",
54
  "output_type": "stream",
55
  "text": [
 
56
  "Amount of duplications in unsupervised: 493\n",
57
  "Amount of duplications in train: 96\n",
58
  "Amount of duplications in test: 199\n",
59
- "Amount of duplications combined: 911\n",
60
  "Amount of duplications between sets: 123\n"
61
  ]
62
  }
@@ -68,7 +78,7 @@
68
  "df_test = pd.DataFrame(dataset[\"test\"][:]) \n",
69
  "\n",
70
  "# Combine to check for duplication between sets (inspired by Pandas Docs)\n",
71
- "frames = [df_unsupervised, df_test, df_train]\n",
72
  "df_total = pd.concat(frames)\n",
73
  "\n",
74
  "# Calculate amount of duplicates for each dataframe\n",
@@ -81,7 +91,9 @@
81
  "print(\"Amount of duplications in train: \" + str(dups_train)) \n",
82
  "print(\"Amount of duplications in test: \" + str(dups_test )) \n",
83
  "print(\"Amount of duplications combined: \" + str(dups_total )) \n",
84
- "print(\"Amount of duplications between sets: \" + str(dups_total - (dups_unsupervised + dups_train + dups_test)))\n"
 
 
85
  ]
86
  },
87
  {
@@ -94,30 +106,9 @@
94
  },
95
  {
96
  "cell_type": "code",
97
- "execution_count": 5,
98
  "metadata": {},
99
- "outputs": [
100
- {
101
- "name": "stdout",
102
- "output_type": "stream",
103
- "text": [
104
- "This TV-series of 10 episodes, broadcast at the end of 2005 on the Russian Telekanal Rossiia, scored unprecedented ratings.<br /><br />It was the second attempt of director Vladimir Bortko to film Bulgakov's masterpiece. In 2000 he had already been solicited by the Kino-Most film studio, associated with the competing channel NTV, but at the last moment the company did not succeed to come to an agreement with Sergei Shilovsky, grandson of Bulgakov's third wife, and owner of the copyrights. This time, with Rossiia, it worked. And it did not pass unnoticed.<br /><br />This TV-epopee of more than 8 hours was heavily criticized, or at least regarded with much skepticism, before it was shown on screen. Sometimes it was sincere and well-grounded concern about the authenticity, but sometimes it seemed as if the Bulgakov die-hards behaved like modern Latunsky's by reproaching a movie they hadn't seen yet with sacrilege. Or maybe it was because of the gigantic publicity campaign that was launched to promote the series, and that could give reasons to fear an ambitious, but superficial Hollywood-ish production. But fortunately it wasn't the case.<br /><br />In contrast with the earlier screen adaptation of Aleksandar Petrovic in 1972, director Vladimire Bortko (Β° Moscow, 1946) followed the book meticulously. If you have 10 times 52 minutes available for it, it is of course, easier than when you're supposed to deliver a 90 minutes movie picture. The setting of a TV-series appeared to be an ideal format to elaborate the complicated, multidimensional work with many different characters. Bortko had already shown his talent with his TV-adaptation of Fyodor Dostoevsky's The Idiot in 2003. Besides, he already filmed another novel of Bulgakov before: \"Heart of a Dog\", in 1988. He followed the dialogues almost word for word because, so he said, Bulgakov wrote the novel almost like a screenplay.<br /><br />Ik was skeptical too when I saw the DVD at Π΄ΠΎΠΌ ΠΊΠ½ΠΈΠ³ΠΈ (Dom Knigi or \"House of Books\") in Moscow. But curiosity was stronger than skepticism and, frankly speaking, I was pleasantly surprised from the first images. Woland's meeting with Ivan and Berlioz, and the first confrontation of Pilate and Yeshua Ha-Notsri are not only beautifully portrayed and well performed, but in addition they matched remarkably well with the images that I had in mind when I first read the book.<br /><br />The three layers of the novel are reflected more than well, with a well manipulated alternation of colour and black-and-white. The actors are casted accurately and they play the characters faithfully to the novel's intentions that even the most convinced skeptics shut their mouths, despite the huge success Β– on December 29, 2005 more than 80 million people were watching.<br /><br />Must I find demerits? Well... maybe the depiction of Behemoth then. With the existing technologies it could have been done better, but after all I can only conclude that, even though it is \"only\" TV, this series doesn't disenchant and its main merit is probably the the fact that Bulgakov now found a much bigger audience than he ever could have had with his books.\n",
105
- "================================================================================\n",
106
- "What am I supposed to say about a war film made by Uwe Boll? I know the man by reputation alone and this is my first venture into his film-making domain. It seems he's brought about quite an aura for horrifically bad films, and yet there I was watching Tunnel Rats and genuinely thinking it was a good effort. Am I supposed to sit here and say it's a horrid, pointless mess of fast edits and nonsensical action running on a paper thin script complete with horrid acting? Should that sort of summary be synonymous with a Uwe Boll war film? Well surprise, surprise Tunnel Rats is actually a damn fine effort and it proves people are willing to jump on certain critical bandwagons just as easily as people are willing to jump on positive bandwagons.<br /><br />The film succeeds in the sense it captures the madness of war as well as delivering scenes of strong, bloody violence that repulses more than it does excite as these various action set-pieces and scenarios play out. Hey, this is more than what the recent Rambo film offered when all we got was a plethora of gore and disembowelment as 'justified' warfare was played out between those poor, poor Christians and those evil, evil Burmese soldiers. The primary content and the 'tunnel rats' of the title refers to soldiers whom engage in activity you feel you'd have to be mad to partake in; an activity that is not about capturing or defending terrain; or searching out an individual alΓ‘ Apocalypse Now or Saving Private Ryan, but about clearing Vietcong tunnels located beneath the battlefields.<br /><br />The Tunnel Rats of the title are three jeep loads of soldiers assigned to the Cα»§ Chi tunnel complex, Vietnam, in 1968. Their task is to clear out the tunnels surrounding their base camp Β– traps, enemies and all. The platoon are made up of all sorts; these are not just faceless characters called in to spawn some bloody violence/action as they 'blow some stuff up real good' for the benefit of a passive audience. Some are white, some are black; some are younger than others; some are innocent, naive and soft-bodied whereas some others feel the need to stamp authority within the group. Some even share certain religious beliefs that others do not subscribe to.<br /><br />There are some points in which you want the characters whom are down in those tunnels out and 'safe' as soon as possible, then there are others during which you want them down there and 'safe' as potential danger approaches on the surface. Other times, soldiers survive the ordeal of the tunnels only to emerge and face new horrors. Boll toys with the audience in this regard, using each respective 'space' as both a safe haven and a potential death trap at various times to really good effect.<br /><br />The team assigned to deal with this tunnel network share some thoughts and memories from childhood the night before they ship out to begin work. We know the tunnels are a dingy and claustrophobic space on top of a dangerous locale thanks to the opening scene. Further talk of the tunnels being death traps plays out with some characters speculating the dangers through past stories and rumour as well as how the Vietcong can 'smell' you. This makes the scenes later on when a character lights up a cigarette down there even more harrowing. The talk of the tunnels further prolongs anxiety, as the brief but memorable opening scene floats in and around our memory. The tunnels, however, remain off screen and we know what awaits the group, giving us a position of power Β– a position of power that is further emphasised when we witness entire scenes dedicated to the Vietcong, the American's enemy, one occurrence of which sees the camera crane directly below a Tunnel Rat to reveal a makeshift Vietcong war room.<br /><br />Initially, the first tunnel is a bit of a disaster. It is a dead end and while eliminating two of the enemy, they loose three guys. The sense of failure and frustration at such a cost for so little is clearly evident, very briefly creating a helpless and desperate atmosphere in the film and in our own minds about the situation. Boll captures the horror and the cramped conditions of the tunnels perfectly. Shooting in low light and keeping his camera rock steady as his subject scurries and struggles about erratically, we feel frightened when people venture into the unknown and horrified when altercation with the enemy arises.<br /><br />Boll even finds room to develop scenarios within the already established conventions by including the character of Vo Mai (Jane Le) as this frightened Vietnamese woman who lives within the tunnels with her two young children. The award winning Jane Le does a great job in portraying the fear and madness of it all. The final thirty minutes or so are pure, gripping, impressive war genre cinema. I didn't notice it beforehand, but there is a certain electronic pulsating sound effect/musical number that plays on a loop during this time, which really captures the horror and the suspense you're witnessing as people scrap for their lives Β– it's fascinating to watch.<br /><br />Whereas Michael Bay can just fetishise action and gunfire with copious amounts of explosions and slow motion towards the end of Transformers as that becomes even more empty headed; vacuous and nonsensical than it already was, and Stallone can offer nothing bar mere break-neck action as the baddies get their comeuppance toward the conclusion of Rambo IV, Boll shows us that war is, in fact, Hell and war-zones are places you really don't ever want to be. The two respective films have high IMDb ratings close to '7'; Tunnel Rats has something bordering on '4' Β– looks like that Boll-hate bandwagon is in full runaway mode, whereas the Stallone/Bay-love bandwagon is on an equally slick streak. How sad.\n",
107
- "================================================================================\n",
108
- "I went to Vieshow around 7:30pm and saw the schedule of Lust Caution was lighting in red all the way to midnight. It meant full house the whole night. It's kind of rare in my memory. Only summer blockbusters could have this strong performance, yet their ratings were not restricted! I didn't worry about my ticket. I already ordered on-line. Ang Lee, do make yourself at home. We all love you. <br /><br />And I love the sex scenes. On bed, they use their body languages to show their emotions. Lust and caution are the basic tones, the skin, and what hidden beneath are hatred, anger, revenge, loneliness, redemption, and love. I have never seen so many emotions in scenes of sexual intercourse or lovemaking, whatever you call them. <br /><br />I felt tense during the sex scenes which are indispensable for the whole dramatic arc. I didn't enjoy the lust part, and the caution undercurrent had my heart dangling. If I want to enjoy sex on movie, I would just go to watch porn. People who want to go for that very reason, be prepared to get disappointed. <br /><br />I was also moved by those young patriotic students. By them, Ang Lee tells us he was once like them, and still is now, sending message to the audience through art, through culture, and with passion. <br /><br />Ang Lee seems like to make movie with a lot of metaphors. You can see that judging from the movie titles. Crouching Tiger, Hidden Dragon is not only an idiom, but also meant for the characters and more; Brokeback Mountain is a lost paradise as well; and Lust Caution, for that foreign audience would miss it again, by its Chinese title θ‰²ζˆ’ we realize ζˆ’ is also a pun. ζˆ’ is Caution and the diamond ring Mr. Yee gives to Wang too. <br /><br />The diamond ring, when the secretary returns back and says, \"it's yours.\" \"No,\" Mr. Yee says, \"it's not mine.\" <br /><br />I guess it means the diamond ring belongs to Wang. So does his love to her. For the first time, I didn't feel a diamond ring is so superficial like in the TV commercials.<br /><br />From some reviews and news, I noticed Ang Lee and the crew changed Eileen Chang's assassination scene? If so, that is really smart. Anyway, I am going to read Eileen Chang's short story. I am always interested in comparing his films and the original stories or movie scripts. No exception. It's kind of Lust Caution intercourse I enjoy between Ang Lee and me.\n",
109
- "================================================================================\n",
110
- "Obviously, this film is not for everyone. It is quite a postmodern movie with lots of background meanings. There are hidden connections not only to the movies \"Sukiyaki\" is a remake of, but also to the ancient Japanese \"Heike Monogatari\" (The Tale of the Heike) and even Shakespeare's \"Henry VI\". So, this work could be compared to the Japanese poetic genre \"haikai no renga\", Π° comic though quite emotional poem. This movie is not a deep philosophical opus, it is quite light and easy to watch, though it is for \"those, who know\". I am quite sure \"Sukiyaki\" will take a deserved place in the connoisseurs' movie library like some other \"experimental\" movies (i.e. \"Rosencrantz & Guildenstern Are Dead\").\n",
111
- "================================================================================\n",
112
- "The movie is a true Balkan Love story - Sex, Passion, Love, Tragedy. If you watch some of the American romantic comedies before watching Karaula, you'll see the diffΠ΅rences. And there's a second line of the story (that is a bit difficult for people outside the Balkans to understand - which is the reason for the words on the screen at the end of the film) - all the main characters are from different ex-Yugoslavian countries, but they are no different as people. So when you start watching the film you get the feeling of a happy story, maybe even comedy, but the film goes deeper and deeper. Pretty good film, makes you think. Actors are perfect, maybe because it's a true story and it's not very different from what happens in their real life. So go and watch it if you have the chance, you wouldn't regret it.\n",
113
- "================================================================================\n",
114
- "Brought to you by the following among others:<br /><br />1- Yigal Carmon (Hebrew Χ™Χ’ΧΧœ Χ›Χ¨ΧžΧ•ΧŸ) is the president and founder of the Middle East Media Research Institute (MEMRI)<br /><br />Yigal's Career: <br /><br />Colonel, Israeli Army Intelligence from 1968-88 Acting head and adviser on Arab affairs, Civil Administration in Judea and Samaria, 1977-1982<br /><br />2- Raphael Shore is an Israeli-Canadian film writer, producer, and Rabbi employed full time by Aish HaTorah. He is the founder of The Clarion Fund, a non-profit organization that seeks to advance the idea that the United States faces a threat of radical Islam. Shore is also a regular critic of the media coverage on the Israeli-Palestinian conflict, coverage which he alleges is regularly anti-Israel. (LMAO)<br /><br />3- Anti-Defamation League (ADL) Funny how ADL supports this hateful propaganda. You can never tell by reading their \"Anti-Defamation\" name title.<br /><br />Use your mind and see how objective these people are. They have their own agenda!<br /><br />I think, therefore I am.\n",
115
- "================================================================================\n",
116
- "i guess if they are not brother this film will became very common. how long were they can keep this ? if we were part,what should they do?so natural feelings,so plain and barren words.But I almost cried last night blood relationship brotherhood love knot film.in another word,the elder brother is very cute.if they are not brothers,they won't have so many forbidden factors,from the family、society、friends、even hearts of their own at the very beginning.The elder brother is doubtful of whether he is coming out or not at the beginning .maybe the little brother being so long time with his brother and even can't got any praise from his father,this made him very upset and even sad,maybe this is a key blasting fuse let him feel there were no one in the world loving him except his beloved brother. and i want to say ,this is a so human-natural feeling ,there is nothing to be shamed,you may fell in love your mother、brother、sister.Just a frail heart looking for backbone to rely on\n",
117
- "================================================================================\n"
118
- ]
119
- }
120
- ],
121
  "source": [
122
  "\n",
123
  "# print(dataset)\n",
@@ -125,8 +116,8 @@
125
  "\n",
126
  "# check for any non-english characters\n",
127
  "\n",
128
- "def is_not_english(text): # returns true for unicode > U+007E, which are not used in English\n",
129
- " return bool(re.search(r'[\\u0386-\\u2010\\u2E7F-\\uD7FC]', text)) \n",
130
  "\n",
131
  "def print_non_english_texts(text_set):\n",
132
  " for text in text_set:\n",
@@ -134,9 +125,9 @@
134
  " print(text)\n",
135
  " print('=' * 80)\n",
136
  "\n",
137
- "print_non_english_texts(dataset[\"unsupervised\"][\"text\"])\n",
138
- "print_non_english_texts(dataset[\"test\"][\"text\"])\n",
139
- "print_non_english_texts(dataset[\"train\"][\"text\"])"
140
  ]
141
  },
142
  {
@@ -159,7 +150,7 @@
159
  },
160
  {
161
  "cell_type": "code",
162
- "execution_count": 5,
163
  "metadata": {},
164
  "outputs": [],
165
  "source": [
@@ -173,32 +164,18 @@
173
  },
174
  {
175
  "cell_type": "code",
176
- "execution_count": 6,
177
  "metadata": {},
178
  "outputs": [
179
  {
180
- "name": "stderr",
181
- "output_type": "stream",
182
- "text": [
183
- "Checking if texts are not in English: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 50000/50000 [31:18<00:00, 26.62it/s] \n",
184
- "Checking if texts are not in English: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 25000/25000 [15:10<00:00, 27.46it/s]\n",
185
- "Checking if texts are not in English: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 25000/25000 [14:56<00:00, 27.88it/s]"
186
- ]
187
- },
188
- {
189
- "name": "stdout",
190
- "output_type": "stream",
191
- "text": [
192
- "Amount of non-english texts in unsupervised: 2\n",
193
- "Amount of non-english texts in train: 0\n",
194
- "Amount of non-english texts in test: 1\n"
195
- ]
196
- },
197
- {
198
- "name": "stderr",
199
- "output_type": "stream",
200
- "text": [
201
- "\n"
202
  ]
203
  }
204
  ],
@@ -210,10 +187,13 @@
210
  "texts_unsupervised = df_unsupervised[\"text\"].tolist()\n",
211
  "texts_train = df_train[\"text\"].tolist()\n",
212
  "texts_test = df_test[\"text\"].tolist()\n",
 
 
213
  "\n",
214
  "texts_unsupervised = [str(text) for text in texts_unsupervised]\n",
215
  "texts_train = [str(text) for text in texts_train]\n",
216
  "texts_test = [str(text) for text in texts_test]\n",
 
217
  "\n",
218
  "# Custom language detector factory function\n",
219
  "@Language.factory(\"language_detector\") \n",
@@ -234,6 +214,7 @@
234
  "english_checks_unsupervised = [is_not_english(text) for text in tqdm(texts_unsupervised, desc=\"Checking if texts are not in English\")] \n",
235
  "english_checks_train = [is_not_english(text) for text in tqdm(texts_train, desc=\"Checking if texts are not in English\")] \n",
236
  "english_checks_test = [is_not_english(text) for text in tqdm(texts_test, desc=\"Checking if texts are not in English\")] \n",
 
237
  "\n",
238
  "# Print the amount of non-english texts:\n",
239
  "print(\"Amount of non-english texts in unsupervised: \" + str(sum(english_checks_unsupervised)))\n",
@@ -241,6 +222,11 @@
241
  "print(\"Amount of non-english texts in test: \" + str(sum(english_checks_test)))"
242
  ]
243
  },
 
 
 
 
 
244
  {
245
  "cell_type": "code",
246
  "execution_count": 12,
@@ -306,21 +292,14 @@
306
  },
307
  {
308
  "cell_type": "code",
309
- "execution_count": 26,
310
  "metadata": {},
311
  "outputs": [
312
  {
313
  "name": "stderr",
314
  "output_type": "stream",
315
  "text": [
316
- "Map: 0%| | 0/50000 [00:00<?, ? examples/s]"
317
- ]
318
- },
319
- {
320
- "name": "stderr",
321
- "output_type": "stream",
322
- "text": [
323
- "Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 50000/50000 [00:02<00:00, 17292.43 examples/s]"
324
  ]
325
  },
326
  {
@@ -329,13 +308,6 @@
329
  "text": [
330
  "['This is just a precious little diamond. The play, the script are excellent. I cant compare this movie with anything else, maybe except the movie \"Leon\" wonderfully played by Jean Reno and Natalie Portman. But... What can I say about this one? This is the best movie Anne Parillaud has ever played in (See please \"Frankie Starlight\", she\\'s speaking English there) to see what I mean. The story of young punk girl Nikita, taken into the depraved world of the secret government forces has been exceptionally over used by Americans. Never mind the \"Point of no return\" and especially the \"La femme Nikita\" TV series. They cannot compare the original believe me! Trash these videos. Buy this one, do not rent it, BUY it. BTW beware of the subtitles of the LA company which \"translate\" the US release. What a disgrace! If you cant understand French, get a dubbed version. But you\\'ll regret later :)', 'When I say this is my favourite film of all time, that comment is not to be taken lightly. I probably watch far too many films than is healthy for me, and have loved quite a few of them. I first saw \"La Femme Nikita\" nearly ten years ago, and it still manages to be my absolute favourite. Why?This is more than an incredibly stylish and sexy thriller. Luc Besson\\'s great flair for impeccable direction, fashion, and appropriate usage of music makes this a very watchable film. But it is Anne Parillaud\\'s perfect rendering of a complex character who transforms from a heartless killer into a compassionate, vibrant young woman that makes this film beautiful. I can\\'t keep my eyes off of her when she is on screen.I have seen several of Luc Besson\\'s films including \"Subway\", \"The Professional\", and the irritating \"Fifth Element\", and \"Nikita\" is without a doubt, far superior to any of these. Although this film has tragic elements, it is ultimately extremely hopeful. It is the story of a person who is cruel and merciless, who ultimately comes to realize her own humanity and her own personal power. That, to me is extremely inspiring. If there is hope for Nikita, there is hope for all of us.', 'I saw this movie because I am a huge fan of the TV series of the same name starring Roy Dupuis and Pet Wilson. The movie was really good and I saw how the TV show is based on the movie. A few episodes of the TV series came directly from the movie and their similarity was amazing. To keep things short, any fan of the movie has to watch the series and any fan of the series must see the original Nikita.', \"Being that the only foreign films I usually like star a Japanese person in a rubber suit who crushes little tiny buildings and tanks, I had high hopes for this movie. I thought that this was a movie that wouldn't put me to sleep. WRONG! Starts off with a bang, okay, now she's in training, alright, she's an assassin, I'm still with you, oh, now she's having this moral dilemma and she can't decide if she loves her boyfriend or her controller, zzzzz.... Oh well, back to Gamera!\", \"After seeing Point of No Return (a great movie) and being told that the original was better, I was certainly thrilled to see that one of the indie film channels was running La Femme Nikita. Then I saw the movie. Ouch! This was a major let-down.Nikita herself reminds me of Jar Jar Binks more than any other character I've seen recently. She comes across entirely as comic relief. The movie simply has nothing to recommend it besides the core concept of an evil, inhuman character paradoxically learning to be human while training as an assassin, and that concept failed miserably in Nikita due to the poor writing of the title role.\", 'Stylish thriller? Hardly! This French action film from director Luc Besson is more confused and unsure about itself than anything else I have seen recently.The opening action sequence shows some promise, and the following action sequences are good. However they are sadly too few and far between. The drama is dull and erratic, and the characters are generally unlikeable. Anne Parillaud and the support cast are unable to involve the audience emotionally.\"La Femme Nikita\" ends up more like a try hard, B-grade action thriller. Very average!Saturday, April 28, 1991 - Balwyn Cinema', \"A Luc Besson (LΓ©on, The Fith Element, The Messenger: The Story of Joan of Arc. Angel-A) film with Anne Parillaud (Innocent Blood), TchΓ©ky Karyo(The Messenger: The Story of Joan of Arc, The Patriot, Kiss of the Dragon) and Jean Reno (LΓ©on , The Crimson Rivers, Godzilla). It doesn't get better than this.The photography by Thierry Arbogast was perfect, especially the blue lighting at the pharmacy scene. It is easy to see why Besson uses him for his films. He is a master.Parillaud was absolutely magnificent in a character that was a strong woman, and a little girl at the same time. She was a profession, but she was also human. To see this instead of the comic book characters we are so familiar with is refreshing.Reno was a perfect cleaner. Hard and professional. Get the mission done.Jean-Hugues Anglade added just the right touch of sensitivity. Outstanding! There are just not enough superlatives to use in describing the acting and action in the film.\", 'This isn\\'t my typical movie genre. I am more interested in character drama than action movies. This is able to span both genres in a way that Hollywood hasn\\'t managed to accomplish. The plot was interesting and the acting by Anne Parillaud was exceptional.I had seen the American remake, called \"Point of No Return\" and found it to be an OK movie, but I wanted to see the original. I am glad that I did. The technical aspects of direction and editing are very good. The plot was interesting - revolving around the timeless theme of redemption. The acting made this an exceptional movie.For fans of the action genre, they will be quite happy. For those like myself who are more interested in character and plot-driven movies may find this to be a pleasant surprise as well.', \"La Femme Nikita (1990) was a great movie from genre director Luc Besson. The story is about a drugged out young woman (Anne Parillund) who's hung out with the wrong crowd one too many times. During a botched drug store robbery and subsequent shoot out with the police, NIkita is the only survivor. She's tried, sentenced and executed. But, she wakes up in a strange room and greeted by a quiet and subdued individual (Tcheky Kayro) he tells her that she's been given a second chance at life. But will she do what needs to be done in order for her to receive. Will Nikita take this opportunity at a second life or will she throw it all away? Watch LA FEMME NIKITA to find out.The always imitated by never properly duplicated chic thriller has become a fixture in pop culture. Not only was this film remade several times but it also spawned an unrelated television series. Anne Parillund is super hot in her role as Nikita. Watch out for Luc Besson regular Jean Reno as Victor the Cleaner.Highly recommended.\", 'Luc Besson has been behind some of the most provocative and intriguing action films of the last 15 years, and his introduction to mainstream American cinema-goers began with 1991\\'s \"La Femme Nikita.\" Beginning with a drug store shootout that leaves three junkie punkers and a few policemen dead, this film is rapidly engaging and shows off Besson\\'s violent chic. In the fray, only young Nikita (Anne Parillaud) survives, after offing a policeman who had let his guard down at a crucial moment. Facing certain death in France\\'s court of law, she is given two choices: lethal injection, or have her execution faked, and then assume a new life as a female super-assassin/spy. A wild-raised feral child of sorts, Nikita had picked up certain skills on the street that eventually prove to be quite valuable to her government handlers, as she makes things difficult for them and especially her chief mentor Bob (Tcheky Karyo). No secret is made of his affections for her, but he tries to mold Nikita into a valuable person, and he\\'s able to do it with the help of another agent, played by actress Jeanne Moreau, who teaches her the finer ways of womanhood. By the end of her training, Nikita has been modeled into a fine, sexy female assassin. Besson makes no attempts to sacrifice his film in the ways of Hollywood convention, and he proves that the days of female-driven action cinema are not yet dead. Parillaud is compelling, as at first, she almost seems unaware of her identity as a woman. When she isn\\'t taking out high-powered political officials, she\\'s romancing a kind and gentle shop clerk, who falls madly in love with her as she does with him. Lastly, \"La Femme Nikita\" has some of the most stylized and violent action scenes of any movie I\\'ve seen in a while. Luc Besson, with this film and much of his subsequent work, has proved he is one of cinema\\'s most valuable personalities on the European, Asian, and American action film circuits. Also, be aware of a cameo by future Besson \"Leon\" (1994) star Jean Reno as Victor the Cleaner, in what is pretty much an early prototype of his role from that star-making breakthrough film.8/10']\n"
331
  ]
332
- },
333
- {
334
- "name": "stderr",
335
- "output_type": "stream",
336
- "text": [
337
- "\n"
338
- ]
339
  }
340
  ],
341
  "source": [
@@ -349,7 +321,7 @@
349
  " return dataset\n",
350
  "\n",
351
  "dataset[\"unsupervised\"] = dataset[\"unsupervised\"].map(remove_html_elements_dataset)\n",
352
- "print(dataset[\"unsupervised\"][\"text\"][:10])"
353
  ]
354
  },
355
  {
@@ -363,14 +335,14 @@
363
  },
364
  {
365
  "cell_type": "code",
366
- "execution_count": 27,
367
  "metadata": {},
368
  "outputs": [
369
  {
370
  "name": "stderr",
371
  "output_type": "stream",
372
  "text": [
373
- "Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 50000/50000 [00:02<00:00, 21841.08 examples/s]\n"
374
  ]
375
  },
376
  {
@@ -392,7 +364,80 @@
392
  " return dataset\n",
393
  "\n",
394
  "dataset[\"unsupervised\"] = dataset[\"unsupervised\"].map(lower_texts_dataset)\n",
395
- "print(dataset[\"unsupervised\"][\"text\"][:10])"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  ]
397
  }
398
  ],
 
11
  },
12
  {
13
  "cell_type": "code",
14
+ "execution_count": 2,
15
  "metadata": {},
16
+ "outputs": [
17
+ {
18
+ "name": "stderr",
19
+ "output_type": "stream",
20
+ "text": [
21
+ "C:\\Users\\ippe\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
22
+ " from .autonotebook import tqdm as notebook_tqdm\n"
23
+ ]
24
+ }
25
+ ],
26
  "source": [
27
  "from datasets import load_dataset, Dataset\n",
28
  "import pandas as pd\n",
 
38
  },
39
  {
40
  "cell_type": "code",
41
+ "execution_count": 3,
42
  "metadata": {},
43
  "outputs": [],
44
  "source": [
 
55
  },
56
  {
57
  "cell_type": "code",
58
+ "execution_count": null,
59
  "metadata": {},
60
  "outputs": [
61
  {
62
  "name": "stdout",
63
  "output_type": "stream",
64
  "text": [
65
+ "0\n",
66
  "Amount of duplications in unsupervised: 493\n",
67
  "Amount of duplications in train: 96\n",
68
  "Amount of duplications in test: 199\n",
69
+ "Amount of duplications combined: 418\n",
70
  "Amount of duplications between sets: 123\n"
71
  ]
72
  }
 
78
  "df_test = pd.DataFrame(dataset[\"test\"][:]) \n",
79
  "\n",
80
  "# Combine to check for duplication between sets (inspired by Pandas Docs)\n",
81
+ "frames = [ df_test, df_train]\n",
82
  "df_total = pd.concat(frames)\n",
83
  "\n",
84
  "# Calculate amount of duplicates for each dataframe\n",
 
91
  "print(\"Amount of duplications in train: \" + str(dups_train)) \n",
92
  "print(\"Amount of duplications in test: \" + str(dups_test )) \n",
93
  "print(\"Amount of duplications combined: \" + str(dups_total )) \n",
94
+ "print(\"Amount of duplications between sets: \" + str(dups_total - ( dups_train + dups_test)))\n",
95
+ "\n",
96
+ "\n"
97
  ]
98
  },
99
  {
 
106
  },
107
  {
108
  "cell_type": "code",
109
+ "execution_count": null,
110
  "metadata": {},
111
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  "source": [
113
  "\n",
114
  "# print(dataset)\n",
 
116
  "\n",
117
  "# check for any non-english characters\n",
118
  "\n",
119
+ "def is_not_english(text): # returns true for unicode > U+0386, which are not used in English\n",
120
+ " return re.sub(r'[\\u0386-\\u2010\\u2E7F-\\uD7FC]', '', text) \n",
121
  "\n",
122
  "def print_non_english_texts(text_set):\n",
123
  " for text in text_set:\n",
 
125
  " print(text)\n",
126
  " print('=' * 80)\n",
127
  "\n",
128
+ "# print_non_english_texts(dataset[\"unsupervised\"][\"text\"])\n",
129
+ "# print_non_english_texts(dataset[\"test\"][\"text\"])\n",
130
+ "# print_non_english_texts(dataset[\"train\"][\"text\"])\n"
131
  ]
132
  },
133
  {
 
150
  },
151
  {
152
  "cell_type": "code",
153
+ "execution_count": 13,
154
  "metadata": {},
155
  "outputs": [],
156
  "source": [
 
164
  },
165
  {
166
  "cell_type": "code",
167
+ "execution_count": null,
168
  "metadata": {},
169
  "outputs": [
170
  {
171
+ "ename": "NameError",
172
+ "evalue": "name 'spacy' is not defined",
173
+ "output_type": "error",
174
+ "traceback": [
175
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
176
+ "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
177
+ "Cell \u001b[1;32mIn[12], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# load the English model\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m nlp \u001b[38;5;241m=\u001b[39m \u001b[43mspacy\u001b[49m\u001b[38;5;241m.\u001b[39mload(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124men_core_web_sm\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# create pandas dataframe of text only\u001b[39;00m\n\u001b[0;32m 5\u001b[0m texts_unsupervised \u001b[38;5;241m=\u001b[39m df_unsupervised[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mtolist()\n",
178
+ "\u001b[1;31mNameError\u001b[0m: name 'spacy' is not defined"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  ]
180
  }
181
  ],
 
187
  "texts_unsupervised = df_unsupervised[\"text\"].tolist()\n",
188
  "texts_train = df_train[\"text\"].tolist()\n",
189
  "texts_test = df_test[\"text\"].tolist()\n",
190
+ "texts_total = df_total[\"text\"].tolist()\n",
191
+ "\n",
192
  "\n",
193
  "texts_unsupervised = [str(text) for text in texts_unsupervised]\n",
194
  "texts_train = [str(text) for text in texts_train]\n",
195
  "texts_test = [str(text) for text in texts_test]\n",
196
+ "texts_total = [str(text) for text in texts_total]\n",
197
  "\n",
198
  "# Custom language detector factory function\n",
199
  "@Language.factory(\"language_detector\") \n",
 
214
  "english_checks_unsupervised = [is_not_english(text) for text in tqdm(texts_unsupervised, desc=\"Checking if texts are not in English\")] \n",
215
  "english_checks_train = [is_not_english(text) for text in tqdm(texts_train, desc=\"Checking if texts are not in English\")] \n",
216
  "english_checks_test = [is_not_english(text) for text in tqdm(texts_test, desc=\"Checking if texts are not in English\")] \n",
217
+ "english_checks_total = [is_not_english(text) for text in tqdm(texts_test, desc=\"Checking if texts are not in English\")] \n",
218
  "\n",
219
  "# Print the amount of non-english texts:\n",
220
  "print(\"Amount of non-english texts in unsupervised: \" + str(sum(english_checks_unsupervised)))\n",
 
222
  "print(\"Amount of non-english texts in test: \" + str(sum(english_checks_test)))"
223
  ]
224
  },
225
+ {
226
+ "cell_type": "markdown",
227
+ "metadata": {},
228
+ "source": []
229
+ },
230
  {
231
  "cell_type": "code",
232
  "execution_count": 12,
 
292
  },
293
  {
294
  "cell_type": "code",
295
+ "execution_count": 14,
296
  "metadata": {},
297
  "outputs": [
298
  {
299
  "name": "stderr",
300
  "output_type": "stream",
301
  "text": [
302
+ "Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 50000/50000 [00:03<00:00, 16119.02 examples/s]\n"
 
 
 
 
 
 
 
303
  ]
304
  },
305
  {
 
308
  "text": [
309
  "['This is just a precious little diamond. The play, the script are excellent. I cant compare this movie with anything else, maybe except the movie \"Leon\" wonderfully played by Jean Reno and Natalie Portman. But... What can I say about this one? This is the best movie Anne Parillaud has ever played in (See please \"Frankie Starlight\", she\\'s speaking English there) to see what I mean. The story of young punk girl Nikita, taken into the depraved world of the secret government forces has been exceptionally over used by Americans. Never mind the \"Point of no return\" and especially the \"La femme Nikita\" TV series. They cannot compare the original believe me! Trash these videos. Buy this one, do not rent it, BUY it. BTW beware of the subtitles of the LA company which \"translate\" the US release. What a disgrace! If you cant understand French, get a dubbed version. But you\\'ll regret later :)', 'When I say this is my favourite film of all time, that comment is not to be taken lightly. I probably watch far too many films than is healthy for me, and have loved quite a few of them. I first saw \"La Femme Nikita\" nearly ten years ago, and it still manages to be my absolute favourite. Why?This is more than an incredibly stylish and sexy thriller. Luc Besson\\'s great flair for impeccable direction, fashion, and appropriate usage of music makes this a very watchable film. But it is Anne Parillaud\\'s perfect rendering of a complex character who transforms from a heartless killer into a compassionate, vibrant young woman that makes this film beautiful. I can\\'t keep my eyes off of her when she is on screen.I have seen several of Luc Besson\\'s films including \"Subway\", \"The Professional\", and the irritating \"Fifth Element\", and \"Nikita\" is without a doubt, far superior to any of these. Although this film has tragic elements, it is ultimately extremely hopeful. It is the story of a person who is cruel and merciless, who ultimately comes to realize her own humanity and her own personal power. That, to me is extremely inspiring. If there is hope for Nikita, there is hope for all of us.', 'I saw this movie because I am a huge fan of the TV series of the same name starring Roy Dupuis and Pet Wilson. The movie was really good and I saw how the TV show is based on the movie. A few episodes of the TV series came directly from the movie and their similarity was amazing. To keep things short, any fan of the movie has to watch the series and any fan of the series must see the original Nikita.', \"Being that the only foreign films I usually like star a Japanese person in a rubber suit who crushes little tiny buildings and tanks, I had high hopes for this movie. I thought that this was a movie that wouldn't put me to sleep. WRONG! Starts off with a bang, okay, now she's in training, alright, she's an assassin, I'm still with you, oh, now she's having this moral dilemma and she can't decide if she loves her boyfriend or her controller, zzzzz.... Oh well, back to Gamera!\", \"After seeing Point of No Return (a great movie) and being told that the original was better, I was certainly thrilled to see that one of the indie film channels was running La Femme Nikita. Then I saw the movie. Ouch! This was a major let-down.Nikita herself reminds me of Jar Jar Binks more than any other character I've seen recently. She comes across entirely as comic relief. The movie simply has nothing to recommend it besides the core concept of an evil, inhuman character paradoxically learning to be human while training as an assassin, and that concept failed miserably in Nikita due to the poor writing of the title role.\", 'Stylish thriller? Hardly! This French action film from director Luc Besson is more confused and unsure about itself than anything else I have seen recently.The opening action sequence shows some promise, and the following action sequences are good. However they are sadly too few and far between. The drama is dull and erratic, and the characters are generally unlikeable. Anne Parillaud and the support cast are unable to involve the audience emotionally.\"La Femme Nikita\" ends up more like a try hard, B-grade action thriller. Very average!Saturday, April 28, 1991 - Balwyn Cinema', \"A Luc Besson (LΓ©on, The Fith Element, The Messenger: The Story of Joan of Arc. Angel-A) film with Anne Parillaud (Innocent Blood), TchΓ©ky Karyo(The Messenger: The Story of Joan of Arc, The Patriot, Kiss of the Dragon) and Jean Reno (LΓ©on , The Crimson Rivers, Godzilla). It doesn't get better than this.The photography by Thierry Arbogast was perfect, especially the blue lighting at the pharmacy scene. It is easy to see why Besson uses him for his films. He is a master.Parillaud was absolutely magnificent in a character that was a strong woman, and a little girl at the same time. She was a profession, but she was also human. To see this instead of the comic book characters we are so familiar with is refreshing.Reno was a perfect cleaner. Hard and professional. Get the mission done.Jean-Hugues Anglade added just the right touch of sensitivity. Outstanding! There are just not enough superlatives to use in describing the acting and action in the film.\", 'This isn\\'t my typical movie genre. I am more interested in character drama than action movies. This is able to span both genres in a way that Hollywood hasn\\'t managed to accomplish. The plot was interesting and the acting by Anne Parillaud was exceptional.I had seen the American remake, called \"Point of No Return\" and found it to be an OK movie, but I wanted to see the original. I am glad that I did. The technical aspects of direction and editing are very good. The plot was interesting - revolving around the timeless theme of redemption. The acting made this an exceptional movie.For fans of the action genre, they will be quite happy. For those like myself who are more interested in character and plot-driven movies may find this to be a pleasant surprise as well.', \"La Femme Nikita (1990) was a great movie from genre director Luc Besson. The story is about a drugged out young woman (Anne Parillund) who's hung out with the wrong crowd one too many times. During a botched drug store robbery and subsequent shoot out with the police, NIkita is the only survivor. She's tried, sentenced and executed. But, she wakes up in a strange room and greeted by a quiet and subdued individual (Tcheky Kayro) he tells her that she's been given a second chance at life. But will she do what needs to be done in order for her to receive. Will Nikita take this opportunity at a second life or will she throw it all away? Watch LA FEMME NIKITA to find out.The always imitated by never properly duplicated chic thriller has become a fixture in pop culture. Not only was this film remade several times but it also spawned an unrelated television series. Anne Parillund is super hot in her role as Nikita. Watch out for Luc Besson regular Jean Reno as Victor the Cleaner.Highly recommended.\", 'Luc Besson has been behind some of the most provocative and intriguing action films of the last 15 years, and his introduction to mainstream American cinema-goers began with 1991\\'s \"La Femme Nikita.\" Beginning with a drug store shootout that leaves three junkie punkers and a few policemen dead, this film is rapidly engaging and shows off Besson\\'s violent chic. In the fray, only young Nikita (Anne Parillaud) survives, after offing a policeman who had let his guard down at a crucial moment. Facing certain death in France\\'s court of law, she is given two choices: lethal injection, or have her execution faked, and then assume a new life as a female super-assassin/spy. A wild-raised feral child of sorts, Nikita had picked up certain skills on the street that eventually prove to be quite valuable to her government handlers, as she makes things difficult for them and especially her chief mentor Bob (Tcheky Karyo). No secret is made of his affections for her, but he tries to mold Nikita into a valuable person, and he\\'s able to do it with the help of another agent, played by actress Jeanne Moreau, who teaches her the finer ways of womanhood. By the end of her training, Nikita has been modeled into a fine, sexy female assassin. Besson makes no attempts to sacrifice his film in the ways of Hollywood convention, and he proves that the days of female-driven action cinema are not yet dead. Parillaud is compelling, as at first, she almost seems unaware of her identity as a woman. When she isn\\'t taking out high-powered political officials, she\\'s romancing a kind and gentle shop clerk, who falls madly in love with her as she does with him. Lastly, \"La Femme Nikita\" has some of the most stylized and violent action scenes of any movie I\\'ve seen in a while. Luc Besson, with this film and much of his subsequent work, has proved he is one of cinema\\'s most valuable personalities on the European, Asian, and American action film circuits. Also, be aware of a cameo by future Besson \"Leon\" (1994) star Jean Reno as Victor the Cleaner, in what is pretty much an early prototype of his role from that star-making breakthrough film.8/10']\n"
310
  ]
 
 
 
 
 
 
 
311
  }
312
  ],
313
  "source": [
 
321
  " return dataset\n",
322
  "\n",
323
  "dataset[\"unsupervised\"] = dataset[\"unsupervised\"].map(remove_html_elements_dataset)\n",
324
+ "print(dataset[\"unsupervised\"][\"text\"][:10])\n"
325
  ]
326
  },
327
  {
 
335
  },
336
  {
337
  "cell_type": "code",
338
+ "execution_count": 15,
339
  "metadata": {},
340
  "outputs": [
341
  {
342
  "name": "stderr",
343
  "output_type": "stream",
344
  "text": [
345
+ "Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 50000/50000 [00:02<00:00, 17272.17 examples/s]\n"
346
  ]
347
  },
348
  {
 
364
  " return dataset\n",
365
  "\n",
366
  "dataset[\"unsupervised\"] = dataset[\"unsupervised\"].map(lower_texts_dataset)\n",
367
+ "print(dataset[\"unsupervised\"][\"text\"][:10])\n"
368
+ ]
369
+ },
370
+ {
371
+ "cell_type": "markdown",
372
+ "metadata": {},
373
+ "source": [
374
+ "## Finalizing dataset\n",
375
+ "Now that we know all the functions are working correctly we can apply them to the dataset."
376
+ ]
377
+ },
378
+ {
379
+ "cell_type": "code",
380
+ "execution_count": 30,
381
+ "metadata": {},
382
+ "outputs": [
383
+ {
384
+ "name": "stdout",
385
+ "output_type": "stream",
386
+ "text": [
387
+ "New amount of duplicates in dataframe: 0\n",
388
+ " label\n",
389
+ "count 49580.000000\n",
390
+ "mean 0.501876\n",
391
+ "std 0.500002\n",
392
+ "min 0.000000\n",
393
+ "25% 0.000000\n",
394
+ "50% 1.000000\n",
395
+ "75% 1.000000\n",
396
+ "max 1.000000\n",
397
+ "Dataset({\n",
398
+ " features: ['text', 'label'],\n",
399
+ " num_rows: 49580\n",
400
+ "})\n"
401
+ ]
402
+ },
403
+ {
404
+ "name": "stderr",
405
+ "output_type": "stream",
406
+ "text": [
407
+ "Saving the dataset (1/1 shards): 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 49580/49580 [00:00<00:00, 668070.33 examples/s]\n"
408
+ ]
409
+ }
410
+ ],
411
+ "source": [
412
+ "# Remove duplicates\n",
413
+ "df_total = df_total.drop_duplicates()\n",
414
+ "\n",
415
+ "print(\"New amount of duplicates in dataframe: \" + str(df_total.duplicated().sum()))\n",
416
+ "\n",
417
+ "# remove non-english characters\n",
418
+ "df_total[\"text\"] = df_total[\"text\"].apply(is_not_english)\n",
419
+ "\n",
420
+ "# Remove HTML elements\n",
421
+ "df_total[\"text\"] = df_total[\"text\"].apply(remove_html_element)\n",
422
+ "\n",
423
+ "# Remove the row that contains the many amounts of \"blah\", since applying the Spacy Libary takes a lot of time, we have to filter out the text manualy. Inspired by: https://saturncloud.io/blog/how-to-remove-rows-from-pandas-data-frame-that-contains-any-string-in-a-particular-column/#:~:text=To%20remove%20rows%20from%20a%20pandas%20data%20frame%20that%20contains,a%20specified%20substring%20or%20not.\n",
424
+ "substring = 'blahblahblahblahblahblah'\n",
425
+ "filter = df_total['text'].str.contains(substring)\n",
426
+ "df_total = df_total[~filter]\n",
427
+ "\n",
428
+ "\n",
429
+ "# Set all texts to lowercase\n",
430
+ "df_total[\"text\"] = df_total[\"text\"].apply(lowercase_text)\n",
431
+ "\n",
432
+ "print(df_total.describe())\n",
433
+ "\n",
434
+ "df_total = df_total.reset_index(drop=True)\n",
435
+ "new_dataset = Dataset.from_pandas(df_total)\n",
436
+ "\n",
437
+ "print(new_dataset)\n",
438
+ "\n",
439
+ "# save dataset to disk, such that it can be used in training\n",
440
+ "new_dataset.save_to_disk(\"preprocessed_dataset\")\n"
441
  ]
442
  }
443
  ],