class_docstr: Dataset for training a Nearest Neighbour model for zero shot intent recognition.
docstr: Creates examples for the training and dev sets.
code: def _create_examples(self, raw_features):
      """Creates examples for the training and dev sets."""
      examples = []
      seen_utterances = set()
      for idx in range(len(raw_features)):
          ex = self.raw_features[idx].data
          user_utterance = ex["utterance"]
          if user_utterance in seen_utterances:
              continue
          seen_utterances.add(user_utterance)
          intent = ex["labels"]["intent"]
          sentences = [user_utterance]
          labels = [-1]
          for candidate_intent in ex["possible_labels"]["intent"]:
              text_b = "{} {}".format(
                  self.cfg.prompt_template, candidate_intent
              )
              label = 1 if candidate_intent == intent else 0
              labels.append(label)
              sentences.append(text_b)
  
          while self.max_n > len(labels) - 1:
              labels.append(label)
              sentences.append(text_b)
  
          encoded_input = self.tokenizer.tokenizer(
              sentences,
              padding="max_length",
              truncation=True,
              return_tensors="pt",
              max_length=self.cfg.max_seq_length,
          )
          examples.append(
              (
                  encoded_input["input_ids"],
                  encoded_input["attention_mask"],
                  torch.tensor(labels),
              )
          )
      return examples
  
file_path: NeMo/nemo/collections/nlp/data/dialogue/dataset/dialogue_nearest_neighbour_dataset.py
imports: import torch
  from nemo.collections.nlp.data.dialogue.dataset.dialogue_dataset import DialogueDataset
label_desc: Use image node_id 3 for calling the DialogueNearestNeighbourDataset obj's underlying member method code with example usage: obj._create_examples(raw_features) and returns: examples