code: function BayesClassifier() {
    /*
     * Create a new instance when not using the `new` keyword.
     */
    if (!(this instanceof BayesClassifier)) {
      return new BayesClassifier();
    }
  
    /*
     * The stemmer provides tokenization methods.
     * It breaks the doc into words (tokens) and takes the
     * stem of each word. A stem is a form to which affixes can be attached.
     */
    this.stemmer = stemmer;
  
    /*
     * A collection of added documents
     * Each document is an object containing the class, and array of tokenized strings.
     */
    this.docs = [];
  
    /*
     * Index of last added document.
     */
    this.lastAdded = 0;
  
    /*
     * A map of every class features.
     */
    this.features = {};
  
    /*
     * A map containing each class and associated features.
     * Each class has a map containing a feature index and the count of feature appearances for that class.
     */
    this.classFeatures = {};
  
    /*
     * Keep track of how many features in each class.
     */
    this.classTotals = {};
  
    /*
     * Number of examples trained
     */
    this.totalExamples = 1;
  
    /* Additive smoothing to eliminate zeros when summing features,
     * in cases where no features are found in the document.
     * Used as a fail-safe to always return a class.
     * http://en.wikipedia.org/wiki/Additive_smoothing
     */
    this.smoothing = 1;
  }
docs: Terminology
  
  label: refers to class, since `class` is a reserved word.
  doc: refers to document, since `document` is a reserved word.
  feature: a token (word) in the bag of words (document).
   
  BayesClassifier
  @desc Bayes classifier constructor
  @constructor
  @return Bayes classifier instance