docstr: Parameters
  ----------
  root_dir: str
      The path of dataset.
  topology_builder: GraphConstructionBase
      The graph construction class.
  topology_subdir: str
      The directory name of processed path.
  graph_type: str, default='static'
      The graph type. Expected in ('static', 'dynamic')
  edge_strategy: str, default=None
      The edge strategy. Expected in (None, 'homogeneous', 'as_node').
      If set `None`, it will be 'homogeneous'.
  merge_strategy: str, default=None
      The strategy to merge sub-graphs. Expected in (None, 'tailhead', 'user_define').
      If set `None`, it will be 'tailhead'.
  share_vocab: bool, default=False
      Whether to share the input vocabulary with the output vocabulary.
  dynamic_graph_type: str, default=None
      The dynamic graph type. It is only available when `graph_type` is set 'dynamic'.
      Expected in (None, 'node_emb', 'node_emb_refined').
  init_graph_type: str, default=None
      The initial graph topology. It is only available when `graph_type` is set 'dynamic'.
      Expected in (None, 'dependency', 'constituency')
docstr_tok: ["Parameters","--","--","--","--","--","root_dir",":","str","The","path","of","dataset",".","topology_builder",":","GraphConstructionBase","The","graph","construction","class",".","topology_subdir",":","str","The","directory","name","of","processed","path",".","graph_type",":","str",",","default='static'","The","graph","type",".","Expected","in","(","'static","'",",","'dynamic","'",")","edge_strategy",":","str",",","default=None","The","edge","strategy",".","Expected","in","(","None",",","'homogeneous","'",",","'as_node","'",")",".","If","set","`","None","`",",","it","will","be","'homogeneous","'",".","merge_strategy",":","str",",","default=None","The","strategy","to","merge","sub-graphs",".","Expected","in","(","None",",","'tailhead","'",",","'user_define","'",")",".","If","set","`","None","`",",","it","will","be","'tailhead","'",".","share_vocab",":","bool",",","default=False","Whether","to","share","the","input","vocabulary","with","the","output","vocabulary",".","dynamic_graph_type",":","str",",","default=None","The","dynamic","graph","type",".","It","is","only","available","when","`","graph_type","`","is","set","'dynamic","'",".","Expected","in","(","None",",","'node_emb","'",",","'node_emb_refined","'",")",".","init_graph_type",":","str",",","default=None","The","initial","graph","topology",".","It","is","only","available","when","`","graph_type","`","is","set","'dynamic","'",".","Expected","in","(","None",",","'dependency","'",",","'constituency","'",")"]
code: def __init__(
      self,
      graph_name,
      root_dir=None,
      topology_subdir=None,
      topology_builder=None,
      dynamic_init_graph_name=None,
      dynamic_init_topology_builder=None,
      tokenizer=nltk.RegexpTokenizer(" ", gaps=True).tokenize,
      pretrained_word_emb_name=None,
      pretrained_word_emb_url=None,
      target_pretrained_word_emb_name=None,
      target_pretrained_word_emb_url=None,
      pretrained_word_emb_cache_dir=".vector_cache/",
      val_split_ratio=None,
      use_val_for_vocab=False,
      merge_strategy="tailhead",
      edge_strategy=None,
      seed=None,
      word_emb_size=300,
      share_vocab=False,
      for_inference=False,
      reused_vocab_model=None,
      lower_case=True,
  ):
      """
  
      Parameters
      ----------
      root_dir: str
          The path of dataset.
      topology_builder: GraphConstructionBase
          The graph construction class.
      topology_subdir: str
          The directory name of processed path.
      graph_type: str, default='static'
          The graph type. Expected in ('static', 'dynamic')
      edge_strategy: str, default=None
          The edge strategy. Expected in (None, 'homogeneous', 'as_node').
          If set `None`, it will be 'homogeneous'.
      merge_strategy: str, default=None
          The strategy to merge sub-graphs. Expected in (None, 'tailhead', 'user_define').
          If set `None`, it will be 'tailhead'.
      share_vocab: bool, default=False
          Whether to share the input vocabulary with the output vocabulary.
      dynamic_graph_type: str, default=None
          The dynamic graph type. It is only available when `graph_type` is set 'dynamic'.
          Expected in (None, 'node_emb', 'node_emb_refined').
      init_graph_type: str, default=None
          The initial graph topology. It is only available when `graph_type` is set 'dynamic'.
          Expected in (None, 'dependency', 'constituency')
      """
      # Initialize the dataset.
      # If the preprocessed files are not found, then do the preprocessing and save them.
      super(IWSLT14Dataset, self).__init__(
          root_dir=root_dir,
          topology_subdir=topology_subdir,
          graph_name=graph_name,
          topology_builder=topology_builder,
          edge_strategy=edge_strategy,
          merge_strategy=merge_strategy,
          share_vocab=share_vocab,
          pretrained_word_emb_name=pretrained_word_emb_name,
          pretrained_word_emb_url=pretrained_word_emb_url,
          target_pretrained_word_emb_name=target_pretrained_word_emb_name,
          target_pretrained_word_emb_url=target_pretrained_word_emb_url,
          pretrained_word_emb_cache_dir=pretrained_word_emb_cache_dir,
          val_split_ratio=val_split_ratio,
          seed=seed,
          word_emb_size=word_emb_size,
          tokenizer=tokenizer,
          use_val_for_vocab=use_val_for_vocab,
          for_inference=for_inference,
          reused_vocab_model=reused_vocab_model,
          dynamic_init_graph_name=dynamic_init_graph_name,
          dynamic_init_topology_builder=dynamic_init_topology_builder,
          lower_case=lower_case,
      )
  
file_path: graph4nlp/examples/pytorch/nmt/dataset.py
imports: import pickle
  import nltk
  import torch
  from graph4nlp.pytorch.data.dataset import Text2TextDataItem, Text2TextDataset
  from graph4nlp.pytorch.modules.utils.padding_utils import pad_2d_vals_no_size
label_desc: Use image node_id 4 to create a new IWSLT14Dataset object from inherited base classes: Text2TextDataset with example: obj = IWSLT14Dataset(graph_name, root_dir, topology_subdir, topology_builder, dynamic_init_graph_name, dynamic_init_topology_builder, tokenizer, pretrained_word_emb_name, pretrained_word_emb_url, target_pretrained_word_emb_name, target_pretrained_word_emb_url, pretrained_word_emb_cache_dir, val_split_ratio, use_val_for_vocab, merge_strategy, edge_strategy, seed, word_emb_size, share_vocab, for_inference, reused_vocab_model, lower_case)