Code example for Multiset

Methods: add

0
   * @param originalForm The original form of the value as a string. 
   * @param data         The vector to which the value should be added. 
   */ 
  @Override 
  public void addToVector(String originalForm, double weight, Vector data) {
    dictionary.add(originalForm);
    super.addToVector(originalForm, weight, data);
  } 
 
  @Override 
  protected double getWeight(byte[] originalForm, double w) {
    return w * weight(originalForm);
  } 
 
  @Override 
  protected double weight(byte[] originalForm) {
    // the counts here are adjusted so that every observed value has an extra 0.5 count 
    // as does a hypothetical unobserved value.  This smooths our estimates a bit and 
    // allows the first word seen to have a non-zero weight of -log(1.5 / 2) 
    double thisWord = dictionary.count(new String(originalForm, Charsets.UTF_8)) + 0.5;
Connect your IDE to all the code out there  Get Codota for Java