Similarity value differs for api call and api demo on UI

29 views
Skip to first unread message

Sergei Zagriychuk

unread,
May 3, 2019, 10:37:18 AM5/3/19
to Dandelion Support Forum
I need to get similarity score for 2 texts.

For example:
text1 = Don't miss the healthy recipes, suggested workouts and reviews of "We tried it!
text2 = Don't miss out on healthy recipes, recommended workouts, and 'we tried it!' reviews.

When I use api demo via UI https://dandelion.eu/semantic-text/text-similarity-demo/ I'm getting 100% of semantic similarity

At the same time when I hit GET api endpoint it returns me only 0.7435
Here is the call:

Response:
{"time":2,"similarity":0.7435,"lang":"en","timestamp":"2019-05-03T14:35:29.167"}

How is it possible? Am I missing something?

ber...@dandelion.eu

unread,
May 7, 2019, 5:07:52 AM5/7/19
to Dandelion Support Forum
Hi Sergei,
the demo should perform a "plain" call to the similarity API.

Please:
- check if you are setting the `bow` parameter in your calls
- try to make POST http calls instead of using GET method (check how the url is escaped)
- in general check if some pre-processing step modifies your text without "your control" (e.g., double quotes are removed)

On your example, performing a POST call, I obtain the result of the demo.
Here the code you can execute form a shell:

curl --request POST \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'token=***************&text1=Don'\''t%20miss%20the%20healthy%20recipes%2C%20suggested%20workouts%20and%20reviews%20of%20%22We%20tried%20it!&text2=Don'\''t%20miss%20out%20on%20healthy%20recipes%2C%20recommended%20workouts%2C%20and%20'\''we%20tried%20it!'\''%20reviews.'

Let us know if testing with the hints above helps you somehow

Regards

Giacomo Berardi
Dandelion team

Sergei Zagriychuk

unread,
May 9, 2019, 11:16:26 AM5/9/19
to Dandelion Support Forum
Hello Giacomo,

Many thanks, using of POST instead of GET helped me out!

Thank you,
Sergei
Reply all
Reply to author
Forward
0 new messages