当前位置: 首页>>代码示例>>Java>>正文


Java SyntaxTreeNode.getChildren方法代码示例

本文整理汇总了Java中edu.uw.easysrl.syntax.grammar.SyntaxTreeNode.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java SyntaxTreeNode.getChildren方法的具体用法?Java SyntaxTreeNode.getChildren怎么用?Java SyntaxTreeNode.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.uw.easysrl.syntax.grammar.SyntaxTreeNode的用法示例。


在下文中一共展示了SyntaxTreeNode.getChildren方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRows

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
private int getRows(final SyntaxTreeNode node, final List<List<SyntaxTreeNode>> rows,
                    final int minIndentation) {
    int maxChildLevel = 0;
    int i = minIndentation;
    for (final SyntaxTreeNode child : node.getChildren()) {
        maxChildLevel = Math.max(getRows(child, rows, i), maxChildLevel);
        i = i + getWidth(child);
    }

    int level;
    if (node.getChildren().size() > 0) {
        level = maxChildLevel + 1;
    } else {
        level = 0;
    }

    while (rows.size() < level + 1) {
        rows.add(new ArrayList<>());
    }
    while (rows.get(level).size() < minIndentation + 1) {
        rows.get(level).add(null);
    }

    rows.get(level).set(minIndentation, node);
    return level;
}
 
开发者ID:uwnlp,项目名称:neuralccg,代码行数:27,代码来源:GatedHtmlPrinter.java

示例2: getRows

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
private static int getRows(SyntaxTreeNode node,
                           List<List<SyntaxTreeNode>> result, int minIndentation) {
    if (node.getDependenciesLabelledAtThisNode().size() > 0) {
        return getRows(node.getChild(0), result, minIndentation);
    }
    int maxChildLevel = 0;
    int i = minIndentation;
    for (final SyntaxTreeNode child : node.getChildren()) {
        maxChildLevel = Math.max(getRows(child, result, i), maxChildLevel);
        i = i + getWidth(child);
    }

    final int level = node.getChildren().isEmpty() ? 0 : maxChildLevel + 1;

    while (result.size() < level + 1) {
        result.add(new ArrayList<SyntaxTreeNode>());
    }
    while (result.get(level).size() < minIndentation + 1) {
        result.get(level).add(null);
    }

    result.get(level).set(minIndentation, node);
    return level;
}
 
开发者ID:uwnlp,项目名称:neuralccg,代码行数:25,代码来源:LatexPrinter.java

示例3: getArgumentConstituent

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
private SyntaxTreeNode getArgumentConstituent(final SyntaxTreeNode node, final int head, final int excludeIndex) {
	final boolean exclude = excludeIndex >= node.getStartIndex() && excludeIndex < node.getEndIndex();

	if (!exclude && node.getDependencyStructure().getArbitraryHead() == head) {
		return node;
	}

	for (final SyntaxTreeNode child : node.getChildren()) {
		final SyntaxTreeNode result = getArgumentConstituent(child, head, excludeIndex);
		if (result != null) {
			return result;
		}
	}

	return null;
}
 
开发者ID:uwnlp,项目名称:EasySRL,代码行数:17,代码来源:ParsePrinter.java

示例4: updateNode

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
private boolean updateNode(final List<SyntaxTreeNodeLeaf> result, final SyntaxTreeNode node) {

		boolean change = false;

		if (node.getChildren().size() == 2 && isVPtoAdverb(node.getChild(1))

				) {

			if (node.getChild(1).getLeaves().get(0).getCategory().equals(Category.valueOf("(S[to]\\NP)/(S[b]\\NP)"))) {
				// He retired (to spend time with family)
				setCategory(result, node.getChild(1).getLeaves().get(0).getHeadIndex(),
						Category.valueOf("((S\\NP)\\(S\\NP))/(S[b]\\NP)"));
				change = true;

			}

		}

		for (final SyntaxTreeNode child : node.getChildren()) {
			change = change || updateNode(result, child);
		}
		return change;
	}
 
开发者ID:uwnlp,项目名称:EasySRL,代码行数:24,代码来源:VPadjunctRebanker.java

示例5: getHash

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
private int getHash(final SyntaxTreeNode parse) {
	Integer result = nodeToHash.get(parse);
	if (result == null) {
		result = 0;

		// Add in a hash for each dependency at this node.
		final List<UnlabelledDependency> resolvedUnlabelledDependencies = parse
				.getResolvedUnlabelledDependencies();
		if (resolvedUnlabelledDependencies != null) {
			for (final UnlabelledDependency dep : resolvedUnlabelledDependencies) {
				for (final int arg : dep.getArguments()) {
					if (dep.getHead() != arg) {
						result = result
								^ categoryToArgumentToHeadToModifierToHash.get(dep.getCategory(),
										dep.getArgNumber())[dep.getHead()][arg];
					}
				}

			}
		}

		for (final SyntaxTreeNode child : parse.getChildren()) {
			result = result ^ getHash(child);
		}
	}

	return result;
}
 
开发者ID:uwnlp,项目名称:EasySRL,代码行数:29,代码来源:ChartCell.java

示例6: extractDependencies

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
public static void extractDependencies(final SyntaxTreeNode parse, final Collection<UnlabelledDependency> deps) {

		if (parse.getChildren().size() == 2) {

			deps.addAll(parse.getResolvedUnlabelledDependencies());
		}
		for (final SyntaxTreeNode child : parse.getChildren()) {
			extractDependencies(child, deps);
		}
	}
 
开发者ID:uwnlp,项目名称:EasySRL,代码行数:11,代码来源:CCGBankEvaluation.java

示例7: getWidth

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
int getWidth(final SyntaxTreeNode node) {
	if (node.getChildren().size() == 0) {
		return 1;
	} else {
		int result = 0;

		for (final SyntaxTreeNode child : node.getChildren()) {
			result = result + getWidth(child);
		}

		return result;
	}
}
 
开发者ID:uwnlp,项目名称:EasySRL,代码行数:14,代码来源:ParsePrinter.java

示例8: getRows

import edu.uw.easysrl.syntax.grammar.SyntaxTreeNode; //导入方法依赖的package包/类
int getRows(final SyntaxTreeNode node, final List<List<SyntaxTreeNode>> result, final int minIndentation) {

			if (node.getDependenciesLabelledAtThisNode().size() > 0) {
				return getRows(node.getChild(0), result, minIndentation);
			}
			int maxChildLevel = 0;
			int i = minIndentation;
			for (final SyntaxTreeNode child : node.getChildren()) {
				maxChildLevel = Math.max(getRows(child, result, i), maxChildLevel);
				i = i + getWidth(child);
			}

			int level;
			if (node.getChildren().size() > 0) {
				level = maxChildLevel + 1;
			} else {
				level = 0;
			}

			while (result.size() < level + 1) {
				result.add(new ArrayList<SyntaxTreeNode>());
			}
			while (result.get(level).size() < minIndentation + 1) {
				result.get(level).add(null);
			}

			result.get(level).set(minIndentation, node);
			return level;
		}
 
开发者ID:uwnlp,项目名称:EasySRL,代码行数:30,代码来源:ParsePrinter.java


注:本文中的edu.uw.easysrl.syntax.grammar.SyntaxTreeNode.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。