TheFuzz.Util

Utilities for TheFuzz.

Source

Summary

deduplicate(value)

Removes duplicates from a string (except for c)

Example

iex> TheFuzz.Util.deduplicate("buzz")
"buz"
iex> TheFuzz.Util.deduplicate("accept")
"accept"
intersect(l1, l2)

Finds the intersection of two lists. If Strings are provided, it uses the codepoints of said string.

Example

iex> TheFuzz.Util.intersect('context', 'contentcontent')
'contet'
iex> TheFuzz.Util.intersect("context", "contentcontent")
["c", "o", "n", "t", "e", "t"]
is_alphabetic?(value)

Checks to see if a string is alphabetic.

Example

iex> TheFuzz.Util.is_alphabetic?("Jason5")
false
iex> TheFuzz.Util.is_alphabetic?("Jason")
true
len(value)

Finds the length of a string in a less verbose way.

Example

iex> TheFuzz.Util.len("Jason")
5
ngram_tokenize(string, n)

ngram tokenizes the string provided.

Example

iex> TheFuzz.Util.ngram_tokenize("abcdefghijklmnopqrstuvwxyz", 2)
["ab", "bc", "cd", "de", "ef", "fg", "gh", "hi", "ij", "jk", "kl", "lm",
"mn", "no", "op", "pq", "qr", "rs", "st", "tu", "uv", "vw", "wx", "xy",
"yz"]

Functions

deduplicate(value)

Removes duplicates from a string (except for c)

Example

iex> TheFuzz.Util.deduplicate("buzz")
"buz"
iex> TheFuzz.Util.deduplicate("accept")
"accept"
Source
intersect(l1, l2)

Finds the intersection of two lists. If Strings are provided, it uses the codepoints of said string.

Example

iex> TheFuzz.Util.intersect('context', 'contentcontent')
'contet'
iex> TheFuzz.Util.intersect("context", "contentcontent")
["c", "o", "n", "t", "e", "t"]
Source
is_alphabetic?(value)

Checks to see if a string is alphabetic.

Example

iex> TheFuzz.Util.is_alphabetic?("Jason5")
false
iex> TheFuzz.Util.is_alphabetic?("Jason")
true
Source
len(value)

Finds the length of a string in a less verbose way.

Example

iex> TheFuzz.Util.len("Jason")
5
Source
ngram_tokenize(string, n)

ngram tokenizes the string provided.

Example

iex> TheFuzz.Util.ngram_tokenize("abcdefghijklmnopqrstuvwxyz", 2)
["ab", "bc", "cd", "de", "ef", "fg", "gh", "hi", "ij", "jk", "kl", "lm",
"mn", "no", "op", "pq", "qr", "rs", "st", "tu", "uv", "vw", "wx", "xy",
"yz"]
Source