def __add_token(self, word, sent_id, feat_format='unknown'):
        """
        adds a token to the document graph (with all the features given
        in the columns of the CoNLL file).

        Parameters
        ----------
        word : Conll2009Word or Conll2010Word
            a namedtuple representing all the information stored in a CoNLL
            file line (token, lemma, pos, dependencies etc.)
        sent_id : str
            the ID of the sentence this word/token belongs to

        Returns
        -------
        token_id : str
            the ID of the token just created
        """
        token_id = '{0}_t{1}'.format(sent_id, word.word_id)
        feats = word._asdict()
        # dicts can't be generated and updated at once
        feats.update({self.ns+':token': word.token, 'label': word.token,
                      'word_pos': int(word.word_id)})
        self.__add_morph_features(feats, feats[self.feat_attr], feat_format)
        self.add_node(token_id, layers={self.ns, self.ns+':token'},
                      attr_dict=feats, sent_pos=int(sent_id[1:]))
        self.tokens.append(token_id)
        self.node[sent_id]['tokens'].append(token_id)
        return token_id
def __add_token ( self , word , sent_id , feat_format = 'unknown' ) : token_id = '{0}_t{1}' . format ( sent_id , word . word_id ) feats = word . _asdict ( ) feats . update ( { self . ns + ':token' : word . token , 'label' : word . token , 'word_pos' : int ( word . word_id ) } ) self . __add_morph_features ( feats , feats [ self . feat_attr ] , feat_format ) self . add_node ( token_id , layers = { self . ns , self . ns + ':token' } , attr_dict = feats , sent_pos = int ( sent_id [ 1 : ] ) ) self . tokens . append ( token_id ) self . node [ sent_id ] [ 'tokens' ] . append ( token_id ) return token_id
adds a token to the document graph (with all the features given
        in the columns of the CoNLL file).

        Parameters
        ----------
        word : Conll2009Word or Conll2010Word
            a namedtuple representing all the information stored in a CoNLL
            file line (token, lemma, pos, dependencies etc.)
        sent_id : str
            the ID of the sentence this word/token belongs to

        Returns
        -------
        token_id : str
            the ID of the token just created