pattern_clustering.boost.pattern_distance
- pattern_distance(w1: str, w2: str, map_name_dfa: Optional[dict] = None, densities: Optional[list] = None, infinity: float = 100000, normalized: bool = False) float [source]
Compute the pattern distance between two strings.
- Parameters
w1 (str) – The first compared string.
w2 (str) – The second compared string.
map_name_dfa (dict) – Maps each pattern name (str) with its corresponding Automaton.
densities (list) – A density vector. See make_densities().
infinity (float) – The infinite distance.
normalized (bool) – Pass True to get a distance in [0, 1], otherwise in [0, len(w1) + len(w2)]
- Returns
The corresponding distance.