Package cc.mallet.pipe

Examples of cc.mallet.pipe.SerialPipes


      }
    }
  }

  private Pipe makeSpacePredictionPipe() {
    Pipe p = new SerialPipes(new Pipe[] {
        new CharSequence2TokenSequence("."),
        new TokenSequenceLowercase(),
        new TestCRFTokenSequenceRemoveSpaces(),
        new TokenText(),
        new OffsetConjunctions(true, new int[][] { { 0 }, { 1 },
View Full Code Here


    assertEquals(0.9409, eval.getAccuracy("Test"), 0.001);

  }

  public void testPrint() {
    Pipe p = new SerialPipes(new Pipe[] {
        new CharSequence2TokenSequence("."), new TokenText(),
        new TestCRFTokenSequenceRemoveSpaces(),
        new TokenSequence2FeatureVectorSequence(),
        new PrintInputAndTarget(), });
    InstanceList one = new InstanceList(p);
View Full Code Here

    mcrf.setParameters(params);
    crf.print();
  }

  public void testCopyStatesAndWeights() {
    Pipe p = new SerialPipes(new Pipe[] {
        new CharSequence2TokenSequence("."), new TokenText(),
        new TestCRFTokenSequenceRemoveSpaces(),
        new TokenSequence2FeatureVectorSequence(),
        new PrintInputAndTarget(), });
    InstanceList one = new InstanceList(p);
View Full Code Here

  }

  static String toy = "A a\nB b\nC c\nD d\nB b\nC c\n";

  public void testStartState() {
    Pipe p = new SerialPipes(new Pipe[] {
        new LineGroupString2TokenSequence(),
        new TokenSequenceMatchDataAndTarget(Pattern
            .compile("^(\\S+) (.*)"), 2, 1),
        new TokenSequenceParseFeatureString(false), new TokenText(),
        new TokenSequence2FeatureVectorSequence(true, false),
View Full Code Here

  public void slicePipes (int num)
  {
    Pipe fpipe = getFeaturePipe ();
    if (!(fpipe instanceof SerialPipes))
      throw new IllegalArgumentException ("slicePipes: FeaturePipe must be a SerialPipes.");
    SerialPipes sp = (SerialPipes) fpipe;
    ArrayList pipes = new ArrayList ();
    for (int i = 0; i < num; i++) {
      pipes.add (sp.getPipe (0))
      //sp.removePipe (0); TODO Fix this
    }
    //setTokenizationPipe (sp);  TODO Fix this
    throw new UnsupportedOperationException ("Not yet implemented...");
  }
View Full Code Here

                       // Gaussian variance on the sum of alphas
                       double featureVectorSizePoissonLambda,
                       double classInstanceCountPoissonLambda,
                       String[] classNames)
  {
    this (new SerialPipes (new Pipe[]  {
        new TokenSequence2FeatureSequence (),
        new FeatureSequence2FeatureVector (),
        new Target2Label()}));
    //classCentroidDistribution.print();
    Iterator<Instance> iter = new RandomTokenSequenceIterator (
View Full Code Here

  static CRFExtractor hackCrfExtor (CRF crf)
  {
    Pipe[] newPipes = new Pipe [3];

    SerialPipes pipes = (SerialPipes) crf.getInputPipe ();
    for (int i = 0; i < 3; i++) {
      Pipe p0 = pipes.getPipe (0);
      //pipes.removePipe (0);  TODO Fix me
      //p0.setParent (null);
      newPipes[i] = p0;
    }

    Pipe tokPipe = new SerialPipes (newPipes);

    CRFExtractor extor = new CRFExtractor (crf, (Pipe)tokPipe);
    return extor;
  }
View Full Code Here

  private static String[] doc1 =  { "Meet\nme\nat\n4\nPM\ntomorrow" };

  public static void testMultiTag ()
  {
    Pipe mtPipe = new SerialPipes (new Pipe[] {
            new SimpleTaggerSentence2TokenSequence (),
            new TokenText (),
            new RegexMatches ("digits", Pattern.compile ("[0-9]+")),
            new RegexMatches ("ampm", Pattern.compile ("[aApP][mM]")),
            new OffsetFeatureConjunction ("time",
                    new String[] { "digits", "ampm" },
                    new int[] { 0, 1 },
                    true),
            new PrintInputAndTarget (),
    });
    Pipe noMtPipe = new SerialPipes (new Pipe[] {
            new SimpleTaggerSentence2TokenSequence (),
            new TokenText (),
            new RegexMatches ("digits", Pattern.compile ("[0-9]+")),
            new RegexMatches ("ampm", Pattern.compile ("[aApP][mM]")),
            new OffsetFeatureConjunction ("time",
View Full Code Here

    assertEquals (0.0, noMtTs.get (4).getFeatureValue ("time"), 1e-15);
  }

  public static void testMultiTagSerialization () throws IOException, ClassNotFoundException
  {
    Pipe origPipe = new SerialPipes (new Pipe[] {
            new SimpleTaggerSentence2TokenSequence (),
            new TokenText (),
            new RegexMatches ("digits", Pattern.compile ("[0-9]+")),
            new RegexMatches ("ampm", Pattern.compile ("[aApP][mM]")),
            new OffsetFeatureConjunction ("time",
View Full Code Here

  public static Pipe concatenatePipes (Pipe p1, Pipe p2)
  {
    Alphabet dataDict = combinedDataDicts (p1, p2);
    Alphabet targetDict = combinedTargetDicts (p1, p2);
    Pipe ret = new SerialPipes (new Pipe[] { p1, p2 });

    if (dataDict != null) ret.dataAlphabetResolved = true;
    if (targetDict != null) ret.targetAlphabetResolved = true;
   
    ret.dataAlphabet = dataDict;
View Full Code Here

TOP

Related Classes of cc.mallet.pipe.SerialPipes

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.