class_docstr: "Memory-Augmented Recurrent Neural Networks Can Learn Generalized Dyck Languages" (Suzgun et al., 2019)
  (https://arxiv.org/abs/1911.03329)
  
  Disclaimer:
  
  A similar version of this generation was used in the generation of the following BigBench task:
  https://github.com/google/BIG-bench/tree/main/bigbench/benchmark_tasks/dyck_languages.
  
  The `dyck_languages` task in BigBench is formulated as a multiple choice task and contains 1K distinct
  Dyck-4 sequences, whose lengths are bounded to [4, 100]. In this version of the task, however, we are
  allowing the user to specify the sizes and lengths of the training and test sets, as well as the
  types/numbers of parenthesis-pairs used.
  
  Task:
  
  Predict the sequence of the closing parentheses of a Dyck-n word without its last few closing parentheses.
  
  Args:
      seed: Numpy random seed.
      num_parenthesis_pairs: Total number of parenthesis pairs.
      parenthesis_pairs: List of parenthesis pairs (if it is None, it is automatically generated).
  
      prob_p: The "p" value used in the PCFG for Dyck-n (see below).
      prob_q: The "q" value used in the PCFG for Dyck-n (see below).
  
      max_recursive_depth: Maximum recursive depth that can be reached while genereating a sequence.
  
      min_seq_train_length: Minimum length that a sequence in the training set can have.
      max_seq_train_length: Maximum length that a sequence in the training set can have.
      min_seq_test_length: Minimum length that a sequence in the test set can have.
      max_seq_test_length: Maximum length that a sequence in the test set can have.
  
      max_output_size: Maximum allowed length of the output.
  
  I/O examples:
  
      -- Input : ( ( [
      -- Output: ] ) )
  
      -- Input: < { } [ ]
      -- Output: >
  
      -- Input : { < > } [ < > ] ( [ ] {
      -- Output: } )
class_docstr_tok: ["``","Memory-Augmented","Recurrent","Neural","Networks","Can","Learn","Generalized","Dyck","Languages","''","(","Suzgun","et","al.",",","2019",")","(","https",":","\/\/arxiv.org\/abs\/1911.03329",")","Disclaimer",":","A","similar","version","of","this","generation","was","used","in","the","generation","of","the","following","BigBench","task",":","https",":","\/\/github.com\/google\/BIG-bench\/tree\/main\/bigbench\/benchmark_tasks\/dyck_languages",".","The","`","dyck_languages","`","task","in","BigBench","is","formulated","as","a","multiple","choice","task","and","contains","1K","distinct","Dyck-4","sequences",",","whose","lengths","are","bounded","to","[","4",",","100","]",".","In","this","version","of","the","task",",","however",",","we","are","allowing","the","user","to","specify","the","sizes","and","lengths","of","the","training","and","test","sets",",","as","well","as","the","types\/numbers","of","parenthesis-pairs","used",".","Task",":","Predict","the","sequence","of","the","closing","parentheses","of","a","Dyck-n","word","without","its","last","few","closing","parentheses",".","Args",":","seed",":","Numpy","random","seed",".","num_parenthesis_pairs",":","Total","number","of","parenthesis","pairs",".","parenthesis_pairs",":","List","of","parenthesis","pairs","(","if","it","is","None",",","it","is","automatically","generated",")",".","prob_p",":","The","``","p","''","value","used","in","the","PCFG","for","Dyck-n","(","see","below",")",".","prob_q",":","The","``","q","''","value","used","in","the","PCFG","for","Dyck-n","(","see","below",")",".","max_recursive_depth",":","Maximum","recursive","depth","that","can","be","reached","while","genereating","a","sequence",".","min_seq_train_length",":","Minimum","length","that","a","sequence","in","the","training","set","can","have",".","max_seq_train_length",":","Maximum","length","that","a","sequence","in","the","training","set","can","have",".","min_seq_test_length",":","Minimum","length","that","a","sequence","in","the","test","set","can","have",".","max_seq_test_length",":","Maximum","length","that","a","sequence","in","the","test","set","can","have",".","max_output_size",":","Maximum","allowed","length","of","the","output",".","I\/O","examples",":","--","Input",":","(","(","[","--","Output",":","]",")",")","--","Input",":","<","{","}","[","]","--","Output",":",">","--","Input",":","{","<",">","}","[","<",">","]","(","[","]","{","--","Output",":","}",")"]
docstr: Creates an input.
docstr_tok: ["Creates","an","input","."]
code: def get_input(self, sequence: List[str], max_n: int) -> List[str]:
      """Creates an input."""
      depth_counter = np.zeros(self.num_parenthesis_pairs)
      for i in range(len(sequence) - 1, -1, -1):
          if sequence[i] in self.opening_parentheses:
              index = self.opening_parentheses.index(sequence[i])
              depth_counter[index] -= 1
          else:
              index = self.closing_parentheses.index(sequence[i])
              depth_counter[index] += 1
  
          if depth_counter.sum() == max_n:
              return sequence[:i]
      return []
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/scenarios/dyck_language_scenario.py
imports: import numpy
  import random
  from typing import List, Tuple
  from .scenario import Scenario, Instance, Reference, TRAIN_SPLIT, TEST_SPLIT, CORRECT_TAG, Input, Output
label_desc: Use image node_id 3 for calling the DyckLanguageScenario obj's underlying member method code with example usage: obj.get_input(sequence, max_n) and returns: list, sequence