本文整理汇总了Java中cc.mallet.pipe.PipeUtils类的典型用法代码示例。如果您正苦于以下问题:Java PipeUtils类的具体用法?Java PipeUtils怎么用?Java PipeUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PipeUtils类属于cc.mallet.pipe包,在下文中一共展示了PipeUtils类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConcatenatePipes
import cc.mallet.pipe.PipeUtils; //导入依赖的package包/类
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 ();
assertEquals (3, dict.size ());
assertTrue (dict == p2.getDataAlphabet ());
}
示例2: testConcatenateBadPipes
import cc.mallet.pipe.PipeUtils; //导入依赖的package包/类
public void testConcatenateBadPipes ()
{
Pipe p1 = new SimpleTaggerSentence2TokenSequence ();
// force resolving data alphabet
Alphabet dict1 = p1.getDataAlphabet ();
Pipe p2 = new SimpleTaggerSentence2TokenSequence ();
// force resolving data alphabet
Alphabet dict2 = p2.getDataAlphabet ();
assertTrue (dict1 != dict2);
try {
PipeUtils.concatenatePipes (p1, p2);
assertTrue ("Test failed: concatenatePipes() allowed putting together incompatible alphabets.", false);
} catch (IllegalArgumentException e) {
// Exception expected
}
}
示例3: ignoretestConcatenateBadPipes
import cc.mallet.pipe.PipeUtils; //导入依赖的package包/类
public void ignoretestConcatenateBadPipes ()
{
Pipe p1 = new SimpleTaggerSentence2TokenSequence ();
// force resolving data alphabet
Alphabet dict1 = p1.getDataAlphabet ();
Pipe p2 = new SimpleTaggerSentence2TokenSequence ();
// force resolving data alphabet
Alphabet dict2 = p2.getDataAlphabet ();
assertTrue (dict1 != dict2);
try {
PipeUtils.concatenatePipes (p1, p2);
assertTrue ("Test failed: concatenatePipes() allowed putting together incompatible alphabets.", false);
} catch (IllegalArgumentException e) {
// Exception expected
}
}
示例4: setPipes
import cc.mallet.pipe.PipeUtils; //导入依赖的package包/类
public ACRFExtractorTrainer setPipes (Pipe tokPipe, Pipe featurePipe)
{
RememberTokenizationPipe rtp = new RememberTokenizationPipe ();
this.featurePipe = PipeUtils.concatenatePipes (rtp, featurePipe);
this.tokPipe = tokPipe;
return this;
}
示例5: testConcatenateNullPipes
import cc.mallet.pipe.PipeUtils; //导入依赖的package包/类
public void testConcatenateNullPipes ()
{
Pipe p1 = new StupidPipe ();
Pipe p2 = new SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence ();
Pipe serial = PipeUtils.concatenatePipes (p1, p2);
p2.instanceFrom(new Instance (data, null, null, null));
assertEquals (3, serial.getDataAlphabet ().size ());
}