Zeb commited on
Commit
0e4956d
1 Parent(s): ce43a94

Clean up data a bit more

Browse files
clean/10M/gutenberg.txt CHANGED
The diff for this file is too large to render. See raw diff
 
clean/10M/simple_wikipedia.txt CHANGED
@@ -33286,7 +33286,8 @@ guns n' roses first recordings were for a planned ep in march 1985, shortly afte
33286
  however, the ep did not happen, as original guitarist tracii guns left the band, being replaced by slash.
33287
  shortly afterward, a new lineup of axl rose, duff mckagan, slash, steven adler and izzy stradlin was confirmed.
33288
  this is the classic lineup for the band.
33289
- after playing many shows in los angeles clubs, the group signed with geffen records in march 1986. in december 1986, the group released the four-song ep "live ?!
 
33290
  *@ like a suicide", which was made to keep people interested in the band while it started work in the studio.
33291
  the label also thought the band didn't have enough songs, so they made the ep.
33292
  singer axl rose said that many of the songs on the album were written while the band was performing on the los angeles club circuit, and a number of songs that would be featured on later guns n' roses albums were considered for "appetite for destruction", such as "back off bitch", "you could be mine", "november rain" and "don't cry".
@@ -44544,8 +44545,8 @@ since no one won more than half the vote, they went into a second round.
44544
  carter won the democratic nomination with 59% of the vote against sanders's 40%.
44545
  in the general election, carter beat republican candidate hal suit, winning 59% of the vote against suit's 40%.
44546
  governor of georgia, 1971–1975.
44547
- carter became the 76th governor of georgia on january 12, 1971. in his inaugural speech, he said that "the time of racial discrimination is over.
44548
- ... no poor, rural, weak, or black person should ever have to bear the additional burden of being [without] the opportunity for an education, a job or simple justice".
44549
  "time" ran a story on the progressive "new south" governors elected that year in a may 1971 cover.
44550
  the cover of the magazine had carter.
44551
  lester maddox, who carter replaced as governor, became lieutenant governor.
@@ -100627,11 +100628,15 @@ checkmate can be written as # or ++.
100627
  at the end of the game, 1–0 means "white won", 0–1 means "black won" and ½-½ is a draw.
100628
  chess moves can also be shown with punctuation marks and other annotation symbols.
100629
  for example: !
100630
- means a good move, !!
 
100631
  means a very good move, ?
100632
- means a bad move, ??
100633
- a very bad move (sometimes called a "blunder"), !?
100634
- a creative move that may be good, and ?!
 
 
 
100635
  a doubtful move.
100636
  for example, one kind of a simple "trap" known as the scholar's mate, as in the diagram to the right, may be recorded in full notation:
100637
  1. e2-e4 e7-e5<br>
 
33286
  however, the ep did not happen, as original guitarist tracii guns left the band, being replaced by slash.
33287
  shortly afterward, a new lineup of axl rose, duff mckagan, slash, steven adler and izzy stradlin was confirmed.
33288
  this is the classic lineup for the band.
33289
+ after playing many shows in los angeles clubs, the group signed with geffen records in march 1986. in december 1986, the group released the four-song ep "live ?
33290
+ !
33291
  *@ like a suicide", which was made to keep people interested in the band while it started work in the studio.
33292
  the label also thought the band didn't have enough songs, so they made the ep.
33293
  singer axl rose said that many of the songs on the album were written while the band was performing on the los angeles club circuit, and a number of songs that would be featured on later guns n' roses albums were considered for "appetite for destruction", such as "back off bitch", "you could be mine", "november rain" and "don't cry".
 
44545
  carter won the democratic nomination with 59% of the vote against sanders's 40%.
44546
  in the general election, carter beat republican candidate hal suit, winning 59% of the vote against suit's 40%.
44547
  governor of georgia, 1971–1975.
44548
+ carter became the 76th governor of georgia on january 12, 1971. in his inaugural speech, he said that "the time of racial discrimination is over. ...
44549
+ no poor, rural, weak, or black person should ever have to bear the additional burden of being [without] the opportunity for an education, a job or simple justice".
44550
  "time" ran a story on the progressive "new south" governors elected that year in a may 1971 cover.
44551
  the cover of the magazine had carter.
44552
  lester maddox, who carter replaced as governor, became lieutenant governor.
 
100628
  at the end of the game, 1–0 means "white won", 0–1 means "black won" and ½-½ is a draw.
100629
  chess moves can also be shown with punctuation marks and other annotation symbols.
100630
  for example: !
100631
+ means a good move, !
100632
+ !
100633
  means a very good move, ?
100634
+ means a bad move, ?
100635
+ ?
100636
+ a very bad move (sometimes called a "blunder"), !
100637
+ ?
100638
+ a creative move that may be good, and ?
100639
+ !
100640
  a doubtful move.
100641
  for example, one kind of a simple "trap" known as the scholar's mate, as in the diagram to the right, may be recorded in full notation:
100642
  1. e2-e4 e7-e5<br>
clean/10M/wikipedia.txt CHANGED
@@ -10240,7 +10240,7 @@ he observed a dearth of interdisciplinary art spaces in los angeles the likes of
10240
  this impetus propelled initiatives for commissioned works, artist residencies, collaborations, and public programs to facilitate dialogue on the creative city within the world arts arena.
10241
  harvey lichtenstein, president and executive producer of the brooklyn academy of music, was brought in as a consultant during the development phases of redcat during 1999.
10242
  the performances at redcat are funded and presented in part by the redcat council.
10243
- current council members include: diane levine (chair), edgar d. arceneaux, joseph m. cohen, rita cohen, neda disney, tim disney, fariba ghaffari, richard j. grad, r. stephen maguire, antonio mejias-rentas, seth polen, kevin ratner, abby sher, michael skloff, alex westerman, adele yellin and ravi rajan, (president, calarts).
10244
  clare nasir (born 20 june) is an english meteorologist and tv presenter.
10245
  born in milton keynes, buckinghamshire, her family is musical, with nasir playing the saxophone, while three of her brothers are professional musicians.
10246
  nasir attended kingsbrook school in south northamptonshire, where in 1988 she obtained a-levels in mathematics, geography and history.
@@ -25352,8 +25352,8 @@ on may 2, 2009, the day of pacquiao's fight against ricky hatton, mayweather ann
25352
  márquez had previously fought pacquiao in two controversial outings: they fought to a 12-round draw on may 8, 2004, and pacquiao was awarded a 12-round split decision win on march 15, 2008. mayweather played down pacquiao's newfound stardom at his press conference, stating: "if he wins tonight, don't be all shocked ... cause guess what?
25353
  i beat (hatton) when he was undefeated.
25354
  pacquiao beat oscar, it don't matter.
25355
- going down to 147 pounds was too much for (de la hoya), he was dead after the first round.
25356
- ... when you talk boxing, you talk floyd mayweather."
25357
  pacquiao would go on to defeat hatton by a second-round knockout to win "the ring" junior welterweight title.
25358
  the win made him the second boxer in history to win titles in six weight divisions, the first being oscar de la hoya.
25359
  mayweather vs. márquez was postponed until september 19, 2009, due to a rib injury suffered by mayweather.
 
10240
  this impetus propelled initiatives for commissioned works, artist residencies, collaborations, and public programs to facilitate dialogue on the creative city within the world arts arena.
10241
  harvey lichtenstein, president and executive producer of the brooklyn academy of music, was brought in as a consultant during the development phases of redcat during 1999.
10242
  the performances at redcat are funded and presented in part by the redcat council.
10243
+ current council members include: diane levine (chair), edgar d. arceneaux, joseph m. cohen, rita cohen, neda disney, tim disney, fariba ghaffari, richard j. grad, r. stephen maguire, antonio mejias-rentas, seth polen, kevin ratner, abby sher, michael skloff, alex westerman, adele yellin and ravi rajan, (president, calarts).
10244
  clare nasir (born 20 june) is an english meteorologist and tv presenter.
10245
  born in milton keynes, buckinghamshire, her family is musical, with nasir playing the saxophone, while three of her brothers are professional musicians.
10246
  nasir attended kingsbrook school in south northamptonshire, where in 1988 she obtained a-levels in mathematics, geography and history.
 
25352
  márquez had previously fought pacquiao in two controversial outings: they fought to a 12-round draw on may 8, 2004, and pacquiao was awarded a 12-round split decision win on march 15, 2008. mayweather played down pacquiao's newfound stardom at his press conference, stating: "if he wins tonight, don't be all shocked ... cause guess what?
25353
  i beat (hatton) when he was undefeated.
25354
  pacquiao beat oscar, it don't matter.
25355
+ going down to 147 pounds was too much for (de la hoya), he was dead after the first round. ...
25356
+ when you talk boxing, you talk floyd mayweather."
25357
  pacquiao would go on to defeat hatton by a second-round knockout to win "the ring" junior welterweight title.
25358
  the win made him the second boxer in history to win titles in six weight divisions, the first being oscar de la hoya.
25359
  mayweather vs. márquez was postponed until september 19, 2009, due to a rib injury suffered by mayweather.
clean/dev/gutenberg.txt CHANGED
The diff for this file is too large to render. See raw diff
 
clean/dev/simple_wikipedia.txt CHANGED
@@ -22746,8 +22746,7 @@ word formation and phonological processes.
22746
  chapter 9 of handbook of japanese phonetics and phonology.
22747
  2015. ed.
22748
  by h. kubozono.
22749
- pp.
22750
- 363–395.
22751
  mouton de gruyter series handbooks of japanese language and linguistics.
22752
  2013 ito, junko, and armin mester.
22753
  prosodic subcategories in japanese.
@@ -37079,8 +37078,8 @@ sanders is more liberal on social issues such as supporting same-sex marriage, d
37079
  on november 15, 2015, in response to isis' attacks in paris, sanders said: "we [have got to] be tough, not stupid," in the war against isis.
37080
  he said that the united states should still welcome syrian refugees.
37081
  after donald trump's victory in the 2016 presidential elections, sanders said that the democratic party needs a "series of reforms" and "must break loose from its corporate establishment ties and, once again, become a grass-roots party of working people, the elderly and the poor."
37082
- in september 2017, sanders called saudi arabia "an undemocratic country that has supported terrorism around the world, it has funded terrorism.
37083
- ... they are not an ally of the united states".
37084
  in an october 2018 column for "the new york times", sanders called on the united states to end its backing of the saudi intervention in yemen and said congress should have authorized it first.
37085
  in june 2019, sanders called on brazilian authorities to release former president luiz inácio lula da silva from prison and drop all charges against him after leaked documents showed his arrest was politically motivated.
37086
  on july 9, 2019, sanders and representatives alexandria ocasio-cortez and earl blumenauer proposed legislation that would declare climate change a national and international emergency.
@@ -101394,8 +101393,7 @@ like plato before him, alexis de tocqueville believed that a statesman not only
101394
  when abraham lincoln became president of the united states in 1861, most people saw an awkward, rumpled country bumpkin.
101395
  he had never traveled to europe and was seen by the american people and foreign dignitaries alike as crude and unsophisticated.
101396
  the dutch minister reported of lincoln: “he and his wife seem like .
101397
- .
101398
- .
101399
  western farmers, and even in this country, where one has no right to be fastidious, their common manners and their ways expose them in unfortunate fashion to ridicule.” while many do not remember lincoln as a great foreign-policy president, he actually was.
101400
  like a true statesman, lincoln adeptly guided foreign policy at a time of great peril during the civil war when the united states was vulnerable to foreign intervention.
101401
  according to kevin peraino, lincoln "should be considered one of america’s seminal foreign-policy presidents — a worthy model for students of global affairs."
 
22746
  chapter 9 of handbook of japanese phonetics and phonology.
22747
  2015. ed.
22748
  by h. kubozono.
22749
+ pp. 363–395.
 
22750
  mouton de gruyter series handbooks of japanese language and linguistics.
22751
  2013 ito, junko, and armin mester.
22752
  prosodic subcategories in japanese.
 
37078
  on november 15, 2015, in response to isis' attacks in paris, sanders said: "we [have got to] be tough, not stupid," in the war against isis.
37079
  he said that the united states should still welcome syrian refugees.
37080
  after donald trump's victory in the 2016 presidential elections, sanders said that the democratic party needs a "series of reforms" and "must break loose from its corporate establishment ties and, once again, become a grass-roots party of working people, the elderly and the poor."
37081
+ in september 2017, sanders called saudi arabia "an undemocratic country that has supported terrorism around the world, it has funded terrorism. ...
37082
+ they are not an ally of the united states".
37083
  in an october 2018 column for "the new york times", sanders called on the united states to end its backing of the saudi intervention in yemen and said congress should have authorized it first.
37084
  in june 2019, sanders called on brazilian authorities to release former president luiz inácio lula da silva from prison and drop all charges against him after leaked documents showed his arrest was politically motivated.
37085
  on july 9, 2019, sanders and representatives alexandria ocasio-cortez and earl blumenauer proposed legislation that would declare climate change a national and international emergency.
 
101393
  when abraham lincoln became president of the united states in 1861, most people saw an awkward, rumpled country bumpkin.
