Add Documentation (#13811)

* Add more Docs and runnableExamples
This commit is contained in:
Juan Carlos 2020-03-31 10:47:57 -03:00 • committed by GitHub
commit 42d2c3088e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 135 additions and 19 deletions

View file

@ -13,10 +13,11 @@
import unicode
proc editDistance*(a, b: string): int {.noSideEffect.} =
## Returns the unicode-rune edit distance between ``a`` and ``b``.
## Returns the **unicode-rune** edit distance between ``a`` and ``b``.
##
## This uses the `Levenshtein`:idx: distance algorithm with only a linear
## memory overhead.
runnableExamples: static: doAssert editdistance("Kitten", "Bitten") == 1
if len(a) > len(b):
# make ``b`` the longer string
return editDistance(b, a)
@ -181,6 +182,7 @@ proc editDistanceAscii*(a, b: string): int {.noSideEffect.} =
##
## This uses the `Levenshtein`:idx: distance algorithm with only a linear
## memory overhead.
runnableExamples: static: doAssert editDistanceAscii("Kitten", "Bitten") == 1
var len1 = a.len
var len2 = b.len
if len1 > len2: