Implement uniqueness functionality and general parser fixes.

The parser was running slowly due to some inefficient things (finding
the index of every word in the frequency distribution instead of the
most common ones, recalculating frequency distribitions). This should
fix that and also implements the uniqueness functions.

Author: Dylan Nugent