Package com.clearnlp.classification.vector

Examples of com.clearnlp.classification.vector.StringFeatureVector


//  ====================================== FEATURE VECTOR ======================================
 
  /** @return a feature vector using the specific feature template. */
  protected StringFeatureVector getFeatureVector(JointFtrXml xml, T state)
  {
    StringFeatureVector vector = new StringFeatureVector();
   
    for (FtrTemplate template : xml.getFtrTemplates())
      addFeatures(vector, template, state);
   
    return vector;
View Full Code Here


//  ====================================== FEATURE EXTRACTION ======================================
 
  /** @return a feature vector using the specific feature template. */
  protected StringFeatureVector getFeatureVector(JointFtrXml xml, T state)
  {
    StringFeatureVector vector = new StringFeatureVector();
   
    for (FtrTemplate template : xml.getFtrTemplates())
      addFeatures(vector, template, state);
   
    return vector;
View Full Code Here

  }
 
  /** Called by {@link AbstractRolesetClassifier#classify()}. */
  protected String getLabel(int modelId, POSState state)
    {
    StringFeatureVector vector = getFeatureVector(f_xmls[0], state);
    String label = null;
   
    if (isTrain())
    {
      label = state.getGoldLabel();
View Full Code Here

    return sparse;
  }
 
  public StringFeatureVector trimFeatures(StringFeatureVector oVector, String label, double threshold)
  {
    StringFeatureVector nVector = new StringFeatureVector(oVector.hasWeight());
    int i, size = oVector.size(), fIndex, lIndex = getLabelIndex(label);
    ObjectIntOpenHashMap<String> map;
    String type, value;
    boolean add;
   
    for (i=0; i<size; i++)
    {
      type  = oVector.getType(i);
      value = oVector.getValue(i);
      add   = false;
     
      if ((map = m_features.get(type)) != null && (fIndex = map.get(value)) > 0)
      {
        if (d_weights[getWeightIndex(lIndex, fIndex)] == threshold)
          add = true;
      }
      else
        add = true;
     
      if (add)
      {
        if (nVector.hasWeight())
          nVector.addFeature(type, value, oVector.getWeight(i));
        else
          nVector.addFeature(type, value);
      }
    }
   
    return nVector;
  }
View Full Code Here

TOP

Related Classes of com.clearnlp.classification.vector.StringFeatureVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.