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]
Computes 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 correspondingAutomaton
.densities (list) – A density vector. See
make_densities()
.infinity (float) – The infinite distance.
normalized (bool) – Pass
True
to get a distance between0.0
and1.0
(resp. between0
andlen(w1) + len(w2)
) if it is normalized (resp. not normalized).
- Returns
The corresponding distance.