lib/proiel/cli/converters/conll-u.rb
def promote!(new_sibling_relation = nil, new_dependent_relation = 'aux')
        raise 'Cannot promote a token under root!' if @head_id == 0
        new_head_relation = head.relation
        new_head_id = head.head_id

        # move all dependents of the former head to the new one
        siblings.each do |t|
          t.head_id = @id
          # ugly hack to avoid overwriting the aux relation here (aux siblings aren't really siblings)
          t.relation = new_sibling_relation if (new_sibling_relation and t.relation != 'aux')
        end

        # remove the former head if it was empty
        if head.is_empty?
          @sentence.remove_token!(head)
        # else make it a dependent of the new head
        else
          head.head_id = @id
          head.relation = new_dependent_relation
        end

        @head_id = new_head_id
        # don't use relation=, as we don't want this relation to be
        # copied down a tree of conjunctions
        @relation = new_head_relation
      end
# promotes a node to its head's place. The node takes over its
# former head's relation and all dependents. The new relation
# for these dependents can be specified; if it is not, they will
# keep their former relation. The former head is made a
# dependent of the node (with a specified relation) or,
# if it is an empty node, destroyed.
promotes a node to its head's place. The node takes over its
former head's relation and all dependents. The new relation
for these dependents can be specified; if it is not, they will
keep their former relation. The former head is made a
dependent of the node (with a specified relation) or,
if it is an empty node, destroyed.
promotes a node to its head ' s place . The node takes over its former head ' s relation and all dependents . The new relation for these dependents can be specified ; if it is not they will keep their former relation . The former head is made a dependent of the node ( with a specified relation ) or if it is an empty node destroyed .
def promote!(new_sibling_relation = nil, new_dependent_relation = 'aux')
        raise 'Cannot promote a token under root!' if @head_id == 0
        new_head_relation = head.relation
        new_head_id = head.head_id
        siblings.each do |t|
          t.head_id = @id
          t.relation = new_sibling_relation if (new_sibling_relation and t.relation != 'aux')
        end
        if head.is_empty?
          @sentence.remove_token!(head)
        else
          head.head_id = @id
          head.relation = new_dependent_relation
        end
        @head_id = new_head_id
        @relation = new_head_relation
      end
def promote! ( new_sibling_relation = nil , new_dependent_relation = 'aux' ) raise 'Cannot promote a token under root!' if @head_id == 0 new_head_relation = head . relation new_head_id = head . head_id siblings . each do | t | t . head_id = @id t . relation = new_sibling_relation if ( new_sibling_relation and t . relation != 'aux' ) end if head . is_empty? @sentence . remove_token! ( head ) else head . head_id = @id head . relation = new_dependent_relation end @head_id = new_head_id @relation = new_head_relation end
promotes a node to its head's place.
promotes a node to its head ' s place .
# move all dependents of the former head to the new one # ugly hack to avoid overwriting the aux relation here (aux siblings aren't really siblings) # remove the former head if it was empty # else make it a dependent of the new head # don't use relation=, as we don't want this relation to be # copied down a tree of conjunctions
new_sibling_relation
new_dependent_relation