Public opinion of political figures and policy significantly impacts general elections. Sentiment analysis, as a method to comprehend opinion and emotion in texts, requires the step of text preprocessing to improve data quality. However, textual data often encounters irrelevant words and ambiguous language. These conditions can impact the accuracy of sentiment analysis. Given the significance of precisely interpreting public opinion toward political figures, these issues may result in biased or inaccurate sentiment analysis outcomes. Irregular punctuation or unclear language can disturb the text's intended context, compromising sentiment analysis quality. Additionally, irrelevant words can obscure the focus of the analysis, causing fundamental changes in the original text's meaning. This research focuses on the impact of a specific preprocessing technique, namely Phrase Detection with N-Gram, on sentiment analysis of political figures. By applying this method, the study aims to detail the effects of using Bigram, Trigram, and Unigram on the quality of sentiment analysis, particularly in the context of political figures on Twitter and online media articles. This research indicates that using Bigram in Phrase Detection provides more significant results than Trigram and Unigram for most political figures at Twitter, with the highest accuracy score of 88,23%. Sentiment analysis of articles in online media also indicates various results depending on the type of N-Gram. The results indicate that using N-gram phrase detection can influence the accuracy of sentiment analysis, and the resulting accuracy values are pretty high.