def strip_tweet ( text , remove_url = True ) : if remove_url : text = url_pattern . sub ( '' , text ) else : text = expand_url ( text ) text = mention_pattern . sub ( '' , text ) text = html_parser . unescape ( text ) text = text . strip ( ) return text
removing mentions, emojis and hashtags from a tweet python
Strip tweet message .
def strip_tweet(text, remove_url=True):
    """Strip tweet message.

    This method removes mentions strings and urls(optional).

    :param text: tweet message
    :type text: :class:`str`

    :param remove_url: Remove urls. default :const:`True`.
    :type remove_url: :class:`boolean`

    :returns: Striped tweet message
    :rtype: :class:`str`

    """
    if remove_url:
        text = url_pattern.sub('', text)
    else:
        text = expand_url(text)
    text = mention_pattern.sub('', text)
    text = html_parser.unescape(text)
    text = text.strip()
    return text