Examples of instanceFrom()


Examples of cc.mallet.pipe.Pipe.instanceFrom()

  public void testPipesAreStupid ()
  {
    Pipe p1 = new StupidPipe ();
    Pipe p2 = new SimpleTaggerSentence2TokenSequence ();
    // initialize p2's dict
    p2.instanceFrom(new Instance (data, null, null, null));

    Pipe serial = new SerialPipes (new Pipe[] { p1, p2 });
    try {
      serial.getDataAlphabet ();
      assertTrue ("Test failed: Should have generated exception.", false);
View Full Code Here

Examples of cc.mallet.pipe.Pipe.instanceFrom()

    StringWriter sw = new StringWriter ();
    PrintWriter w = new PrintWriter (sw);
    Pipe p = new SequencePrintingPipe (w);

    // pipe the instance
    p.instanceFrom(new Instance (fvs, lbls, null, null));

    // Do a second one
    FeatureVectorSequence fvs2 = new FeatureVectorSequence (new FeatureVector[] {
      new FeatureVector (dict, new int[] { 1 }),
      new FeatureVector (dict, new int[] { 0 }),
View Full Code Here

Examples of cc.mallet.pipe.Pipe.instanceFrom()

    FeatureVectorSequence fvs2 = new FeatureVectorSequence (new FeatureVector[] {
      new FeatureVector (dict, new int[] { 1 }),
      new FeatureVector (dict, new int[] { 0 }),
    });
    LabelSequence lbls2 = new LabelSequence (ld, new int[] { 2, 1 });
    p.instanceFrom(new Instance (fvs2, lbls2, null, null));

    w.close();

    assertEquals ("LABEL0 feature0 feature1\n" +
            "LABEL2 feature0 feature2\n" +
View Full Code Here

Examples of cc.mallet.pipe.Pipe.instanceFrom()

  public void testConcatenatePipes ()
  {
    Pipe p1 = new StupidPipe ();
    Pipe p2 = new SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence ();
    // initialize p2's dict
    p2.instanceFrom(new Instance (data, null, null, null));

    assertEquals (3, p2.getDataAlphabet ().size());

    Pipe serial = PipeUtils.concatenatePipes (p1, p2);
    Alphabet dict = serial.getDataAlphabet ();
View Full Code Here

Examples of cc.mallet.pipe.SimpleTaggerSentence2TokenSequence.instanceFrom()

  public void testPipesAreStupid ()
  {
    Pipe p1 = new StupidPipe ();
    Pipe p2 = new SimpleTaggerSentence2TokenSequence ();
    // initialize p2's dict
    p2.instanceFrom(new Instance (data, null, null, null));

    Pipe serial = new SerialPipes (new Pipe[] { p1, p2 });
    try {
      serial.getDataAlphabet ();
      assertTrue ("Test failed: Should have generated exception.", false);
View Full Code Here

Examples of cc.mallet.pipe.tsf.SequencePrintingPipe.instanceFrom()

    StringWriter sw = new StringWriter ();
    PrintWriter w = new PrintWriter (sw);
    Pipe p = new SequencePrintingPipe (w);

    // pipe the instance
    p.instanceFrom(new Instance (fvs, lbls, null, null));

    // Do a second one
    FeatureVectorSequence fvs2 = new FeatureVectorSequence (new FeatureVector[] {
      new FeatureVector (dict, new int[] { 1 }),
      new FeatureVector (dict, new int[] { 0 }),
View Full Code Here

Examples of cc.mallet.pipe.tsf.SequencePrintingPipe.instanceFrom()

    FeatureVectorSequence fvs2 = new FeatureVectorSequence (new FeatureVector[] {
      new FeatureVector (dict, new int[] { 1 }),
      new FeatureVector (dict, new int[] { 0 }),
    });
    LabelSequence lbls2 = new LabelSequence (ld, new int[] { 2, 1 });
    p.instanceFrom(new Instance (fvs2, lbls2, null, null));

    w.close();

    assertEquals ("LABEL0 feature0 feature1\n" +
            "LABEL2 feature0 feature2\n" +
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.