Examples of lookupLabel()


Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

    for (int c2 = 0; c2 < Math.min(10,numClasses); c2++sb.append ("   "+c2);
    for (int c2 = 10; c2 < numClasses; c2++sb.append ("  "+c2);
    sb.append ("  |total\n");
    for (int c = 0; c < numClasses; c++) {
      appendJustifiedInt (sb, c, false);
      String labelName = labelAlphabet.lookupLabel(c).toString();
      for (int i = 0; i < maxLabelNameLength-labelName.length(); i++) sb.append (' ');
      sb.append (" "+labelName+" ");
      for (int c2 = 0; c2 < numClasses; c2++) {
        appendJustifiedInt (sb, values[c][c2], true);
        sb.append (' ');
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

        InstanceList newInstances = new InstanceList(noop);
        for (int j = 0; j < oldInstances.size(); j++) {
          int label = clustering.getLabel(j);
          Instance instance = oldInstances.get(j);
          if (clustering.size(label) >= minClusterSize.value)
            newInstances.add(noop.pipe(new Instance(instance.getData(), lalph.lookupLabel(new Integer(label)), instance.getName(), instance.getSource())));
        }
        clusterings.set(i, createSmallerClustering(newInstances));
      }
      if (outputPrefixFile.value != null) {
        try {
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

        if (!clustersSampled.contains(cluster)) {
          clustersSampled.add(cluster);
          InstanceList instances = clustering.getCluster(cluster);
          for (int i = 0; i < instances.size(); i++) {
            Instance inst = instances.get(i);
            trainingInstances.add(new Instance(inst.getData(), lalph.lookupLabel(new Integer(cluster)), inst.getName(), inst.getSource()));
          }
        }
      }
      trainingInstances.shuffle(random);
      Clustering trainingClustering = createSmallerClustering(trainingInstances);
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

      for (int i = 0; i < clustering.getNumClusters(); i++) {
        if (!clustersSampled.contains(i)) {
          InstanceList instances = clustering.getCluster(i);
          for (int j = 0; j < instances.size(); j++) {
            Instance inst = instances.get(j);
            testingInstances.add(new Instance(inst.getData(), lalph.lookupLabel(new Integer(i)), inst.getName(), inst.getSource()));
          }         
        }
      }
      testingInstances.shuffle(random);
      Clustering testingClustering = createSmallerClustering(testingInstances);
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

  {
    if (carrier.getTarget() != null) {
      if (carrier.getTarget() instanceof Label)
        throw new IllegalArgumentException ("Already a label.");
      LabelAlphabet ldict = (LabelAlphabet) getTargetAlphabet();
      carrier.setTarget(ldict.lookupLabel (carrier.getTarget()));
    }
    return carrier;
  }

}
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

    {
      StringTokenization ts =  (StringTokenization) carrier.getData();
      StringTokenization newTs = new StringTokenization((CharSequence) ts.getDocument ());
      final LabelAlphabet dict = (LabelAlphabet) getTargetAlphabet();
      LabelSequence labelSeq = new LabelSequence(dict);
      Label start = dict.lookupLabel ("start");
      Label notstart = dict.lookupLabel ("notstart");

      boolean lastWasSpace = true;
      StringBuffer sb = new StringBuffer();
      for (int i = 0; i < ts.size(); i++) {
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

      StringTokenization ts =  (StringTokenization) carrier.getData();
      StringTokenization newTs = new StringTokenization((CharSequence) ts.getDocument ());
      final LabelAlphabet dict = (LabelAlphabet) getTargetAlphabet();
      LabelSequence labelSeq = new LabelSequence(dict);
      Label start = dict.lookupLabel ("start");
      Label notstart = dict.lookupLabel ("notstart");

      boolean lastWasSpace = true;
      StringBuffer sb = new StringBuffer();
      for (int i = 0; i < ts.size(); i++) {
        StringSpan t = (StringSpan) ts.getSpan(i);
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

          }
        }
      }
      LabelAlphabet ldict = (LabelAlphabet)getTargetAlphabet();
      String label = positive ? "YES" : "NO";     
      carrier.setTarget(ldict.lookupLabel(label));
      return carrier;
    }
  }

   
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

    dict.lookupIndex ("TEST1");
    dict.lookupIndex ("TEST2");
    dict.lookupIndex ("TEST3");


    Label t1 = dict.lookupLabel ("TEST1");
    Labelee l = new Labelee (dict, t1);
    Labelee l2 = (Labelee) TestSerializable.cloneViaSerialization (l);

    assertTrue (l.dict == l2.dict);
    assertTrue (dict.lookupLabel("TEST1") == l.theLabel);
View Full Code Here

Examples of cc.mallet.types.LabelAlphabet.lookupLabel()

    Label t1 = dict.lookupLabel ("TEST1");
    Labelee l = new Labelee (dict, t1);
    Labelee l2 = (Labelee) TestSerializable.cloneViaSerialization (l);

    assertTrue (l.dict == l2.dict);
    assertTrue (dict.lookupLabel("TEST1") == l.theLabel);
    assertTrue (dict.lookupLabel("TEST1") == l2.theLabel);
    assertTrue (l.theLabel == l2.theLabel);
  }

  public static Test suite ()
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.