astring icon indicating copy to clipboard operation
astring copied to clipboard

Add edit distance API.

Open dbuenzli opened this issue 8 years ago • 0 comments

This has been c&p too much times.

  (** {1:suggesting Suggesting} *)

  val edit_distance : string -> string -> int
  (** [edit_distance s0 s1] is the number of single byte edits (insertion,
      deletion, substitution) that are needed to change [s0] into [s1]. *)

  val suggest : ?dist:int -> string list -> string -> string list
  (** [suggest ~dist candidates s] are the elements of [candidates]
      whose {{!edit_distance}edit distance} is the smallest to [s] and
      at most at distance [dist] of [s] (defaults to [2]). *)

dbuenzli avatar Jul 21 '17 19:07 dbuenzli