Akin.Util (Akin v0.1.7) View Source

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

Link to this section 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.

Link to this section Functions

Specs

compose(binary()) :: struct() | nil

Specs

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. )

Specs

deduplicate(binary()) :: binary()

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

Return the default option values

Specs

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

Compares two values for equality

Specs

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

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

Specs

is_alphabetic?(binary()) :: boolean()

Checks to see if a string is alphabetic.

Specs

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

Specs

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

Specs

ngram_tokenize(any(), any()) :: list()

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

Specs

opts(keyword(), atom()) :: integer() | boolean()

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

Specs

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.