feat: Implement Target Word Context Drift Visualizer using BERT

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
fastapi, nextjs, python, typescript

Research direction

Start with the proposed FastAPI /api/context-drift endpoint and Next.js /context-drift route. Define the model-output and visualization flow from the checklist, then verify that two contexts produce target-word representations, a 2D comparison, cosine similarity, and the specified visual display.

Written by the indexing model from the issue text.

Description

Description

Word2Vec produces static vectors where "bank" (savings) and "bank" (river) share the same representation. This issue aims to build a feature where a user can enter a target word and two distinct sentences to visualize how the target word's embedding "drifts" in space based on semantic context.

Implementation Checklist
  • Python API Endpoint:
    • Create a FastAPI endpoint /api/context-drift that accepts:
      • word (string)
      • context_a (string containing word)
      • context_b (string containing word)
    • Load a lightweight transformer model (e.g., bert-base-uncased or distilbert-base-uncased).
    • Extract the token representation for the target word from the final layer in both contexts.
    • Return the raw dimensions (projected via PCA/t-SNE to 2D) and the cosine similarity between the two contextual states.
  • Next.js Frontend:
    • Build a clean interface at /context-drift with form inputs.
    • Render a visual 2D vector comparison graph (using SVG or Framer Motion) showing the displacement/drift between the two contexts.
    • Display the cosine similarity score with dynamic color-coding (closer = bright gold, further = faded cyan).
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from scheuclu/language_drift

All issues in scheuclu/language_drift

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.