AnagramDict class.
More...
#include <anagram_dict.h>
AnagramDict class.
Provides interfaces for looking up all anagrams of a given word from a word list (from a file or given vector).
- Author
- Matt Joras
- Date
- Winter 2013
| AnagramDict::AnagramDict |
( |
const std::string & |
filename | ) |
|
Constructs an AnagramDict from a filename with newline-separated words.
- Parameters
-
| filename | The name of the word list file. |
| AnagramDict::AnagramDict |
( |
const std::vector< std::string > & |
words | ) |
|
Constructs an AnagramDict from a vector of words.
- Parameters
-
| words | The vector of strings to be used as source words. |
| vector< string > AnagramDict::get_anagrams |
( |
const std::string & |
word | ) |
const |
- Parameters
-
| word | The word used to find anagrams. Gets all anagrams of a given word from the dictionary. |
- Returns
- A vector of strings of anagrams of the given word. Empty vector returned if no anagrams are found or the word is not in the word list.
- Parameters
-
| word | The word to find anagrams of. |
- Returns
- A vector of strings of anagrams of the given word. Empty vector returned if no anagrams are found or the word is not in the word list.
| vector< vector< string > > AnagramDict::get_all_anagrams |
( |
| ) |
const |
Gets all known anagrams from the dictionary.
- Returns
- A vector of vectors of strings. Each inner vector contains the "anagram siblings", i.e. words that are anagrams of one another. NOTE: It is impossible to have one of these vectors have less than two elements, i.e. words with no anagrams are ommitted.
The documentation for this class was generated from the following files: