I am looking for a statistical or linguistic method that could give the degree of similarity between the meaning of two sentences. I have found in literature many distance measures (euclidean distance,..) but what i am looking for is how much a given sentence is close to other sentence semantically.

example: (S1) The beautiful cherry blossoms in Japan. (S2) The beautiful Japan.

S1 is the original sentence. S2 is the sentence obtained from S1 by deleting the words "cherry","blossoms" and "in".

so , suppose we have a similarity function DISTSIM(S1,S2) that has the two sentences S1 and S2 as parameters. I want this function to return a big distance between S1 and S2 since they do have different meaning. Because beautiful modifies cherry blossoms and not Japan.

  • 1
    First you have to define a coherent semantic universe, and then you have to metrize it. Before you start coding. Take a look at Framenet for starts.
    – jlawler
    Apr 16, 2014 at 15:04
  • Difficult. Such a function might be possible for syntactic similarity, but I can hardly imagine coming up with such a function for semantic similarity. Apr 16, 2014 at 15:07
  • 3
    The problem with the question that there is no universal notion of semantic similarity. It depends on context but more importantly on purpose. Why do you want to know two sentences are similar? That will determine what approach you need to take. Apr 18, 2014 at 9:34
  • "The beautiful tree blossoms in Japan". How close is it to "The beautiful Japan", given that the text can be parsed in two semantically meaningful ways, only one being a noun phrase. Does it say something about your original example.
    – babou
    May 16, 2014 at 21:31
  • @user3013252 As others pointed out, you need to make clear what your ultimate goal is. At the moment it is not clear whether you want to compare actual semantic content, or just whether two sentences share a certain number of words. -1 for now, I'll be happy to upvote after editing.
    – robert
    May 27, 2014 at 12:20

2 Answers 2


The specific examples you mentioned seem to contradict the general question you are asking. The sentence fragments, S1 and S2 has some surface-level similarity, but are very different semantically; the object that's beautiful is not the same.

Having said that, to answer your broader question, Semeval 2012 and 2013 focused on Semantic Textual Similarity.

Semantic Textual Similarity (STS) measures the degree of semantic equivalence. We are proposing this STS task as an initial attempt at creating a unified framework that allows for an extrinsic evaluation of multiple semantic components that otherwise have historically tended to be evaluated independently and without characterization of impact on NLP applications. As a pilot task for Semeval 2012, we will focus on refining the task definition as well as producing experimental results on how well existing approaches to semantic equivalence perform. In parallel, we will gather feedback from the community about establishing a shared software framework for building STS annotation systems. The shared STS framework will allow researchers across the globe to more easily replicate and improve upon innovations developed at other sites.

STS is related to both Textual Entailment (TE) and Paraphrase, but differs in a number of ways and it is more directly applicable to a number of NLP tasks. STS is different from TE inasmuch as it assumes bidirectional graded equivalence between the pair of textual snippets. In the case of TE the equivalence is directional, e.g. a car is a vehicle, but a vehicle is not necessarily a car. STS also differs from both TE and Paraphrase in that, rather than being a binary yes/no decision (e.g. a vehicle is not a car), STS is a graded similarity notion (e.g. a vehicle and a car are more similar than a wave and a car). This graded bidirectional nature of STS is useful for NLP tasks such as MT evaluation, information extraction, question answering, and summarization.

You can find the published papers at S12 and S13, the relevant sections of the ACL anthology.


You don't say what problem you are trying to solve. I guess you don't really want to feed those two strings into a function, and when it returns "42" you'll be done and happy!

Can you identify a relevant corpus - a set of documents that contain material 'like' or representative of the text you want to process? If so, you could use LSA - Latent Semantic Analysis, or PLSA - Probabilistic Latent Semantic Analysis.

These provide a distance metric (as commented by @jlawler) between phrases or word-sets, with respect to the reference corpus.

  • 1
    These comments are very useful, and will hopefully help OP to revise his question - but they should be posted as comments, not as an answer ;)
    – robert
    May 27, 2014 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.