|
lab_dict
Devious Dictionaries: Cleverness Through Association
|
PronounceDict class. More...
#include <pronounce_dict.h>
Public Member Functions | |
| PronounceDict (const std::string &pronun_dict_filename) | |
| Constructs a PronounceDict from a CMU pronunciation dictionary file. More... | |
| PronounceDict (const std::map< std::string, std::vector< std::string >> &pronun_dict) | |
| Constructs a PronounceDict from a CMU std::map mapping the word to a vector of strings which represent the pronunciation. More... | |
| bool | homophones (const std::string &word1, const std::string &word2) const |
| Uses the dictionary to determine if the two words are homophones. More... | |
Private Attributes | |
|
std::map< std::string, std::vector< std::string > > | dict |
PronounceDict class.
Provides an interface for finding the pronunciation of a given word based on a pronunciation dictionary provided at construction. Also provides an interface for determining if two word share a pronunciation (they are homophones).
| PronounceDict::PronounceDict | ( | const std::string & | pronun_dict_filename | ) |
Constructs a PronounceDict from a CMU pronunciation dictionary file.
See http://www.speech.cs.cmu.edu/cgi-bin/cmudict .
| pronun_dict_filename | Filename of the CMU pronunciation dictionary. |
| PronounceDict::PronounceDict | ( | const std::map< std::string, std::vector< std::string >> & | pronun_dict | ) |
Constructs a PronounceDict from a CMU std::map mapping the word to a vector of strings which represent the pronunciation.
| pronun_dict | Maps a string word to a vector of strings representing its pronunciation. |
| bool PronounceDict::homophones | ( | const std::string & | word1, |
| const std::string & | word2 | ||
| ) | const |
Uses the dictionary to determine if the two words are homophones.
| word1 | First word to be tested. |
| word2 | Second word to be tested. |