101394
  he had never traveled to europe and was seen by the american people and foreign dignitaries alike as crude and unsophisticated.
101395
  the dutch minister reported of lincoln: “he and his wife seem like .
101396
+ . .
 
101397
  western farmers, and even in this country, where one has no right to be fastidious, their common manners and their ways expose them in unfortunate fashion to ridicule.” while many do not remember lincoln as a great foreign-policy president, he actually was.
101398
  like a true statesman, lincoln adeptly guided foreign policy at a time of great peril during the civil war when the united states was vulnerable to foreign intervention.
101399
  according to kevin peraino, lincoln "should be considered one of america’s seminal foreign-policy presidents — a worthy model for students of global affairs."
clean/dev/wikipedia.txt CHANGED
@@ -50873,8 +50873,8 @@ weller also returned the favour, appearing as a guest guitarist and backing voca
50873
  "heavy soul", the follow-up to the million-selling "stanley road", saw weller twist his sound again.
50874
  the album was more raw than its predecessor; weller was now frequently playing live in the studio in as few takes as possible.
50875
  the first single "peacock suit" reached no.
50876
- 5 in the uk singles chart, and the album reached no.
50877
- 2. success in the charts also came from compilations: "best of" albums by the jam and the style council charted, and in 1998 his own solo collection "modern classics" was a substantial success.
50878
  in 2000, while living in send, surrey, he released his fifth solo studio album, "heliocentric".
50879
  once again finding himself without a record contract, weller's "days of speed" worldwide tour provided him with the opportunity to view his works as one back catalogue, giving rise to a second successful live album in 2001.
50880
  "days of speed" contained live acoustic versions from the world tour of the same name, including some of his best-known songs from his solo career and the back catalogues of his the jam and the style council days.
 
50873
  "heavy soul", the follow-up to the million-selling "stanley road", saw weller twist his sound again.
50874
  the album was more raw than its predecessor; weller was now frequently playing live in the studio in as few takes as possible.
50875
  the first single "peacock suit" reached no.
50876
+ 5 in the uk singles chart, and the album reached no. 2.
50877
+ success in the charts also came from compilations: "best of" albums by the jam and the style council charted, and in 1998 his own solo collection "modern classics" was a substantial success.
50878
  in 2000, while living in send, surrey, he released his fifth solo studio album, "heliocentric".
50879
  once again finding himself without a record contract, weller's "days of speed" worldwide tour provided him with the opportunity to view his works as one back catalogue, giving rise to a second successful live album in 2001.
50880
  "days of speed" contained live acoustic versions from the world tour of the same name, including some of his best-known songs from his solo career and the back catalogues of his the jam and the style council days.
clean/test/gutenberg.txt CHANGED
The diff for this file is too large to render. See raw diff
 
clean/test/wikipedia.txt CHANGED
@@ -38882,8 +38882,8 @@ in april 2008, paterson asked the heads of all state agencies to cut their budge
38882
  in august 2008, he called a special emergency session of the legislature and enacted 6% across-the-board cuts in all state agencies.
38883
  he called another special session in november 2008 to trim an additional 3%, but this effort did not meet with success.
38884
  at his first state of the state address in january 2009, paterson said "my fellow new yorkers: let me come straight to the point—the state of our state is perilous.
38885
- new york faces an historic economic challenge, the gravest in nearly a century.
38886
- ... the pillars of wall street have crumbled.
38887
  the global economy is reeling.
38888
  trillions of dollars of wealth have vanished."
38889
  new york faced a budget deficit of $15 billion, and state debt approached $55 billion.
@@ -47427,12 +47427,10 @@ the black star passes is a collection of science fiction short stories by americ
47427
  the book is the first in campbell's arcot, morey and wade series, and is followed by the novels islands of space and invaders from the infinite.
47428
  the stories originally appeared in the magazines "amazing stories" and "amazing stories quarterly", and were "extensively edited" for book publication, with campbell's approval, by lloyd arthur eshbach.
47429
  "galaxy" reviewer groff conklin described the stories as "three creaking classics .
47430
- .
47431
- .
47432
  fun to read, [but] rococo antiques [without] believable characters, human relations, even logical plots."
47433
  boucher and mccomas dismissed the book as "a hopelessly outdated set of novelets .
47434
- .
47435
- .
47436
  of concern only to those who wish to observe the awkward larval stage of a major figure in science fiction."
47437
  p. schuyler miller described the stories as "old-fashioned fun which [campbell] no longer takes any more seriously than you need to."
