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

Descripción general

Casos de uso

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

Funcionalidades

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

Puntos finales de la API

Compare Text Similarity

Compares two texts and returns a cosine similarity score.

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

Parámetros

Nombre Tipo Obligatorio Descripción
text1 string Obligatorio The first text to compare.
text2 string Obligatorio The second text to compare.

Pruébalo

Demostración en vivo
Solicitud

The first text to compare.

The second text to compare.

Campos de respuesta

Campo Tipo Descripción
similarity number Cosine similarity score between the two texts, in the range [0, 1].
method string The algorithm used. Currently always 'cosine'.

Ejemplos de código

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"}'

Respuestas de error

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.

Preguntas frecuentes