lab_dict
Devious Dictionaries: Cleverness Through Association
Public Member Functions | Private Member Functions | List of all members
CommonWords Class Reference

CommonWords class. More...

#include <common_words.h>

Public Member Functions

 CommonWords (const std::vector< std::string > &filenames)
 Constructs a CommonWords object from a vector of filenames. More...
 
std::vector< std::string > get_common_words (unsigned int n) const
 

Private Member Functions

void init_file_word_maps (const vector< string > &filenames)
 Initializes file_word_maps. More...
 
void init_common ()
 Initializes common.
 
vector< string > file_to_vector (const string &filename) const
 Takes a filename and transforms it to a vector of all words in that file. More...
 

Detailed Description

CommonWords class.

Definition of a class to find all the common words across multiple files

Author
Zach Widder
Date
October 2014

Constructor & Destructor Documentation

CommonWords::CommonWords ( const std::vector< std::string > &  filenames)

Constructs a CommonWords object from a vector of filenames.

Parameters
filenamesThe list of filenames to read.

Member Function Documentation

vector< string > CommonWords::get_common_words ( unsigned int  n) const
Parameters
nThe number of times to word has to appear.
Returns
A vector of strings. The vector contains all words that appear in each file >= n times.
void CommonWords::init_file_word_maps ( const vector< string > &  filenames)
private

Initializes file_word_maps.

Parameters
filenamesThe vector of names of the files that will be used
vector< string > CommonWords::file_to_vector ( const string &  filename) const
private

Takes a filename and transforms it to a vector of all words in that file.

Parameters
filenameThe name of the file that will fill the vector

The documentation for this class was generated from the following files: