Semantic string similarity - poor results

My goal is to create a basic program that semantically compares strings and decides what is more similar (in terms of semantics) to which. At the moment, I did not want to build a new (doc2vec?) Model in NTLKor in SKlearnor in from scratch Gensim, but I wanted to test existing APIs that can perform semantic analysis.

In particular, I decided to test ParallelDots AI API, and for this reason I wrote the following program in python:

import  paralleldots

api_key = "*******************************************"

paralleldots.set_api_key(api_key)

phrase1 = "I have a swelling on my eyelid"
phrase2 = "I have a lump on my hand"
phrase3 = "I have a lump on my lid"

print(phrase1, " VS ", phrase3, "\n")
print(paralleldots.similarity(phrase1, phrase3), "\n\n")

print(phrase2, " VS ", phrase3, "\n")
print(paralleldots.similarity(phrase2, phrase3))

This is the answer I get from the API:

I have a swelling on my eyelid  VS  I have a lump on my lid 

{'normalized_score': 1.38954, 'usage': 'By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions', 'actual_score': 0.114657, 'code': 200} 


I have a lump on my hand  VS  I have a lump on my lid 

{'normalized_score': 3.183968, 'usage': 'By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions', 'actual_score': 0.323857, 'code': 200}

This answer pretty disappoints me. Obviously the phrase

I have a piece on my lid

almost semantically identical to the phrase

I have a swelling on my eyelid

and it’s also related to the phrase

I have a piece on my hand

, , , , . ParallelDots AI API .

, ParallelDots AI API API , Dandelion API .., . , API .

, ?

?

+4

Source: https://habr.com/ru/post/1696367/


All Articles