'Returns the semantic similarity of the given synsets (0.0-1.0).
synsets("cat")[0].similarity(synsets("dog")[0]) => 0.86.
synsets("cat")[0].similarity(synsets("box")[0]) => 0.17.'

def similarity(self, synset):

    if (self == synset):
        return 1.0
    try:
        lin = ((2.0 * log(lcs(self, synset).ic)) / (log((self.ic * synset.ic)) or 1))
    except OverflowError:
        lin = 0.0
    except ValueError:
        lin = 0.0
    return abs(lin)
