def minimum_phonetic_distance(self, target, source):
        """
        Provides the minimum phonetic distance between two words by looking up their pronunciations and comparing them
        using the provided phonetic_cost_calculator.  If a word has multiple pronunciations, the distance to the closest
        pronunciation will be used.
        :param target: source word to compare
        :param source: target word to compare
        :return: distance between the pronunciation of the two words for their closest pronunciations; lower is closer
        """
        target_pronunciations = self.phonetic_dictionary.get_pronunciation(target)
        source_pronunciations = self.phonetic_dictionary.get_pronunciation(source)

        minimum_distance = sys.maxsize

        for source_pronunciation in source_pronunciations:
            for target_pronunciation in target_pronunciations:
                distance = minimum_edit_distance(target_pronunciation,
                                                 source_pronunciation,
                                                 self.phonetic_cost_calculator)
                if distance < minimum_distance:
                    minimum_distance = distance
        return minimum_distance
 def test_minimum_edit_distance(self):
     assert minimum_edit_distance("intention", "execution", LevenshteinCostCalculator()) == 8
     assert minimum_edit_distance("drive", "brief", LevenshteinCostCalculator()) == 4
     assert minimum_edit_distance("drive", "divers", LevenshteinCostCalculator()) == 3