docstr: Return values from this charlm for a list of list of words
docstr_tok: ["Return","values","from","this","charlm","for","a","list","of","list","of","words"]
code: def build_char_representation(self, sentences):
      """
      Return values from this charlm for a list of list of words
      """
      forward = self.is_forward_lm
      vocab = self.char_vocab()
      device = next(self.parameters()).device
  
      all_data = []
      for idx, words in enumerate(sentences):
          if not forward:
              words = [x[::-1] for x in reversed(words)]
  
          chars = [CHARLM_START]
          offsets = []
          for w in words:
              chars.extend(w)
              chars.append(CHARLM_END)
              offsets.append(len(chars) - 1)
          if not forward:
              offsets.reverse()
          chars = vocab.map(chars)
          all_data.append((chars, offsets, len(chars), len(all_data)))
  
      all_data.sort(key=itemgetter(2), reverse=True)
      chars, char_offsets, char_lens, orig_idx = tuple(zip(*all_data))
      # TODO: can this be faster?
      chars = get_long_tensor(
          chars, len(all_data), pad_id=vocab.unit2id(CHARLM_END)
      ).to(device=device)
  
      with torch.no_grad():
          output, _, _ = self.forward(chars, char_lens)
          res = [
              output[i, offsets]
              for i, offsets in enumerate(char_offsets)
          ]
          res = unsort(res, orig_idx)
  
      return res
  
imports: from collections import Counter
  from operator import itemgetter
  import os
  import torch
  import torch.nn
  from torch.nn.utils.rnn import pack_sequence, pad_packed_sequence, pack_padded_sequence, PackedSequence
  from stanza.models.common.data import get_long_tensor
  from stanza.models.common.packed_lstm import PackedLSTM
  from stanza.models.common.utils import open_read_text, tensor_unsort, unsort
  from stanza.models.common.dropout import SequenceUnitDropout
  from stanza.models.common.vocab import UNK_ID, CharVocab
label_desc: Use image node_id 5 for calling the CharacterLanguageModel obj's underlying member method code with example usage: obj.build_char_representation(sentences) and returns: res