A Javascript bag of words implementation