Text Similarity

Compare two pieces of text and get a similarity score between 0 and 1 using cosine similarity on word-frequency vectors.

Get API Key

Vue d'ensemble

Cas d'utilisation

  • Duplicate content detection
  • Plagiarism checking
  • Search and recommendation relevance scoring
  • Document clustering and deduplication
  • FAQ matching and chatbot response selection

Fonctionnalités

Cosine similarity on bag-of-words vectors
Normalised score between 0 (no overlap) and 1 (identical)
Case-insensitive, punctuation-agnostic tokenisation
Fast, in-memory computation — no external ML model required

Points de terminaison de l'API

Compare Text Similarity

Compares two texts and returns a cosine similarity score.

POST
https://requiems.xyz/v1/text/similarity

Paramètres

Nom Type Requis Description
text1 string Requis The first text to compare.
text2 string Requis The second text to compare.

Essayez-le

Démo en direct
Requête

The first text to compare.

The second text to compare.

Champs de réponse

Champ Type Description
similarity number Cosine similarity score between the two texts, in the range [0, 1].
method string The algorithm used. Currently always 'cosine'.

Exemples de code

curl -X POST https://requiems.xyz/v1/text/similarity \
  -H "requiems-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text1": "The cat sat on the mat", "text2": "A cat was sitting on a mat"}'

Réponses d'erreur

validation_failed

One or both text fields are missing or empty.

bad_request

The request body is missing or malformed.

internal_error

Unexpected server error.

Foire aux questions