AnagramFinder class.
More...
#include <anagram_finder.h>
|
| | AnagramFinder (const std::string &ifilename) |
| | Constructs an AnagramFinder based on a filename to read potential anagrams from. More...
|
| |
| | AnagramFinder (const std::vector< std::string > &istrings) |
| | Constructs an AnagramFinder based on a set of strings instead of a filename. More...
|
| |
| std::vector< std::string > | getAnagrams (const std::string &word) |
| | Retrieves a set of words that are anagrams of a given word. More...
|
| |
| void | writeAnagrams (const std::string &word, const std::string &output_file) |
| | Retrieves a set of anagrams in the finder of a given words, but writes them out to a file instead of returning a vector. More...
|
| |
|
| bool | checkWord (const std::string &word, const std::string &test) |
| | Determines if the given word is an anagram of the test word. More...
|
| |
|
| bool | file |
| | Indicates whether a file was used to build the finder or not. More...
|
| |
| std::string | filename |
| | Name of the file to read anagrams from. More...
|
| |
| std::vector< std::string > | strings |
| | Set of strings to find anagrams in. More...
|
| |
template<template< class K, class V > class Dict>
class AnagramFinder< Dict >
AnagramFinder class.
Provides an interface for finding anagrams in a set of strings or within a file.
- Author
- Chase Geigle
- Date
- Spring 2011
-
Summer 2012
template<template< class K, class V > class Dict>
Constructs an AnagramFinder based on a filename to read potential anagrams from.
- Parameters
-
| ifilename | The name of the file to read in. |
template<template< class K, class V > class Dict>
Constructs an AnagramFinder based on a set of strings instead of a filename.
- Parameters
-
| istrings | The set of strings to use for this finder. |
template<template< class K, class V > class Dict>
| vector< string > AnagramFinder< Dict >::getAnagrams |
( |
const std::string & |
word | ) |
|
Retrieves a set of words that are anagrams of a given word.
- Parameters
-
| word | The word we wish to find anagrams of inside the finder. |
template<template< class K, class V > class Dict>
| void AnagramFinder< Dict >::writeAnagrams |
( |
const std::string & |
word, |
|
|
const std::string & |
output_file |
|
) |
| |
Retrieves a set of anagrams in the finder of a given words, but writes them out to a file instead of returning a vector.
- Parameters
-
| word | The word we wish to find anagrams of inside the finder. |
| output_file | The name of the file we want to write to. |
template<template< class K, class V > class Dict>
| bool AnagramFinder< Dict >::checkWord |
( |
const std::string & |
word, |
|
|
const std::string & |
test |
|
) |
| |
|
private |
Determines if the given word is an anagram of the test word.
- Parameters
-
| word | Word that is possibly an anagram. |
| test | Word to check against. |
- Returns
- A boolean value indicating whether word is an anagram of test.
- Todo:
- Implement this function! You should use the provided templated hashtable class Dict.
template<template< class K, class V > class Dict>
Indicates whether a file was used to build the finder or not.
template<template< class K, class V > class Dict>
Name of the file to read anagrams from.
Only set if the file-based constructor is used.
template<template< class K, class V > class Dict>
Set of strings to find anagrams in.
Only set if the std::vector constructor is used.
The documentation for this class was generated from the following files: