Assignment 1
Develop a class (eg.
csc240::WordParser
) that can be used to parse user specified text and supports the following types of lookup features:- A member function that (eg.
frequency
) that will return the number of occurrences of a user specified word in the original text that was parsed. - A member function that will return a
std::pair
of iterators to the begin and end of a container of words that occur the specified number of times in the input text. - Provide a unit test suite for the parser and its functions. Include negative tests also.
- Optimise both functions for time and not space.
class WordParser
{
public:
explicit WordParser( const std::string& text );
uint16_t frequency( const std::string& word );
std::pair<ContainerType::const_iterator, ContainerType::const_iterator> words( const uint16_t frequency );
};