docstr: This function is to extract dictionary features for each character
docstr_tok: ["This","function","is","to","extract","dictionary","features","for","each","character"]
code: def extract_dict_feat(self, para, idx):
      """
      This function is to extract dictionary features for each character
      """
      length = len(para)
  
      dict_forward_feats = [
          0 for i in range(self.args["num_dict_feat"])
      ]
      dict_backward_feats = [
          0 for i in range(self.args["num_dict_feat"])
      ]
      forward_word = para[idx][0]
      backward_word = para[idx][0]
      prefix = True
      suffix = True
      for window in range(1, self.args["num_dict_feat"] + 1):
          # concatenate each character and check if words found in dict not, stop if prefix not found
          # check if idx+t is out of bound and if the prefix is already not found
          if (idx + window) <= length - 1 and prefix:
              forward_word += para[idx + window][0].lower()
              # check in json file if the word is present as prefix or word or None.
              feat = (
                  1 if forward_word in self.dictionary["words"] else 0
              )
              # if the return value is not 2 or 3 then the checking word is not a valid word in dict.
              dict_forward_feats[window - 1] = feat
              # if the dict return 0 means no prefixes found, thus, stop looking for forward.
              if forward_word not in self.dictionary["prefixes"]:
                  prefix = False
          # backward check: similar to forward
          if (idx - window) >= 0 and suffix:
              backward_word = (
                  para[idx - window][0].lower() + backward_word
              )
              feat = (
                  1 if backward_word in self.dictionary["words"] else 0
              )
              dict_backward_feats[window - 1] = feat
              if backward_word not in self.dictionary["suffixes"]:
                  suffix = False
          # if cannot find both prefix and suffix, then exit the loop
          if not prefix and not suffix:
              break
  
      return dict_forward_feats + dict_backward_feats
  
imports: from bisect import bisect_right
  from copy import copy
  import numpy
  import random
  import logging
  import re
  import torch
  from torch.utils.data import Dataset
  from .vocab import Vocab
  from stanza.models.common.utils import sort_with_indices, unsort
label_desc: Use image node_id 3 for calling the TokenizationDataset obj's underlying member method code with example usage: obj.extract_dict_feat(para, idx) and returns: unknown