sinatools.semantic_relatedness.compute_relatedness

sinatools.semantic_relatedness.compute_relatedness.get_similarity_score(sentence1, sentence2)

Computes the degree of association between two sentences across various dimensions, meaning, underlying concepts, domain-specificity, topic overlap, viewpoint alignment. This method is described and implemented on this article.

Parameters
  • sentence1 (str) – The Arabic sentence to find the semantic relatedness between it and the second sentence.

  • sentence2 (str) – The Arabic sentence to find the semantic relatedness between it and the first sentence.

Returns

An float number that represents the degree of relatedness between two provided sentences.

Return type

float (float)

Example:

from sinatools.semantic_relatedness.compute_relatedness import get_similarity_score
sentence1 = "تبلغ سرعة دوران الأرض حول الشمس حوالي 110 كيلومتر في الساعة."
sentence2 = "تدور الأرض حول محورها بسرعة تصل تقريبا 1670 كيلومتر في الساعة."
get_similarity_score(sentence1, sentence2)
Score = 0.90