🎬 CineSage: AI-Powered Movie Recommendations Tailored to Your Mood! 🔮✨

6 min readMar 4, 2025

Are you tired of endlessly scrolling through Netflix, Prime Video, or Disney+ without finding the perfect movie? Wish there was an AI that could understand exactly what you’re in the mood for and suggest the best films accordingly?

Enter CineSage — an AI-powered movie recommendation system that tailors suggestions based on your mood, preferences, and feedback! Using cutting-edge Natural Language Processing (NLP), FAISS search, SBERT embeddings, and collaborative filtering, CineSage provides personalized, diverse, and multilingual recommendations. 🚀🍿

🌟 What is CineSage?

CineSage is an AI-powered hybrid movie recommendation system that combines content-based filtering (using movie descriptions & metadata) with collaborative filtering (using user preferences). It allows users to describe their ideal movie in natural language (e.g., “a time-travel thriller with a mind-blowing twist”) and get highly relevant recommendations instantly!

🚀 Features of CineSage

AI-powered movie recommendations using Sentence-BERT & FAISS.

Natural Language Querying — Just describe what you want to watch! 🎤

Hybrid Filtering — Combines content-based & collaborative recommendations.

Multilingual Support — Translate queries from any language! 🌍

Personalized Recommendations — Learns your preferences over time. ❤️

Movie Posters & Trailers — Fetches visuals from TMDb & YouTube APIs.

Filters — Search by year, genre, rating, director, writer, and runtime.

Diversity Optimization — Ensures a varied mix of movies. 🔀

🔥 How It Works

1️⃣ Query Processing & Understanding

When a user enters a natural language movie query, CineSage does the following:

  • Translates (if needed) using Google Translator.
def translate_query(query):
return GoogleTranslator(source="auto", target="en").translate(query)
  • Expands the query using WordNet synonyms (e.g., “scary” → “horror”).
def expand_query(query):
words = query.split()
expanded_query = []

for word in words:
synonyms = set()
for syn in wordnet.synsets(word):
for lemma in syn.lemmas():
synonyms.add(lemma.name().replace("_", " "))

if synonyms:
expanded_query.append(f"({word} {' '.join(synonyms)})")
else:
expanded_query.append(word)

return " ".join(expanded_query)
  • Extracts filters using regex (e.g., “movies after 2010 with a rating above 8”).
def extract_filters(query):
filters = {"year": None, "rating": None, "runtime": None, "director": None, "writer": None, "genres": None}


match = re.search(r"(after|before|in) (\d{4})", query)
if match:
year = int(match.group(2))
filters["year"] = (">", year) if match.group(1) == "after" else ("<", year) if match.group(1) == "before" else ("==", year)


match = re.search(r"rating (?:between|from) (\d+(\.\d+)?) and (\d+(\.\d+)?)", query)
if match:
filters["rating"] = (float(match.group(1)), float(match.group(3)))


match = re.search(r"(less|more) than (\d+) (?:minutes|hours)", query)
if match:
runtime = int(match.group(2)) * (60 if "hour" in query else 1)
filters["runtime"] = ("<", runtime) if match.group(1) == "less" else (">", runtime)


match = re.search(r"directed by ([\w\s]+)", query)
if match:
filters["director"] = match.group(1).strip()

match = re.search(r"written by ([\w\s]+)", query)
if match:
filters["writer"] = match.group(1).strip()


match = re.search(r"genre (is|like|contains) ([\w\s,]+)", query)
if match:
filters["genres"] = [g.strip() for g in match.group(2).split(",")]

return filters

def apply_filters(df, filters):
filtered_df = df.copy()

if filters["year"]:
op, year = filters["year"]
filtered_df = filtered_df.query(f"year {op} {year}")

if filters["rating"]:
low, high = filters["rating"]
filtered_df = filtered_df.query(f"rating >= {low} and rating <= {high}")

if filters["runtime"]:
op, runtime = filters["runtime"]
filtered_df = filtered_df.query(f"runtime {op} {runtime}")

if filters["writer"] and not filtered_df.empty:
choices = filtered_df["writer"].dropna().unique()
match = process.extractOne(filters["writer"], choices, scorer=fuzz.ratio)
if match and match[1] > 75:
best_match = match[0]
filtered_df = filtered_df[filtered_df["writer"] == best_match]

if filters["genres"] and not filtered_df.empty:
def fuzzy_genre_match(genre_list):
if pd.isna(genre_list):
return False
movie_genres = genre_list.split(", ")
return any(process.extractOne(genre, movie_genres, scorer=fuzz.ratio)[1] > 75 for genre in filters["genres"])

