From a47fe40b78548a70efda533102dfbc7711250406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20MUREAU?= Date: Wed, 16 Jul 2025 11:47:34 +0200 Subject: [PATCH] preprocess function order changed --- functions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions.py b/functions.py index 4346fe4..dd13e66 100644 --- a/functions.py +++ b/functions.py @@ -65,6 +65,9 @@ def preprocess_tweet(tweet): if not isinstance(tweet, str): return "" + # Decode HTML entities (e.g., & to &) + tweet = html.unescape(tweet) + # Convert to lowercase tweet = tweet.lower() @@ -77,9 +80,6 @@ def preprocess_tweet(tweet): # Separate hashtags from words to facilitate tokenization tweet = re.sub(r'#(\w+)', r'# \1', tweet) - # Decode HTML entities (e.g., & to &) - tweet = html.unescape(tweet) - # Remove unwanted punctuation and special characters except some useful ones tweet = re.sub(r'[^\w\s<>@#!?]', '', tweet)