tools.anagrams module

Used to generate anagrams of a given word.

What is an anagram?

An anagram is formed when letters in a name, word or phrase are rearranged into another name, word or phrase.

class Config(phrase, minimum_word_size)[source]

Bases: clack._config.Config

Command-line arguments.

Parameters
  • phrase (str) –

  • minimum_word_size (Optional[int]) –

classmethod from_cli_args(argv)[source]

Parses command-line arguments.

Parameters

argv (Sequence[str]) –

Return type

Config

minimum_word_size
phrase
default_minimum_word_size(phrase)[source]

Returns the default minimum anagram size.

Parameters

phrase (str) –

Return type

int

english_words()[source]

Returns a dictionary of english words to the integer 1.

Used for fast boolean check.

Return type

Dict[str, bool]

is_word_factory(make_word_container)[source]

Returns an ‘is_word(word: str) -> bool’ function.

Parameters

make_word_container (Callable[[], Dict[str, bool]]) –

Return type

Callable[[str], bool]

run(args)[source]

This function acts as this tool’s main entry point.

Parameters

args (Config) –

Return type

int