lab_hash
Hellish Hash Tables
WordFreq< Dict > Class Template Reference

WordFreq: counts the frequency with which words appear in a file. More...

#include "word_counter.h"

+ Collaboration diagram for WordFreq< Dict >:

Public Member Functions

 WordFreq (const std::string &filename)
 Constructs a WordFreq from the given filename. More...
 
std::vector< std::pair< std::string, int > > getWords (int threshold) const
 Returns all words, along with their frequencies, that are above a given threshold. More...
 

Private Attributes

std::string filename
 Name of the file we are reading from. More...
 

Detailed Description

template<template< class K, class V > class Dict>
class WordFreq< Dict >

WordFreq: counts the frequency with which words appear in a file.

Author
Chase Geigle
Date
Spring 2011
Summer 2012

Constructor & Destructor Documentation

◆ WordFreq()

template<template< class K, class V > class Dict>
WordFreq< Dict >::WordFreq ( const std::string filename)

Constructs a WordFreq from the given filename.

Parameters
filenameFile to read in words from.

Member Function Documentation

◆ getWords()

template<template< class K, class V > class Dict>
vector< pair< string, int > > WordFreq< Dict >::getWords ( int  threshold) const

Returns all words, along with their frequencies, that are above a given threshold.

Parameters
thresholdThe frequency a word must be at or above in order to be added to the returned vector.
Returns
A vector of (string, int) pairs that represent words and their frequencies, filtered to only include those words with frequencies at or above threshold.
Todo:
Implement this function.
See also
char_counter.cpp if you're having trouble.

Member Data Documentation

◆ filename

template<template< class K, class V > class Dict>
std::string WordFreq< Dict >::filename
private

Name of the file we are reading from.


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