47438
  see also: list of lunar eclipses and list of 17th-century lunar eclipses
 
38882
  in august 2008, he called a special emergency session of the legislature and enacted 6% across-the-board cuts in all state agencies.
38883
  he called another special session in november 2008 to trim an additional 3%, but this effort did not meet with success.
38884
  at his first state of the state address in january 2009, paterson said "my fellow new yorkers: let me come straight to the point—the state of our state is perilous.
38885
+ new york faces an historic economic challenge, the gravest in nearly a century. ...
38886
+ the pillars of wall street have crumbled.
38887
  the global economy is reeling.
38888
  trillions of dollars of wealth have vanished."
38889
  new york faced a budget deficit of $15 billion, and state debt approached $55 billion.
 
47427
  the book is the first in campbell's arcot, morey and wade series, and is followed by the novels islands of space and invaders from the infinite.
47428
  the stories originally appeared in the magazines "amazing stories" and "amazing stories quarterly", and were "extensively edited" for book publication, with campbell's approval, by lloyd arthur eshbach.
47429
  "galaxy" reviewer groff conklin described the stories as "three creaking classics .
47430
+ . .
 
47431
  fun to read, [but] rococo antiques [without] believable characters, human relations, even logical plots."
47432
  boucher and mccomas dismissed the book as "a hopelessly outdated set of novelets .
47433
+ . .
 
47434
  of concern only to those who wish to observe the awkward larval stage of a major figure in science fiction."
47435
  p. schuyler miller described the stories as "old-fashioned fun which [campbell] no longer takes any more seriously than you need to."
47436
  see also: list of lunar eclipses and list of 17th-century lunar eclipses
clean_data.py CHANGED
@@ -46,7 +46,7 @@ def clean_children_stories(lines):
46
  return new_lines
47
 
48
  def clean_gutenberg(lines):
49
- """ For gutenberg, we lowercase, remove italics, group lines into paragraphs and then split into sentences """
50
  # Get paragraphs
51
  paragraphs = []
52
  paragraph = ""
@@ -59,11 +59,16 @@ def clean_gutenberg(lines):
59
  else:
60
  paragraph += tmp_line + " "
61
 
 
 
 
62
  # Split into sentences using NLTK
63
  new_lines = []
64
  for paragraph in paragraphs:
65
- sentences = [s + '\n' for s in tokenize.sent_tokenize(paragraph) if s != '']
66
- new_lines.extend(sentences)
 
 
67
  return new_lines
68
 
69
  def clean_open_subtitles(lines):
@@ -72,9 +77,12 @@ def clean_open_subtitles(lines):
72
  new_lines = []
73
  for line in lines:
74
  new_line = line.lower()
75
- if new_line[0:2] == "- ":
 
 
 
76
  new_line = new_line[2:]
77
- if new_line[0] == "-":
78
  new_line = new_line[1:]
79
  new_line = ' ' + new_line
80
  for punct in punctuation:
 
46
  return new_lines
47
 
48
  def clean_gutenberg(lines):
49
+ """ For gutenberg, we lowercase, remove italics, group lines into paragraphs and then split into sentences. We also remove any lines containing '*' or 'p.' """
50
  # Get paragraphs
51
  paragraphs = []
52
  paragraph = ""
 
59
  else:
60
  paragraph += tmp_line + " "
61
 
62
+ # Bad characters - gutenberg has a lot of figures, footnotes, chapter names etc that we want to remove
63
+ bad_chars = ['*', 'p.', '=', '|', '[', ']', ' ', ' ', 'v.']
64
+
65
  # Split into sentences using NLTK
66
  new_lines = []
67
  for paragraph in paragraphs:
68
+ sentences = [s + '\n' for s in tokenize.sent_tokenize(paragraph) if s != '' and s[0] != '(']
69
+ sentences = [s for s in sentences if not any([c in s for c in bad_chars])]
70
+ if len(sentences) > 0:
71
+ new_lines.extend(sentences)
72
  return new_lines
73
 
74
  def clean_open_subtitles(lines):
 
77
  new_lines = []
78
  for line in lines:
79
  new_line = line.lower()
80
+ # Skip music lines
81
+ if '♪' in new_line or '[' in new_line or ']' in new_line:
82
+ continue
83
+ if new_line[0:2] in ["- ", "– ", "— "]:
84
  new_line = new_line[2:]
85
+ if new_line[0] in ["-", "–", "—"]:
86
  new_line = new_line[1:]
87
  new_line = ' ' + new_line
88
  for punct in punctuation: