def pad_texts(self, sentences: List[List[np.ndarray]]) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]:
pad = np.zeros(self.opt['<STR_LIT>'])<EOL>cutted_batch = [sen[:self.opt['<STR_LIT>']] for sen in sentences]<EOL>if self.opt["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>cutted_batch = [[pad] * (self.opt['<STR_LIT>'] - len(tokens)) + list(tokens) for tokens in cutted_batch]<EOL><DEDENT>elif self.opt["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>cutted_batch = [list(tokens) + [pad] * (self.opt['<STR_LIT>'] - len(tokens)) for tokens in cutted_batch]<EOL><DEDENT>else:<EOL><INDENT>raise ConfigError("<STR_LIT>".format(self.opt['<STR_LIT>']))<EOL><DEDENT>return np.asarray(cutted_batch)<EOL>
Cut and pad tokenized texts to self.opt["text_size"] tokens

Args:
    sentences: list of lists of tokens

Returns:
    array of embedded texts