View source code
Display the source code in std/algorithm/comparison.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Enum std.algorithm.comparison.EditOp
Encodes edit operations necessary to transform one sequence into
another. Given sequences s
(source) and t
(target), a
sequence of EditOp
encodes the steps that need to be taken to
convert s
into t
. For example, if s = "cat"
and "cars"
, the minimal sequence that transforms s
into t
is:
skip two characters, replace 't' with 'r', and insert an 's'. Working
with edit operations is useful in applications such as spell-checkers
(to find the closest word to a given misspelled word), approximate
searches, diff-style programs that compute the difference between
files, efficient encoding of patches, DNA sequence analysis, and
plagiarism detection.
enum EditOp
: char { ... }
Enum members
Name | Description |
---|---|
insert
|
Insert current item from the source into the target. |
none
|
Current items are equal; no editing is necessary. |
remove
|
Remove current item from the target. |
substitute
|
Substitute current item in target with current item in source. |
Example
with(EditOp)
{
// [none, none, none, insert, insert, insert]
writeln(levenshteinDistanceAndPath("foo", "foobar")[1]);
// [substitute, none, substitute, none, none, remove]
writeln(levenshteinDistanceAndPath("banana", "fazan")[1]);
}
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.