namebot.metrics module

Metrics for measuring various aspects of words.

Conventions used in this utility: 1. All functions return a dictionary,

with key ‘data’ and/or ‘summary’: return {

‘data’: data, ‘summary’: summary or None

}

namebot.metrics.categorize_word_type(words)[source]

Get the common naming strategy ‘category’ of a name, based on precedence.

Categories are derived from http://www.thenameinspector.com/10-name-types/, so it is important to note there is no agreed upon standard, meaning it is ultimately a little arbitrary.

Since it is a bit challenging to actually determine its type, we give a weighting for each word based on a few known metrics. This can be updated in the future so that weightings are binary (e.g. 0.0 and 100.0), giving traditional False/True.

Categories ====

  1. Real Words
1a. Misspelled words 1b. Foreign words
  1. Compounds
  2. Phrases
  3. Blends
  4. Tweaked
  5. Affixed
  6. Fake/obscure
  7. Puns
  8. People’s names
  9. Initials and Acronyms
Args:
words (list): A list of words
Returns:
new_words (list) - A list of lists, with each word
and its distribution by word “type”
namebot.metrics.generate_all_metrics(filename=None, words=None)[source]

Generate all metrics in this module in one place.

Args:
filename (str, optional): A filename to load words from. words (TYPE, optional): Words to use, if file is not specified.
Returns:
dict: All metrics results, keyed by name.
namebot.metrics.get_adjective_verb_or_noun(words)[source]

Get the number of words that are classified as verbs or nouns.

Args:
words (TYPE): Description
Returns:
dict: The data and summary results.
namebot.metrics.get_consonant_duplicate_repeat_frequency(words)[source]

Check for duplicate repeating consonant frequency.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_consonant_repeat_frequency(words)[source]

Check for repeating consonant frequency for a given set of words.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_digits_frequency(words)[source]

Look for and count the digits in names, e.g. 7-11, 3M, etc...

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_first_letter_frequency(words)[source]

Add the frequency of first letters e.g. [C]at, [C]law, c = 2.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_name_spaces(words)[source]

Check number of spaces for a given set of words.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_named_numbers_1_10(words)[source]

Return a summary of words spelled out (e.g. one, two).

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_special_chars(words)[source]

Find occurrences of special characters (non-alphabetical characters).

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_vowel_repeat_frequency(words)[source]

Check for repeating vowel frequency for a given set of words.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.get_word_types(words)[source]

Determine the occurrences of pos types.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.name_length(words)[source]

Check the length of each word and an average.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.name_starts_with_vowel(words)[source]

Check the number of times a list of words starts with a vowel.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.name_vowel_count(words)[source]

Check the number of times vowels occurs, and total the results.

Args:
words (list): A list of words
Returns:
dict: The data and summary results.
namebot.metrics.prep_file(file_name)[source]

Take a file, extracts items line-by-line, and returns a list of them.

Args:
file_name (str): The file name to open
Returns:
items (list): A list of items extracted from the file