import re


def preprocess_tweet(tweetText):
	"""
		input: A Tweet

		Replaces username with USERNAME token and url with URL token
		Remove #, comma, full stop, digits, multiple alphabets in a word like woooooow to woow, multiple spaces

		returns: Processed tweet
	"""

	preprocessingTweet = re.sub( r'@([A-Za-z0-9_]+)' , "USERNAME" , tweetText )
	preprocessingTweet = re.sub( r"http\S+", 'URL' , preprocessingTweet )
	preprocessingTweet = re.sub( r"#" , '' , preprocessingTweet )
	preprocessingTweet = re.sub(r'[^\w\s]',' ',preprocessingTweet)
	preprocessingTweet = re.sub(r'(.)\1+', r'\1\1', preprocessingTweet)
	preprocessingTweet = re.sub(r'[0-9]+', '' , preprocessingTweet)
	preprocessingTweet = re.sub( r":([a-z0-9A-Z_]+)" , '' , preprocessingTweet )
	preprocessingTweet = re.sub(r"\b[pDo]\b", "", preprocessingTweet)
	preprocessingTweet = re.sub(r' +',' ',preprocessingTweet)

	preprocessedTweet = preprocessingTweet

	return preprocessedTweet