I have a fairly large corpus (500k new articles) in a dataframe in one column. The beginning of most (tho not all) articles has various random throw away text up to the phrase '(Reuters) - '
I have tried various permutations of the following regex trying to adjust the entire column in one shot with no luck as it either deletes chunks of the articles or does nothing.
r = re.compile(r'\A\b.*[Reuters]\b')
reuters3 = reuters2['story_text'].str.replace(r,'', regex=True)
Any ideas on how best to tackle this from a regex and pandas method perspective? thank you
Provided below is an example showing the general pattern of the text to be removed at the beginning (up to and including (Reuters) -), to keep in the middle get rid of and to get ride of at the end (everything following and including (Editing by...). The exact language, characters and length varies considerably tho across articles outside of these key cut off words.
By Chris Scicluna VALLETTA, Jan 1 (Reuters) - The Mediterranean island of Malta became the smallest member of the euro zone at the stroke of midnight on Tuesday....[various lines of article text]...public information campaign has been a widely acknowledged success. (Editing by Michael Winfrey) ((gavin.jones@reuters.com; +39-06-8522-4232; Reuters Messaging: gavin.jones.reuters.com@reuters.net)) Keywords: ECB EXPANSION/EURO MALTA