Skip to content

Semantic similarity

Request

Calculate the semantic similarity between two text fragments, either in the same language or in different languages.

The request body should contain:

  • content1 (string) - The first text fragment.
  • language1 (string) - The IETF language code for content1.
  • content2 (string) - The second text fragment to compare.
  • language2 (string) - The IETF language code for content2.
  • settings (object) - Additional settings as per specifications. More information: Tisane API Configuration And Customization Guide.

The response is a number between 0 and 1, representing the similarity of the submitted text fragments.

Security
Tisane-API-Key
Headers
Content-Typestring
Example:application/json
Bodyapplication/jsonrequired
object
POST
/similarity
curl -i -X POST \
  https://api.tisane.ai/similarity \
  -H 'Content-Type: application/json' \
  -H 'Ocp-Apim-Subscription-Key: YOUR_API_KEY_HERE' \
  -d '{
    "language1": "en",
    "content1": "Franz Ferdinand was assassinated by a Serbian revolutionary",
    "language2": "en",
    "content2": "A Yugoslav radical assassinated Franz Ferdinand",
    "settings": {}
  }'

Responses

Successful response

Bodyapplication/json
number
Response
0.6190476190476191