euclidean_distance_between_texts

pyhelpers.text.euclidean_distance_between_texts(txt1, txt2)[source]

Compute Euclidean distance of two sentences.

Parameters:
  • txt1 (str) – any text

  • txt2 (str) – any text

Returns:

Euclidean distance between the input textual data

Return type:

float

Examples:

>>> from pyhelpers.text import euclidean_distance_between_texts

>>> txt_1, txt_2 = 'This is an apple.', 'That is a pear.'

>>> euclidean_distance = euclidean_distance_between_texts(txt_1, txt_2)
>>> euclidean_distance
2.449489742783178