View Source Akin.Util (Akin v0.2.0)

Utilities for string preparation, manipulation, comparison, and inspection.

Summary

Functions

Convert string to downcase and unicode standard, standardize whitespace, replace nontext (like emojis), replace punctuation, and convert accents. Then compose a string into a corpus of values for disambiguation. Returns nil when given non-binary. )

Removes duplicates from a string (except for c and the final letter). Used in metaphone algorithm.

Return the default option values

Compares two values for equality

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

Checks to see if a string is alphabetic.

Return the length of a string.

Return a list of algorithms.

Camelize input and return as an existing atom, as in referencing functions through apply

Take the value for the key from the options. If not present, use the default value from the default options list.

Round data types that can be rounded to 2 decimal points.

If the conditions are met, replace character with white space. The right condition is when either but noth both the left or right strings contains the character.

Functions

@spec compose(binary()) :: struct() | nil
@spec compose(binary(), binary()) :: list()

Convert string to downcase and unicode standard, standardize whitespace, replace nontext (like emojis), replace punctuation, and convert accents. Then compose a string into a corpus of values for disambiguation. Returns nil when given non-binary. )

@spec deduplicate(binary()) :: binary()

Removes duplicates from a string (except for c and the final letter). Used in metaphone algorithm.

Return the default option values

@spec eq?(any(), any()) :: boolean()

Compares two values for equality

@spec intersect(list() | binary(), list() | binary()) :: list()

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

@spec is_alphabetic?(binary()) :: boolean()

Checks to see if a string is alphabetic.

@spec len(binary()) :: integer()

Return the length of a string.

Return a list of algorithms.

Accepts a list of algorithm names or a keyword list of options. Default returns all available.

OptionsDefault
metric"string""phonetic"both
unit"whole""partial"both
Link to this function

list_algorithms(metric, unit, algorithms)

View Source
@spec modulize(list() | binary()) :: atom()

Camelize input and return as an existing atom, as in referencing functions through apply

Link to this function

ngram_tokenize(string, n)

View Source
@spec ngram_tokenize(any(), any()) :: list()

Tokenizes the input into N-grams (http://en.wikipedia.org/wiki/N-gram).

@spec opts(
  keyword(),
  atom()
) :: any()

Take the value for the key from the options. If not present, use the default value from the default options list.

Round data types that can be rounded to 2 decimal points.

Link to this function

replace_cond(left, rights, char)

View Source
@spec replace_cond(binary(), binary() | list(), list()) :: tuple()

If the conditions are met, replace character with white space. The right condition is when either but noth both the left or right strings contains the character.

Accepts a left string and a right string or a right list of strings and list of characters to replace. Returns a tuple containing left and right with replacements, if replacements were made. Otherwise, the tuple contains the original strings.