Bruce Nduko
All projects
LiveWebMobileAI

StudySphere

Student productivity platform with an AI assistant, autopilot planner, and focus tools.

studysphere.it.com
StudySphere screenshot

Problem

Students juggle deadlines, revision, and focus with scattered tools that don't talk to each other.

What I built

A student productivity platform combining an AI assistant ("Sage"), an autopilot planner, a focus timer, and an exam mode. Shipped on both web and Android.

Stack

WebAndroidAI assistant

The kind of code behind it

1from dataclasses import dataclass
2from math import sqrt
3
4@dataclass
5class Candidate:
6 id: str
7 text: str
8 vector: list[float]
9
10
11def tokenize(text: str) -> list[str]:
12 return [t.lower() for t in text.split() if t.isalpha()]
13
14
15def embed(tokens: list[str], vocab: dict[str, int]) -> list[float]:
16 vector = [0.0] * len(vocab)
17 for token in tokens:
18 if token in vocab:
19 vector[vocab[token]] += 1.0
20 return vector
21
22
23def cosine_similarity(a: list[float], b: list[float]) -> float:
24 dot = sum(x * y for x, y in zip(a, b))
25 norm_a = sqrt(sum(x * x for x in a))
26 norm_b = sqrt(sum(y * y for y in b))
27 if norm_a == 0 or norm_b == 0:
28 return 0.0
29 return dot / (norm_a * norm_b)
30
31
32def rank(query: str, candidates: list[Candidate], vocab: dict[str, int]) -> list[Candidate]:
33 query_vector = embed(tokenize(query), vocab)
34 scored = [
35 (cosine_similarity(query_vector, c.vector), c)
36 for c in candidates
37 ]
38 scored.sort(key=lambda pair: pair[0], reverse=True)
39 return [candidate for _, candidate in scored]