Text Embedding Similarity Playground
Enter one query sentence and up to 10 candidate sentences to compute and rank similarity scores using three lexical-overlap methods - Jaccard, cosine (bag-of-words), and simplified TF-IDF - a demo of the concept, not a real embedding model.
FreeOnline Tool
Loading…
How to Use
- Type the sentence you want to compare into the "Query sentence" box.
- Enter one or more candidate sentences into the "Candidate sentences" box, one per line, up to 10 (extra lines are automatically truncated).
- Click "Calculate Similarity" - results are sorted from highest to lowest cosine similarity.
- Each result row shows three similarity percentages (Jaccard, cosine, TF-IDF) plus a highlighted list of words shared between the query and that candidate.
- Click "Load Sample Data" to instantly fill in an AI-themed query sentence and 8 candidate sentences to try it out.
Features
- An info banner at the top explicitly states this tool simulates similarity via lexical overlap - it is not a real neural-network-generated embedding vector
- Chinese text is tokenized character by character; English/numeric text is tokenized into contiguous alphanumeric words (length greater than 1)
- Jaccard similarity: intersection over union of the query's and candidate's token sets
- Cosine similarity: builds term-frequency bag-of-words vectors and computes the cosine of the angle between them
- Simplified TF-IDF similarity: treats the candidate set as a mini corpus to compute inverse document frequency, then takes the cosine similarity of the resulting TF-IDF vectors
- Automatically lists the words shared between the query and each candidate as highlighted tags
- Supports batch comparison against up to 10 candidates, auto-sorted by cosine similarity
Use Cases
Build intuition for embedding-based similarity
Before wiring up a real vector database or embedding API, use this tool to see how "text similarity" gets quantified from lexical overlap into a percentage score.
Compare different similarity algorithms side by side
Run the same query and candidates through Jaccard, cosine, and TF-IDF and see why the scores differ - a hands-on way to understand each algorithm's sensitivity to term frequency and document length.
Teach the retrieval step of RAG pipelines
When explaining the "retrieve candidate documents" step of retrieval-augmented generation to a team, use this simplified lexical-overlap model to illustrate the ranking logic without diving into neural network internals.
Spot-check keyword coverage in candidate text
Use the "matching words" highlight to quickly see which terms a candidate shares with the query - handy for a first-pass keyword check or a lightweight duplicate-content screen.
FAQ
Does this tool call OpenAI's or another provider's real embedding API to compute similarity?
No. As the banner at the top states, it uses lexical-overlap methods (Jaccard/cosine/TF-IDF) computed entirely in your browser - it never calls a real neural embedding model or makes any network request.
Two sentences mean almost the same thing but use different words - why is the score low?
Because the tool relies on surface-level word overlap and can't recognize "semantically similar but differently worded" text. A real embedding model, trained via a neural network, captures that deeper similarity; this tool is intentionally a simplified demo.
What happens if I enter more than 10 candidate sentences?
The tool automatically truncates to the first 10 and updates the candidate text box accordingly; anything beyond that isn't included in the calculation.
Is Chinese tokenized the same way as English?
No. Chinese text is split into individual characters as tokens, while English and numeric text is split into contiguous alphanumeric strings (with a minimum length of 2 characters - single letters are filtered out).
What corpus is the "inverse document frequency" in the TF-IDF score based on?
It's computed from the current set of candidate sentences plus the query as a temporary corpus for that one calculation - nothing from previous inputs is retained.