class_docstr: analogous to fairseq.data.IndexedCachedDataset
docstr: Extract the char/byte ids for char/bytes associated with the input word.
docstr_tok: ["Extract","the","char\/byte","ids","for","char\/bytes","associated","with","the","input","word","."]
code: def _word_to_char_ids(self, word, word_dict, char_dict, embed_bytes):
      """
      Extract the char/byte ids for char/bytes associated with the input word.
      """
      if embed_bytes:
          # The byte_id needs to be incremented by 1 to account for the
          # padding id (0) in the embedding table
          char_inds = (
              [vocab_constants.NUM_BYTE_INDICES + TAGS.index(word) + 1]
              if word in TAGS
              else [
                  byte_id + 1
                  for byte_id in word.encode("utf8", "ignore")
              ]
          )
      else:
          if word in word_dict or not self.ignore_chars_for_unks:
              chars = [word] if word in TAGS else list(word)
              char_inds = [char_dict.index(c) for c in chars]
          else:
              char_inds = [char_dict.eos_index]
      return char_inds
  
imports: from typing import Any, Dict
  import numpy
  import torch
  from fairseq import data, tokenizer
  from fvcore.common.file_io import PathManager
  from pytorch_translate import vocab_constants
  from pytorch_translate.data.dictionary import TAGS
label_desc: Use image node_id 9 for calling the InMemoryNumpyWordCharDataset obj's underlying member method code with example usage: obj._word_to_char_ids(word, word_dict, char_dict, embed_bytes) and returns: char_inds