docstr: This function is a extension of the possible_unk_token heuristic
  in lookup_words_1d, which fails in the case when multiple unks are
  available. The way we deal with this is we increment every unk token in
  ordered_unks_token everytime we substitute an unk token. This solves a
  substantial amount of queries with multiple unk tokens.
docstr_tok: ["This","function","is","a","extension","of","the","possible_unk_token","heuristic","in","lookup_words_1d",",","which","fails","in","the","case","when","multiple","unks","are","available",".","The","way","we","deal","with","this","is","we","increment","every","unk","token","in","ordered_unks_token","everytime","we","substitute","an","unk","token",".","This","solves","a","substantial","amount","of","queries","with","multiple","unk","tokens","."]
code: def lookup_words_1d_cycle_heuristic(
      self,
      values: torch.Tensor,
      filter_token_list: List[int],
      ordered_unks_token: List[str],
  ) -> List[str]:
      """This function is a extension of the possible_unk_token heuristic
      in lookup_words_1d, which fails in the case when multiple unks are
      available. The way we deal with this is we increment every unk token in
      ordered_unks_token everytime we substitute an unk token. This solves a
      substantial amount of queries with multiple unk tokens.
      """
      unk_idx = 0
      unk_idx_length: int = len(ordered_unks_token)
      unk_copy: bool = unk_idx_length != 0
      vocab_length: int = len(self.vocab)
  
      result: List[str] = []
      for idx in range(values.size(0)):
          value = int(values[idx])
          if not (value in filter_token_list):
              if value < vocab_length and value != self.unk_idx:
                  result.append(self.vocab[value])
              else:
                  if not unk_copy:
                      result.append(self.vocab[self.unk_idx])
                  else:
                      unk_value = ordered_unks_token[
                          unk_idx % unk_idx_length
                      ]
                      result.append(unk_value)
                      unk_idx += 1
  
      return result
  
file_path: pytext/pytext/torchscript/vocab.py
imports: from typing import Dict, List, Optional
  import torch
  import torch.nn
  from pytext.common.constants import SpecialTokens
label_desc: Use image node_id 8 for calling the ScriptVocabulary obj's underlying member method code with example usage: obj.lookup_words_1d_cycle_heuristic(values, filter_token_list, ordered_unks_token) and returns: result