How to determine the extent to which two sentences are similar in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to determine the extent to which two sentences are similar in python

Given two paragraphs, what is the best algorithm using machine learning that determines the intent matching percentage. That is, the extent to which both the paragraphs mean the same. Edit 1: I'm especially looking for text comparison of universal statements like Asia is the largest continent. Or Java is an object oriented language. Or Crows are never white in colour. Thank you.

19th Apr 2019, 3:12 PM
Vivacious
2 Answers
+ 5
I cant answer your question but I believe it IS possible to some extent. I read about a recent study comparing news headlines created by humans vs machines. The machines were found to be equally competent in creating relevant and engaging content.This clearly would have required a sophisticated algorithm such as @Anna describes
17th Jun 2019, 8:10 AM
Helena
Helena - avatar
+ 4
The extent to which both of the paragraphs *mean* the same? I don't think there's a simple way to achieve that. You'd have to make the algorithm able to understand the deeper meaning of human language. Not even actual human beings necessarily agree about what a sentence means. Your algorithm would need to be able to handle sarcasm, irony, rhetorical questions etc. That's way beyond what "regular" machine learning can do. If you just want to compare the equality of several strings: https://code.sololearn.com/c5e2A9Z27bKn/?ref=app
19th Apr 2019, 3:26 PM
Anna
Anna - avatar