Skip to content
StackDecode
AI & ML Atlas
Artificial IntelligencealgorithmInteractive simulation

Semantic Analysis

Works out what text means, not just how it is spelled.

The idea

Words that appear in similar contexts get similar vectors (embeddings). The meaning of a sentence can then be compared geometrically: "car" lies near "vehicle" and far from "banana". Cosine similarity measures the angle between two vectors.

cos(a, b) = a·b / (‖a‖‖b‖)

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

manwomankingqueenprinceprincessboygirlparislondoncatdog
  • word
  • nearest word

Each word is a point (a vector) placed so that related words sit near each other. Real embeddings have hundreds of dimensions; this map has two: left–right is gender, up–down is royalty.

1/4

Positions are hand-set to make the idea visible; real vectors are learned from text.

Step by step

  1. 1Map each word or sentence to a vector.
  2. 2Compare vectors with cosine similarity.
  3. 3Group or rank by similarity, or feed the vectors to a classifier.
  4. 4Optionally resolve word sense and relations between phrases.

Where it is used

Semantic search, duplicate detection, question answering.

Watch out for

Embeddings capture bias in their training data, and one vector per word cannot separate different senses.

Related