Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ah-cog/4ae93b6f97457c0062fa to your computer and use it in GitHub Desktop.
Save ah-cog/4ae93b6f97457c0062fa to your computer and use it in GitHub Desktop.
Compute the semantic relatedness from the Terminal on OS X.

How to Estimate the Semantic Relatedness of Two Sentences

Try the online semantic relatedness demo at https://www.metamind.io/language/relatedness.

Comapare "kids in red shirts are playing in the leaves" to "three kids are jumping in the leaves":

curl --request GET 'https://www.metamind.io/language/relatedness/test?text_1=Kids+in+red+shirts+are+playing+in+the+leaves&text_2=Three+kids+are+jumping+in+the+leaves'

This returns the following JSON:

{
  "score": 3.7341414514824804
}

(Example) Repeatedly execute a command on the Terminal with a Bash script:

while true; do echo "Hello"; done;

Repeatedly comapare "kids in red shirts are playing in the leaves" to "three kids are jumping in the leaves":

while true; do curl --request GET 'https://www.metamind.io/language/relatedness/test?text_1=Kids+in+red+shirts+are+playing+in+the+leaves&text_2=Three+kids+are+jumping+in+the+leaves'; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment