class_docstr: Implementation of Dataset class
  
  This is a simple implementation of loading and processing dataset for GATNE model.
  
  Args:
      config: dict, some configure parameters.
class_docstr_tok: ["Implementation","of","Dataset","class","This","is","a","simple","implementation","of","loading","and","processing","dataset","for","GATNE","model",".","Args",":","config",":","dict",",","some","configure","parameters","."]
docstr: Load train data from file and preprocess them.
  
  Args:
      file_: str, file name for loading data
      slf_loop: bool, if true, add self loop edge for every node
      symmetry_edge: bool, if true, add symmetry edge for every edge
docstr_tok: ["Load","train","data","from","file","and","preprocess","them",".","Args",":","file_",":","str",",","file","name","for","loading","data","slf_loop",":","bool",",","if","true",",","add","self","loop","edge","for","every","node","symmetry_edge",":","bool",",","if","true",",","add","symmetry","edge","for","every","edge"]
code: def load_training_data(
      self, file_, slf_loop=True, symmetry_edge=True
  ):
      """Load train data from file and preprocess them.
  
      Args:
          file_: str, file name for loading data
          slf_loop: bool, if true, add self loop edge for every node
          symmetry_edge: bool, if true, add symmetry edge for every edge
  
      """
      logging.info("loading data from %s" % file_)
      edge_data_by_type = dict()
      all_edges = list()
      all_nodes = list()
  
      with open(file_, "r") as reader:
          for line in reader:
              words = line.strip().split(" ")
              if words[0] not in edge_data_by_type:
                  edge_data_by_type[words[0]] = []
              src, dst = words[1], words[2]
              edge_data_by_type[words[0]].append((src, dst))
              all_edges.append((src, dst))
              all_nodes.append(src)
              all_nodes.append(dst)
  
              if symmetry_edge:
                  edge_data_by_type[words[0]].append((dst, src))
                  all_edges.append((dst, src))
  
      all_nodes = list(set(all_nodes))
      all_edges = list(set(all_edges))
      #  edge_data_by_type['Base'] = all_edges
  
      if slf_loop:
          for e_type in edge_data_by_type.keys():
              for n in all_nodes:
                  edge_data_by_type[e_type].append((n, n))
  
      # remapping to index
      edges_by_type = {}
      for edge_type, edges in edge_data_by_type.items():
          res_edges = []
          for edge in edges:
              res_edges.append(
                  (self.word2index[edge[0]], self.word2index[edge[1]])
              )
          edges_by_type[edge_type] = res_edges
  
      return edges_by_type, all_edges, all_nodes
  
file_path: PGL/legacy/examples/GATNE/Dataset.py
imports: import sys
  import os
  import tqdm
  import numpy
  import logging
  import random
  from pgl import heter_graph
  import pickle
label_desc: Use image node_id 3 for calling the Dataset obj's underlying member method code with example usage: obj.load_training_data(file_, slf_loop, symmetry_edge) and returns: edges_by_type,  all_edges,  all_nodes