Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (15 sloc) 851 Bytes
from pysemantics.NlpClient import NlpClient
def similarity_example():
# first and second can be two urls, two texts, or one url and one text
first = ''
second = ''
client = NlpClient()
similarity = client.similarity(first=first, second=second)
# Output:
# {'similarity': 0.9516085802597031}
# two different articles, writen by different authors, but they are about the same topic
# we don't compare syntactic similarity here, we compare semantic similarity
# the meaning of both text is quite similar, in fact everything with similarity more
# than 0.6 is quite similar
You can’t perform that action at this time.