Examples of lookupIndex()


Examples of cc.mallet.types.Alphabet.lookupIndex()

    Alphabet dict = new Alphabet ();
    FeatureSequence fs = new FeatureSequence (dict, 10);
    fs.add (dict.lookupIndex ("apple"));
    fs.add (dict.lookupIndex ("bear"));
    fs.add (dict.lookupIndex ("car"));
    fs.add (dict.lookupIndex ("door"));
    assertTrue (fs.size() == 4);
    double[] weights = new double[4];
    fs.addFeatureWeightsTo (weights);
    assertTrue (weights[1] == 1.0);
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

    assertTrue (fs.size() == 4);
    double[] weights = new double[4];
    fs.addFeatureWeightsTo (weights);
    assertTrue (weights[1] == 1.0);

    fs.add (dict.lookupIndex ("bear"));
    int[] feats = fs.toFeatureIndexSequence();
    assertTrue (feats[0] == 0);
    assertTrue (feats[1] == 1);
    assertTrue (feats[2] == 2);
    assertTrue (feats[3] == 3);
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  }

   private Alphabet dictOfSize (int size) {
    Alphabet ret = new Alphabet ();
    for (int i = 0; i < size; i++)
      ret.lookupIndex ("feature"+i);
     return ret;
  }

  /**
   * Computes a feature that indicates whether or not all members of a
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  }

  public void testAddWithPrefix ()
  {
    Alphabet dict = new Alphabet ();
    dict.lookupIndex ("ZERO");
    dict.lookupIndex ("ONE");
    dict.lookupIndex ("TWO");
    dict.lookupIndex ("THREE");

    FeatureVector fv = new FeatureVector (dict, new int[] { 1,3 });
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  public void testAddWithPrefix ()
  {
    Alphabet dict = new Alphabet ();
    dict.lookupIndex ("ZERO");
    dict.lookupIndex ("ONE");
    dict.lookupIndex ("TWO");
    dict.lookupIndex ("THREE");

    FeatureVector fv = new FeatureVector (dict, new int[] { 1,3 });
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  public void testAddWithPrefix ()
  {
    Alphabet dict = new Alphabet ();
    dict.lookupIndex ("ZERO");
    dict.lookupIndex ("ONE");
    dict.lookupIndex ("TWO");
    dict.lookupIndex ("THREE");

    FeatureVector fv = new FeatureVector (dict, new int[] { 1,3 });

    AugmentableFeatureVector afv = new AugmentableFeatureVector (new Alphabet (), true);
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  {
    Alphabet dict = new Alphabet ();
    dict.lookupIndex ("ZERO");
    dict.lookupIndex ("ONE");
    dict.lookupIndex ("TWO");
    dict.lookupIndex ("THREE");

    FeatureVector fv = new FeatureVector (dict, new int[] { 1,3 });

    AugmentableFeatureVector afv = new AugmentableFeatureVector (new Alphabet (), true);
    afv.add (fv, "O:");
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  private static Alphabet dictOfSize (int size)
  {
    Alphabet ret = new Alphabet ();
    for (int i = 0; i < size; i++)
      ret.lookupIndex ("feature"+i);
    return ret;
  }

  private static String[] classNamesOfSize (int size)
  {
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

      Alphabet clusterAlph = new Alphabet();
      InstanceList instances = new InstanceList(new Noop());
      TIntArrayList labels = new TIntArrayList();
      for (int j = 0; j < subdirs.length; j++) {
        ArrayList<File> records = new FileIterator(subdirs[j]).getFileArray();
        int label = clusterAlph.lookupIndex(subdirs[j].toString());
        for (int k = 0; k < records.size(); k++) {
          if (fi % 100 == 0) System.out.print(fi);
          else if (fi % 10 == 0) System.out.print(".");
          if (fi % 1000 == 0 && fi > 0) System.out.println();
          System.out.flush();
View Full Code Here

Examples of cc.mallet.types.Alphabet.lookupIndex()

  private static Alphabet dictOfSize (int size)
  {
    Alphabet ret = new Alphabet ();
    for (int i = 0; i < size; i++)
      ret.lookupIndex ("feature"+i);
    return ret;
  }

  private static String[] classNamesOfSize (int size)
  {
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.