def empty_stack(stack, graph):
    """
    Pops the items in the stack. If they have no head, they are assigned
    a ROOT head
    :param stack:
    :param graph:
    :return:
    """
    for word in stack:
        if word['id'] not in graph['heads']:
            graph['heads'][word['id']] = '0'
            graph['deprels'][word['id']] = 'ROOT'
    stack = []
    return stack, graph