bin/bilm/data.py
def encode_chars(self, sentence, reverse=False, split=True):
        '''
        Encode the sentence as a white space delimited string of tokens.
        '''
        if split:
            chars_ids = [self.word_to_char_ids(cur_word)
                     for cur_word in sentence.split()]
        else:
            chars_ids = [self.word_to_char_ids(cur_word)
                     for cur_word in sentence]
        if reverse:
            return np.vstack([self.eos_chars] + chars_ids + [self.bos_chars])
        else:
            return np.vstack([self.bos_chars] + chars_ids + [self.eos_chars])

        Encode the sentence as a white space delimited string of tokens.
        
Encode the sentence as a white space delimited string of tokens.
Encode the sentence as a white space delimited string of tokens .
def encode_chars(self, sentence, reverse=False, split=True):
        if split:
            chars_ids = [self.word_to_char_ids(cur_word)
                     for cur_word in sentence.split()]
        else:
            chars_ids = [self.word_to_char_ids(cur_word)
                     for cur_word in sentence]
        if reverse:
            return np.vstack([self.eos_chars] + chars_ids + [self.bos_chars])
        else:
            return np.vstack([self.bos_chars] + chars_ids + [self.eos_chars])
def encode_chars ( self , sentence , reverse = False , split = True ) : if split : chars_ids = [ self . word_to_char_ids ( cur_word ) for cur_word in sentence . split ( ) ] else : chars_ids = [ self . word_to_char_ids ( cur_word ) for cur_word in sentence ] if reverse : return np . vstack ( [ self . eos_chars ] + chars_ids + [ self . bos_chars ] ) else : return np . vstack ( [ self . bos_chars ] + chars_ids + [ self . eos_chars ] )
Encode the sentence as a white space delimited string of tokens.
Encode the sentence as a white space delimited string of tokens .
'''
        Encode the sentence as a white space delimited string of tokens.
        '''
self
sentence
reverse
split