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


Java Node.getInternalNodes方法代码示例

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


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

示例1: afterNode

import org.galagosearch.core.retrieval.query.Node; //导入方法依赖的package包/类
public Node afterNode(Node node) throws Exception {
    ArrayList<Node> children = node.getInternalNodes();
    if (node.getOperator().equals("weight")) {
        // first, verify that the appropriate children are weights
        if (children.size() % 2 == 1) {
            throw new IOException("A weighted node cannot have an odd number of internal nodes: " +
                    node.getInternalNodes().size());
        }
                    
        // now, reassemble everything:
        ArrayList<Node> newChildren = new ArrayList<Node>();
        for (int i = 0; i < children.size(); i += 2) {
            Node weightNode = children.get(i);
            Node childNode = children.get(i+1);
            
            ArrayList<Node> newChild = new ArrayList<Node>();
            newChild.add(childNode);
            Node scaledNode = new Node("scale", getWeight(weightNode), newChild);
            newChildren.add(scaledNode);
        }

        return new Node("combine", newChildren);
    } else {
        return node;
    }
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:27,代码来源:WeightConversionTraversal.java

示例2: afterNode

import org.galagosearch.core.retrieval.query.Node; //导入方法依赖的package包/类
public Node afterNode(Node node) throws Exception {
    ArrayList<Node> newChildren = new ArrayList<Node>();
    NodeType nodeType = retrieval.getNodeType(node);
    if (nodeType == null) return node;
    ArrayList<Node> children = node.getInternalNodes();
    // Given that we're going to pass children.size() + 1 parameters to
    // this constructor, what types should those parameters have?
    Class[] types = nodeType.getParameterTypes(children.size() + 1);
    if (types == null) return node;

    for (int i = 1; i < types.length; ++i) {
        Node child = children.get(i-1);
        // If the parent will expect a ScoreIterator at this position, but
        // we've got a CountIterator here, we'll perform a conversion step.
        if (ScoreIterator.class.isAssignableFrom(types[i]) &&
            isCountNode(children.get(i-1))) {
            Node feature = createSmoothingNode(child);
            newChildren.add(feature);
        } else {
            newChildren.add(child);
        }
    }

    return new Node(node.getOperator(), node.getParameters(),
                    newChildren, node.getPosition());
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:27,代码来源:ImplicitFeatureCastTraversal.java

示例3: afterNode

import org.galagosearch.core.retrieval.query.Node; //导入方法依赖的package包/类
public Node afterNode(Node node) throws Exception {
    ArrayList<Node> children = new ArrayList<Node>();

    if (node.getOperator().equals("combine")) {
        ArrayList<Node> oldChildren = node.getInternalNodes();
        for (int i = 0; i < oldChildren.size(); i++) {
            Node child = oldChildren.get(i);
            boolean isStopword = child.getOperator().equals("text") &&
                                 words.contains(child.getDefaultParameter());
            if (!isStopword) {
                children.add(child);
            }
        }

        return new Node(node.getOperator(), children);
    }
    
    return node;
}
 
开发者ID:youngilcho,项目名称:internet-application-2014,代码行数:20,代码来源:RemoveStopwordsTraversal.java

示例4: createIterator

import org.galagosearch.core.retrieval.query.Node; //导入方法依赖的package包/类
public StructuredIterator createIterator(Node node) throws Exception {
    ArrayList<StructuredIterator> internalIterators = new ArrayList<StructuredIterator>();

    for (Node internalNode : node.getInternalNodes()) {
        StructuredIterator internalIterator = createIterator(internalNode);
        internalIterators.add(internalIterator);
    }
    
    StructuredIterator iterator = index.getIterator(node);
    if (iterator == null) {
        iterator = featureFactory.getIterator(node, internalIterators);
    }
    
    return iterator;
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:16,代码来源:StructuredRetrieval.java

示例5: stemmedNode

import org.galagosearch.core.retrieval.query.Node; //导入方法依赖的package包/类
private Node stemmedNode(Node original) {
    Parameters parameters = original.getParameters().clone();
    parameters.add("part", "stemmedPostings");
    String term = parameters.get("default");
    stemmer.setCurrent(term);
    stemmer.stem();
    String stemmed = stemmer.getCurrent();
    parameters.set("default", stemmed);
    return new Node("extents", parameters, original.getInternalNodes(), original.getPosition());
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:11,代码来源:TextFieldRewriteTraversal.java

示例6: afterNode

import org.galagosearch.core.retrieval.query.Node; //导入方法依赖的package包/类
public Node afterNode(Node original) {
    String operator = original.getOperator();
    ArrayList<Node> children = original.getInternalNodes();

    if (operator.length() == 0) {
        return original;
    }

    if (Character.isDigit(operator.codePointAt(0))) {
        // this is a #n node, which is an ordered window node
        return new Node("od", operator, children, original.getPosition());
    } else if (operator.startsWith("od") &&
            operator.length() > 2 &&
            Character.isDigit(operator.codePointAt(2))) {
        // this is a #od3() node
        return new Node("od", operator.substring(2),
                children, original.getPosition());
    } else if (operator.startsWith("uw") &&
            operator.length() > 2 &&
            Character.isDigit(operator.codePointAt(2))) {
        // this is a #uw3 node
        return new Node("uw", operator.substring(2),
                children, original.getPosition());
    }

    return original;
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:28,代码来源:IndriWindowCompatibilityTraversal.java

示例7: transformedNode

import org.galagosearch.core.retrieval.query.Node; //导入方法依赖的package包/类
public Node transformedNode(Node original,
        String operatorName, String indexName) {
    Parameters parameters = original.getParameters().clone();
    parameters.add("part", indexName);
    return new Node(operatorName, parameters, original.getInternalNodes(), original.getPosition());
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:7,代码来源:TextFieldRewriteTraversal.java


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