class_docstr: Maps individual tokens to sequences of character ids, compatible with ELMo.
  To be consistent with previously trained models, we include it here as special of existing
  character indexers.
  
  We allow to add optional additional special tokens with designated
  character ids with `tokens_to_add`.
class_docstr_tok: ["Maps","individual","tokens","to","sequences","of","character","ids",",","compatible","with","ELMo",".","To","be","consistent","with","previously","trained","models",",","we","include","it","here","as","special","of","existing","character","indexers",".","We","allow","to","add","optional","additional","special","tokens","with","designated","character","ids","with","`","tokens_to_add","`","."]
code: def convert_word_to_char_ids(self, word: str) -> List[int]:
      if word in self.tokens_to_add:
          char_ids = [
              ELMoCharacterMapper.padding_character
          ] * ELMoCharacterMapper.max_word_length
          char_ids[0] = ELMoCharacterMapper.beginning_of_word_character
          char_ids[1] = self.tokens_to_add[word]
          char_ids[2] = ELMoCharacterMapper.end_of_word_character
      elif word == ELMoCharacterMapper.bos_token:
          char_ids = (
              ELMoCharacterMapper.beginning_of_sentence_characters
          )
      elif word == ELMoCharacterMapper.eos_token:
          char_ids = ELMoCharacterMapper.end_of_sentence_characters
      else:
          word_encoded = word.encode("utf-8", "ignore")[
              : (ELMoCharacterMapper.max_word_length - 2)
          ]
          char_ids = [
              ELMoCharacterMapper.padding_character
          ] * ELMoCharacterMapper.max_word_length
          char_ids[0] = ELMoCharacterMapper.beginning_of_word_character
          for k, chr_id in enumerate(word_encoded, start=1):
              char_ids[k] = chr_id
          char_ids[
              len(word_encoded) + 1
          ] = ELMoCharacterMapper.end_of_word_character
  
      # +1 one for masking
      return [c + 1 for c in char_ids]
  
file_path: allennlp/allennlp/data/token_indexers/elmo_indexer.py
imports: from typing import Dict, List
  import torch
  from allennlp.common.util import pad_sequence_to_length
  from allennlp.data.tokenizers import Token
  from allennlp.data.token_indexers.token_indexer import TokenIndexer, IndexedTokenList
  from allennlp.data.vocabulary import Vocabulary
label_desc: Use image node_id 2 for calling the ELMoCharacterMapper obj's underlying member method code with example usage: obj.convert_word_to_char_ids(word) and returns: unknown