filtered_df = filtered_df[filtered_df["genres"].apply(fuzzy_genre_match)]

return filtered_df

2️⃣ Why SBERT for Content-Based Recommendations?

SBERT (Sentence-BERT) is an advanced transformer-based model that converts sentences into dense numerical vectors (embeddings). Unlike traditional BERT models, SBERT is optimized for semantic similarity search, making it perfect for movie recommendations.

How SBERT Works in CineSage:

  1. Embedding Generation — Each movie’s title, overview, and metadata are encoded into high-dimensional vectors using SBERT.
  2. Semantic Search — When a user enters a query, it is also encoded into an SBERT vector.
  3. Finding Similar Movies — SBERT embeddings allow CineSage to compare the query vector with movie vectors and retrieve the most similar ones.
  4. Understanding Context — Unlike keyword-based search, SBERT captures deeper semantic meanings and relationships between words. For example, it understands that “dystopian future” and “post-apocalyptic world” are closely related concepts.

3️⃣ Why FAISS for Efficient Search?

FAISS (Facebook AI Similarity Search) is a fast, scalable nearest-neighbor search library. It allows CineSage to quickly find movies similar to the user’s query in real-time, even when dealing with large datasets containing millions of movies.

How FAISS Works in CineSage:

  1. Vector Indexing — CineSage stores all movie embeddings in a FAISS index, making it highly efficient for searching.
  2. Approximate Nearest Neighbor (ANN) Search — Instead of comparing a query against all movies (which would be slow), FAISS quickly finds the top k most similar movie vectors.
  3. GPU Acceleration — FAISS runs on GPUs, making it much faster than traditional brute-force searches.

4️⃣ Movie Search & Hybrid Recommendations

  • Converts the query into SBERT embeddings.
  • Uses FAISS indexing to retrieve relevant movies efficiently.
  • Applies filtering & ranking to refine results.

5️⃣ User Preference-Based Recommendations

  • Stores liked & disliked movies.
  • Adjusts recommendations based on genre, director, writer, and rating preferences.
  • Uses collaborative filtering to suggest movies similar to those liked by users with similar tastes.

6️⃣ Hybrid & Diversified Recommendations

  • Merges content-based & collaborative results.
  • Balances exploration vs. exploitation.
  • Diversity optimization ensures a mix of mainstream & unique picks.

🎨 CineSage Interface

Built using Streamlit, the interface is sleek, user-friendly, and intuitive:

🔹 Sidebar Customization — Users can choose themes, input user ID, and customize preferences.

🔹 Movie Search Bar — Enter your movie preferences in plain English.

🔹 Dynamic Results Section — Shows movie posters, trailers, and key details.

🔹 Like/Dislike Buttons — Users can refine recommendations by interacting with movies.

🔹 Real-time Feedback System — The model updates based on user interactions.

🔧 Technologies Used

🛠 NLP & Embeddings — Sentence-BERT (all-MiniLM-L6-v2)

🛠 Vector Search – FAISS Indexing

🛠 Data Processing – Pandas, NumPy

🛠 UI Framework – Streamlit

🛠 APIs – TMDb (posters), YouTube (trailers)

🛠 Preference Learning – JSON-based User Preference Storage

🚀 Future Enhancements

🔹 User Accounts & Login System — Store preferences in the cloud.

🔹 Mobile App Version 📱 — Take CineSage on the go!

🔹 Enhanced NLP — Improve query understanding with advanced transformers.

🔹 More Streaming Services — Integrate Netflix, Prime Video, etc.

📌 Conclusion

CineSage revolutionizes movie recommendations by combining AI, NLP, and personalized learning. Unlike conventional recommendation systems that rely on rigid algorithms, CineSage truly understands what you want and adapts to your evolving preferences over time.

🔹 No more generic recommendations!

🔹 No more endless scrolling!

🔹 Just accurate, AI-powered suggestions tailored to you! 🎥✨

Try CineSage today and find your next favorite movie effortlessly! 🍿

📍 Follow & Share

#ArtificialIntelligence #DeepLearning #RecommendationSystem #MovieLovers #DataScience #AIforEntertainment #PythonProgramming #StreamlitApp #SBERT #FAISS #NLP #MachineLearningModels #MovieNight #TechInnovation #DataDriven #CineSage #AIRecommendations #SemanticSearch #VectorSearch #ContentBasedFiltering #CollaborativeFiltering #NetflixAndChill #MovieSuggestions

--

--

Abdullah Grewal
Abdullah Grewal

Written by Abdullah Grewal

0 Followers

Caffeine-fueled tech maestro, equally at home, building intelligent AI, machine learning, and NLP models as crafting seamless MERN stack applications.

No responses yet