本文整理汇总了Java中edu.jhu.prim.iter.IntIter.hasNext方法的典型用法代码示例。如果您正苦于以下问题:Java IntIter.hasNext方法的具体用法?Java IntIter.hasNext怎么用?Java IntIter.hasNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.jhu.prim.iter.IntIter
的用法示例。
在下文中一共展示了IntIter.hasNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPossibleRolePairs
import edu.jhu.prim.iter.IntIter; //导入方法依赖的package包/类
/**
* Returns a list of pairs (i,j) for which a role variable should be built
* according to the provided roleStructure.
*
* @param isent
* Sentence to get pairs for.
* @param rS
* RoleStructure describing which pairs to include.
* @param allowPredArgSelfLoops
* boolean indicating if pairs (i,i) should be included.
* @return
*/
public static List<Pair<Integer, Integer>> getPossibleRolePairs(int n, IntSet knownPreds, Collection<Pair<Integer, Integer>> knownPairs, Collection<Pair<Integer, Integer>> pairsToSkip, RoleStructure rS,
boolean allowPredArgSelfLoops) {
List<Pair<Integer, Integer>> toReturn = new ArrayList<>();
if (rS == RoleStructure.PAIRS_GIVEN) {
toReturn.addAll(knownPairs);
toReturn.sort(ComparablePair.naturalOrder());
} else if (rS == RoleStructure.PREDS_GIVEN) {
// CoNLL-friendly model; preds given
IntIter iter = knownPreds.iterator();
while (iter.hasNext()) {
int i = iter.next();
for (int j = 0; j < n; j++) {
if (i == j && !allowPredArgSelfLoops) {
continue;
}
toReturn.add(new Pair<>(i, j));
}
}
} else if (rS == RoleStructure.ALL_PAIRS) {
// n**2 model
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i != j || allowPredArgSelfLoops) {
toReturn.add(new Pair<>(i, j));
}
}
}
} else if (rS == RoleStructure.NO_ROLES) {
// No role variables.
} else {
throw new IllegalArgumentException("Unsupported model structure: " + rS);
}
if (pairsToSkip != null) {
toReturn.removeAll(pairsToSkip);
}
return toReturn;
}
示例2: getConfigArr
import edu.jhu.prim.iter.IntIter; //导入方法依赖的package包/类
/**
* Gets an array version of the configuration iterator.
* @see edu.jhu.pacaya.gm.model.VarSet#getConfigIter
*/
public int[] getConfigArr(VarSet vars) {
IntArrayList a = new IntArrayList(vars.calcNumConfigs());
IntIter iter = getConfigIter(vars);
while (iter.hasNext()) {
a.add(iter.next());
}
return a.toNativeArray();
}
示例3: getConfigArr
import edu.jhu.prim.iter.IntIter; //导入方法依赖的package包/类
/**
* Gets an array version of the configuration iterator.
* @see edu.jhu.pacaya.gm.model.IndexForVc#getConfigIter
*/
public static int[] getConfigArr(VarSet vars, VarConfig config) {
IntArrayList a = new IntArrayList(config.getVars().calcNumConfigs());
IntIter iter = getConfigIter(vars, config);
while (iter.hasNext()) {
a.add(iter.next());
}
return a.toNativeArray();
}