All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.berkeley.nlp.classify.BasicLabeledFeatureVector Maven / Gradle / Ivy

Go to download

The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).

The newest version!
package edu.berkeley.nlp.classify;

import edu.berkeley.nlp.classify.LabeledFeatureVector;
import edu.berkeley.nlp.util.Counter;

import java.util.List;

/**
 * A minimal implementation of a labeled datum, wrapping a list of features and
 * a label.
 *
 * @author Dan Klein
 */
public class BasicLabeledFeatureVector  implements LabeledFeatureVector {
  L label;
  Counter features;

  public L getLabel() {
    return label;
  }

  public Counter getFeatures() {
    return features;
  }

  public String toString() {
    return "<" + getLabel() + " : " + getFeatures().toString() + ">";
  }

  public BasicLabeledFeatureVector(L label, Counter features) {
    this.label = label;
    this.features = features;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy