X or Twitter is widely used for communication and expressing opinions, often containing personal messages, opinions, and views on various topics, particularly around significant events like the Indonesian general elections. These public opinions can be leveraged to understand political trends, enhance services, develop marketing strategies, observe pref- erences, and even prevent adverse events. However, the unstructured and informal nature of tweets, poses a significant challenge for sentiment analysis and text classification. This research explores the improvement of text classification using the fastText framework cou- pled with term weighting techniques namely TF-IDF, TF-RF, and TF-IDFC-RF, focusing on the context of the Indonesian Election 2024 by reconfiguring the input layer of fast- Text, eliminating irrelevant words from n-gram processed word vectors, and applying a term weighting technique that considers word occurrence and discriminating capacity. Ex- perimental results demonstrate that the proposed enhancements lead to improved model performance, particularly with the TF-RF term weighting method. The TF-RF model achieved the highest accuracy (0.887), precision (0.918), recall (0.929), and F1 score (0.923) compared to the based model fastText which only recieve accuracy of (0.865). These met- rics were chosen as they provide a comprehensive view of model performance: accuracy measures the overall correctness of the model across all classes, precision highlights the model’s e?ectiveness in identifying relevant instances, recall assesses the model’s ability to identify all relevant cases, and the F1 score balances the precision and recall, which is crucial in scenarios where both false positives and false negatives are equally costly. Such insights underscore the potential of optimized term weighting techniques in significantly enhancing fastText’s performance in text classification tasks, o?ering valuable implications for future research and practical applications in social media analysis and political trend prediction.