Exemplo n.º 1
0
def construct_query_node(query_node,id,parent=None):
    query_node = SearchNode(query_node)
    query_node.id = len(id)
    id.append(query_node)
    for i, child in enumerate(query_node.childs):
        query_node.childs[i] = construct_query_node(child,id,query_node)
        query_node.childsize += 1
    return query_node
Exemplo n.º 2
0
def relax_not_node(query_node,id):
    for i,child_node in enumerate(query_node.childs):
        relax_not_node(child_node,id)
    if query_node.label == '\+':
        child = SearchNode(Node(CONJUNCTION))
        child.childs = query_node.childs
        child.id = len(id)
        query_node.childs = [child]
        id.append(child)
    return query_node