attributes

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Effectiveness

func Effectiveness(original, variant string, distance int) float64

Effectiveness computes a score from 0.0 to 1.0 representing how hard it is for a human to visually distinguish the variant from the original domain. Higher values mean the variation is more deceptive and therefore more effective as a typosquat.

The score is a weighted combination of four signals:

  • Edit distance (40%): fewer edits = harder to spot.
  • Length ratio (20%): same-length domains are harder to distinguish.
  • Visual similarity (30%): changes involving visually confusable character pairs (rn/m, 0/o, 1/l, vv/w, etc.) are subtler.
  • Character class preservation (10%): variants that stay all-alphabetic (no digits or symbols introduced) are subtler.

func Levenshtein

func Levenshtein(a, b string) int

Levenshtein computes the Levenshtein distance between two strings, which is the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one into the other.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL