Examples of BinarySparseVector


Examples of org.fnlp.ml.types.sv.BinarySparseVector

  }

  @Override
  public ISparseVector getVector(Instance inst, Object label) {
    int[] data = (int[]) inst.getData();
    ISparseVector fv = new BinarySparseVector(data.length);
    for(int i = 0; i < data.length; i++)  {
      int idx = data[i]+(Integer)label;
      fv.put(idx);
    }
    return fv;
  }
View Full Code Here

Examples of org.fnlp.ml.types.sv.BinarySparseVector

    this.group = group.group;
  }
  @Override
  public void addThruPipe(Instance inst) throws Exception {
    String str = (String) inst.getSource();
    BinarySparseVector sv = (BinarySparseVector) inst.getData();
    List<RETemplate> templates = new ArrayList<RETemplate>();
    for(int i=0;i<group.size();i++){
      RETemplate qt = group.get(i);
      float w = qt.matches(str);
      if(w>0){
//        System.out.println(qt.comment);
        int id = features.lookupIndex("template:"+qt.comment);
        sv.put(id);
      }
    }
  }
View Full Code Here

Examples of org.fnlp.ml.types.sv.BinarySparseVector

  }

  public void addThruPipe(Instance instance) throws Exception
    String[][] data = (String[][]) instance.getData();

    BinarySparseVector sv = new BinarySparseVector();
    for (int j = 0; j < templets.size(); j++) {
      int[] idx = templets.get(j).generateAt(instance,
          this.features, 1);
      sv.put(idx);
    }
    instance.setData(sv);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.