code: def get_candidate_representation(
      candidate_desc,
      tokenizer,
      max_seq_length,
      candidate_title=None,
      title_tag=ENT_TITLE_TAG,
  ):
      cls_token = tokenizer.cls_token
      sep_token = tokenizer.sep_token
      cand_tokens = tokenizer.tokenize(candidate_desc)
      if candidate_title is not None:
          title_tokens = tokenizer.tokenize(candidate_title)
          cand_tokens = title_tokens + [title_tag] + cand_tokens
  
      cand_tokens = cand_tokens[: max_seq_length - 2]
      cand_tokens = [cls_token] + cand_tokens + [sep_token]
  
      input_ids = tokenizer.convert_tokens_to_ids(cand_tokens)
      padding = [0] * (max_seq_length - len(input_ids))
      input_ids += padding
      assert len(input_ids) == max_seq_length
  
      return {
          "tokens": cand_tokens,
          "ids": [input_ids],
      }
  
file_path: BLINK/elq/biencoder/data_process.py
imports: import os
  import json
  import logging
  import torch
  from tqdm import tqdm, trange
  from torch.utils.data import DataLoader, TensorDataset
  from pytorch_transformers.tokenization_bert import BertTokenizer
  from blink.biencoder.zeshel_utils import world_to_id
  from elq.common.params import ENT_START_TAG, ENT_END_TAG, ENT_TITLE_TAG
label_desc: Use image node_id 8 for calling a global function with example usage: get_candidate_representation(candidate_desc, tokenizer, max_seq_length, candidate_title, title_tag) and returns: dict