#CountVectorizer
Laughing every time I use CountVectorizer()

Like what a fucking great name for a badass vampire or grimdark character, my goodness
February 10, 2026 at 1:53 AM
COUNTVECTORIZER and TFIDF VECTORIZER in NLP Explained | Dr. Deepika Sharma | Teacher Cool

Watch Full Video on youtube :
youtu.be/bU9WrU7rhn4

#CountVectorizer #TfidfVectorizer #NaturalLanguageProcessing #NLP #PythonProgramming #MachineLearning #TextProcessing #DataScience
November 20, 2024 at 9:41 AM
Microsoft Phi team avoids overfitting on benchmarks using a decontamination algo, removing data overlap via 7&13-gram counts. I want to implement this for my future work, must research efficient way. Looking at scikit-learn's implementation CountVectorizer may be a good start!
December 25, 2024 at 1:53 PM
Project Title:AI-Driven Social Media Sentiment Temporal Evolution Analysis using Pandas, VADER, and Dynamic Topic Modeling.

part 1Here is your advanced AI/ML/Data Science project, now available as a code file in the canvas below: # ai_driven_social_media_sentiment_analysis_dashboard.py import…
Project Title:AI-Driven Social Media Sentiment Temporal Evolution Analysis using Pandas, VADER, and Dynamic Topic Modeling.
part 1Here is your advanced AI/ML/Data Science project, now available as a code file in the canvas below: # ai_driven_social_media_sentiment_analysis_dashboard.py import streamlit as st import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import nltk from nltk.sentiment.vader import SentimentIntensityAnalyzer from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import LatentDirichletAllocation from wordcloud import WordCloud import datetime as dt import altair as alt import re import string nltk.download('vader_lexicon') sid = SentimentIntensityAnalyzer() # ------------------- Utility Functions ------------------- def clean_text(text: str) -> str: text = text.lower() text = re.sub(r'http\S+|www\S+|https\S+', '', text, flags=re.MULTILINE) text = re.sub(r'\@\w+|\#', '', text) text = text.translate(str.maketrans('', '', string.punctuation)) text = re.sub(r'[^\x00-\x7F]+', ' ', text) return text def get_sentiment(text: str) -> str: score: float = sid.polarity_scores(text)['compound'] if score >= 0.05: return 'positive' elif score <= -0.05: return 'negative' else: return 'neutral' # ------------------- Load Sample Data ------------------- @st.cache_data def load_data() -> pd.DataFrame: url: str = ' df: pd.DataFrame = pd.read_csv(url) df['tweet_created'] = pd.to_datetime(df['tweet_created']) df = df[['tweet_created', 'text']].rename(columns={'tweet_created': 'timestamp'}) df['text'] = df['text'].astype(str).apply(clean_text) df['sentiment'] = df['text'].apply(get_sentiment) df['date'] = df['timestamp'].dt.date return df # ------------------- Topic Modeling ------------------- def perform_topic_modeling(docs: pd.Series, n_topics: int = 5) -> LatentDirichletAllocation: vectorizer: CountVectorizer = CountVectorizer(stop_words='english') X = vectorizer.fit_transform(docs) lda: LatentDirichletAllocation = LatentDirichletAllocation(n_components=n_topics, random_state=42) lda.fit(X) return lda, vectorizer def display_topics(model: LatentDirichletAllocation, feature_names: list, n_top_words: int = 10) -> None: for topic_idx, topic in enumerate(model.components_): st.write(f"Topic #{topic_idx + 1}:", ", ".join( for i in topic.argsort()[:-n_top_words - 1:-1]])) # ------------------- Visualization ------------------- def plot_sentiment_distribution(df: pd.DataFrame) -> None: fig, ax = plt.subplots() sns.countplot(data=df, x='sentiment', ax=ax, palette='coolwarm') st.pyplot(fig) def plot_temporal_sentiment(df: pd.DataFrame) -> None: temporal_df: pd.DataFrame = df.groupby(['date', 'sentiment']).size().unstack(fill_value=0) st.line_chart(temporal_df) def generate_wordcloud(docs: pd.Series) -> None: text: str = ' '.join(docs.tolist()) wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text) fig, ax = plt.subplots(figsize=(10, 5)) ax.imshow(wordcloud, interpolation='bilinear') ax.axis('off') st.pyplot(fig) # ------------------- Streamlit UI ------------------- st.title("🧠 AI-Driven Social Media Sentiment Analysis Dashboard") with st.spinner("Loading and processing data..."): data = load_data() st.subheader("Sentiment Distribution") plot_sentiment_distribution(data) st.subheader("Temporal Evolution of Sentiment") plot_temporal_sentiment(data) st.subheader("Topic Modeling") date_option = st.date_input("Select a date for topic modeling", data['date'].min()) date_df: pd.DataFrame = data == date_option] if not date_df.empty: lda_model, vec = perform_topic_modeling(date_df['text']) display_topics(lda_model, vec.get_feature_names_out()) st.subheader("WordCloud for Selected Day") generate_wordcloud(date_df['text']) else: st.write("No data for selected date.") st.caption("ai-ml-ds-SrmZNuoOhMk | Completion Date: 2025-05-23") …
oluwadamilolaadegunwa.wordpress.com
May 24, 2025 at 4:39 AM