def featurize_document(self, doc, fmt='dict'):
    """Featurizes a Document.

    Args:
      doc: a Document instance.
      fmt: can be either 'dict' or 'bert_inputs'. Default is 'dict'.

    Returns:
      If fmt is 'dict', a dict with the following structure:
        input_ids: [candidate_seq_len] int32 Tensor
        input_mask: [candidate_seq_len] int32 Tensor
        segment_ids: [candidate_seq_len] int32 Tensor
      If fmt is 'bert_inputs', a BertInputs object.
    """
    bert_inputs = bert_format(
        input_seqs=[doc.title_token_ids, doc.body_token_ids],
        max_seq_len=self.candidate_seq_len,
        cls_id=self.tokenizer.cls_id,
        sep_id=self.tokenizer.sep_id)

    return self._reformat_bert_inputs(bert_inputs, fmt)
Featurizes a Document.

    Args:
      doc: a Document instance.
      fmt: can be either 'dict' or 'bert_inputs'. Default is 'dict'.

    Returns:
      If fmt is 'dict', a dict with the following structure:
        input_ids: [candidate_seq_len] int32 Tensor
        input_mask: [candidate_seq_len] int32 Tensor
        segment_ids: [candidate_seq_len] int32 Tensor
      If fmt is 'bert_inputs', a BertInputs object.
    
language/realm/featurization.py