added implementation for calculating relatedness between terms in a document