|
text = re.sub(r"@[A-Z,0-9]+", "@user", text) |
For example, the text
"@realDonaldTrump and @KamalaHarris are running for president" is preprocessed to "@realDonaldTrump and @useramalaHarris are running for president"
This could be fixed by passing flags=re.IGNORECASE) to the re.sub call.