nltk.test.unit.test_distance module¶
- class nltk.test.unit.test_distance.TestEditDistance[source]¶
Bases:
object
- test_with_transpositions(left: str, right: str, substitution_cost: int, expecteds: Tuple[int, int])[source]¶
Test edit_distance between two strings, given some substitution_cost, and whether transpositions are allowed.
- Parameters
left (str) – First input string to edit_distance.
right (str) – Second input string to edit_distance.
substitution_cost (int) – The cost of a substitution action in edit_distance.
expecteds (Tuple[int, int]) – A tuple of expected outputs, such that expecteds[0] is the expected output with transpositions=True, and expecteds[1] is the expected output with transpositions=False.
expecteds –