TheFuzz v0.5.0 TheFuzz.Util View Source

Utilities for TheFuzz.

Link to this section Summary

Functions

Removes duplicates from a string (except for c)

Example

iex> TheFuzz.Util.deduplicate("buzz")
"buz"
iex> TheFuzz.Util.deduplicate("accept")
"accept"

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"]

Checks to see if a string is alphabetic.

Example

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

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

Example

iex> TheFuzz.Util.len("Jason")
5

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"]

Link to this section Functions

Removes duplicates from a string (except for c)

Example

iex> TheFuzz.Util.deduplicate("buzz")
"buz"
iex> TheFuzz.Util.deduplicate("accept")
"accept"

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"]

Checks to see if a string is alphabetic.

Example

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

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

Example

iex> TheFuzz.Util.len("Jason")
5
Link to this function

ngram_tokenize(string, n) View Source

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"]