diff options
| author | Eli Zaretskii | 2018-04-28 10:27:53 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-04-28 10:27:53 +0300 |
| commit | a7a3918a16c85f89d797d48b09e751ab30e0f032 (patch) | |
| tree | a48809d67e91a60cbdb622f6a4145c8081d4bb1c /doc | |
| parent | c6e6503900534d939dd94b812563c27f22c49b7d (diff) | |
| download | emacs-a7a3918a16c85f89d797d48b09e751ab30e0f032.tar.gz emacs-a7a3918a16c85f89d797d48b09e751ab30e0f032.zip | |
Fix documentation and tests for 'string-distance'
* src/fns.c (Fstring_distance): Doc fix.
* doc/lispref/strings.texi (Text Comparison): Document
'string-distance'.
* etc/NEWS: Fix wording and mark as documented in the manuals.
* test/src/fns-tests.el (test-string-distance): Move from
subr-tests.el and rename.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/strings.texi | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 8a9e27d00ec..70ba1aa613e 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -673,6 +673,28 @@ of the two strings. The sign is negative if @var{string1} (or its | |||
| 673 | specified portion) is less. | 673 | specified portion) is less. |
| 674 | @end defun | 674 | @end defun |
| 675 | 675 | ||
| 676 | @cindex Levenshtein distance | ||
| 677 | @cindex distance between strings | ||
| 678 | @cindex edit distance between strings | ||
| 679 | @defun string-distance string1 string2 &optional bytecompare | ||
| 680 | This function returns the @dfn{Levenshtein distance} between the | ||
| 681 | source string @var{string1} and the target string @var{string2}. The | ||
| 682 | Levenshtein distance is the number of single-character | ||
| 683 | changes---deletions, insertions, or replacements---required to | ||
| 684 | transform the source string into the target string; it is one possible | ||
| 685 | definition of the @dfn{edit distance} between strings. | ||
| 686 | |||
| 687 | Letter-case of the strings is significant for the computed distance, | ||
| 688 | but their text properties are ignored. If the optional argument | ||
| 689 | @var{bytecompare} is non-@code{nil}, the function calculates the | ||
| 690 | distance in terms of bytes instead of characters. The byte-wise | ||
| 691 | comparison uses the internal Emacs representation of characters, so it | ||
| 692 | will produce inaccurate results for multibyte strings that include raw | ||
| 693 | bytes (@pxref{Text Representations}); make the strings unibyte by | ||
| 694 | encoding them (@pxref{Explicit Encoding}) if you need accurate results | ||
| 695 | with raw bytes. | ||
| 696 | @end defun | ||
| 697 | |||
| 676 | @defun assoc-string key alist &optional case-fold | 698 | @defun assoc-string key alist &optional case-fold |
| 677 | This function works like @code{assoc}, except that @var{key} must be a | 699 | This function works like @code{assoc}, except that @var{key} must be a |
| 678 | string or symbol, and comparison is done using @code{compare-strings}. | 700 | string or symbol, and comparison is done using @code{compare-strings}. |