本文整理汇总了Java中cc.mallet.fst.Transducer.transduce方法的典型用法代码示例。如果您正苦于以下问题:Java Transducer.transduce方法的具体用法?Java Transducer.transduce怎么用?Java Transducer.transduce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cc.mallet.fst.Transducer
的用法示例。
在下文中一共展示了Transducer.transduce方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import cc.mallet.fst.Transducer; //导入方法依赖的package包/类
/**
* Apply a transducer to an input sequence to produce the k highest-scoring
* output sequences.
*
* @param model the <code>Transducer</code>
* @param input the input sequence
* @param k the number of answers to return
* @return array of the k highest-scoring output sequences
*/
public static Sequence[] apply(Transducer model, Sequence input, int k)
{
Sequence[] answers;
if (k == 1) {
answers = new Sequence[1];
answers[0] = model.transduce (input);
}
else {
MaxLatticeDefault lattice =
new MaxLatticeDefault (model, input, null, cacheSizeOption.value());
answers = lattice.bestOutputSequences(k).toArray(new Sequence[0]);
}
return answers;
}