|
lab_dict
Devious Dictionaries: Cleverness Through Association
|
AnagramDict class. More...
#include <anagram_dict.h>
Public Member Functions | |
| AnagramDict (const std::string &filename) | |
| Constructs an AnagramDict from a filename with newline-separated words. More... | |
| AnagramDict (const std::vector< std::string > &words) | |
| Constructs an AnagramDict from a vector of words. More... | |
| std::vector< std::string > | get_anagrams (const std::string &word) const |
| std::vector< std::vector < std::string > > | get_all_anagrams () const |
| Gets all known anagrams from the dictionary. More... | |
Private Attributes | |
|
std::map< std::string, std::vector< std::string > > | dict |
AnagramDict class.
Provides interfaces for looking up all anagrams of a given word from a word list (from a file or given vector).
| AnagramDict::AnagramDict | ( | const std::string & | filename | ) |
Constructs an AnagramDict from a filename with newline-separated words.
| filename | The name of the word list file. |
| AnagramDict::AnagramDict | ( | const std::vector< std::string > & | words | ) |
Constructs an AnagramDict from a vector of words.
| words | The vector of strings to be used as source words. |
Gets all known anagrams from the dictionary.
| vector< string > AnagramDict::get_anagrams | ( | const std::string & | word | ) | const |
| word | The word used to find anagrams. Gets all anagrams of a given word from the dictionary. |
| word | The word to find anagrams of. |