euclidean_distance_between_texts

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

Compute the Euclidean distance between two sentences.

Parameters:
  • txt1 (str) – The first text.

  • txt2 (str) – The second text.

Returns:

The Euclidean distance between the input texts.

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