class_docstr:     Information Extraction based graph construction class
  
  Parameters
  ----------
  embedding_style: dict
      Specify embedding styles including ``single_token_item``,
      ``emb_strategy``, ``num_rnn_layers``, ``bert_model_name``
      and ``bert_lower_case``.
  vocab: VocabModel
      Vocabulary including all words appeared in graphs.
class_docstr_tok: ["Information","Extraction","based","graph","construction","class","Parameters","--","--","--","--","--","embedding_style",":","dict","Specify","embedding","styles","including","``","single_token_item","``",",","``","emb_strategy","``",",","``","num_rnn_layers","``",",","``","bert_model_name","``","and","``","bert_lower_case","``",".","vocab",":","VocabModel","Vocabulary","including","all","words","appeared","in","graphs","."]
docstr:     This method will connect entities in the ``triple_list`` to ensure the graph
      is connected.
  
  Parameters
  ----------
  triple_list: list of [subject, relation, object]
      A list of all triples extracted from ``raw_text_data`` using coref and openie.
  
  merge_strategy: None or str, option=[None, "global", "user_define"]
      Strategy to merge sub-graphs into one graph
      ``None``:  Do not add additional nodes and edges.
  
      ``global``: All subjects in extracted triples are connected by a "GLOBAL_NODE"
                  using a "global" edge
  
      ``"user_define"``: We will give this option to the user.
      User can override this method to define your merge strategy.
  
  Returns
  -------
  global_triples: list of [subject, relation, object]
      The added triples using merge_strategy.
docstr_tok: ["This","method","will","connect","entities","in","the","``","triple_list","``","to","ensure","the","graph","is","connected",".","Parameters","--","--","--","--","--","triple_list",":","list","of","[","subject",",","relation",",","object","]","A","list","of","all","triples","extracted","from","``","raw_text_data","``","using","coref","and","openie",".","merge_strategy",":","None","or","str",",","option=","[","None",",","``","global","''",",","``","user_define","''","]","Strategy","to","merge","sub-graphs","into","one","graph","``","None","``",":","Do","not","add","additional","nodes","and","edges",".","``","global","``",":","All","subjects","in","extracted","triples","are","connected","by","a","``","GLOBAL_NODE","''","using","a","``","global","''","edge","``","``","user_define","''","``",":","We","will","give","this","option","to","the","user",".","User","can","override","this","method","to","define","your","merge","strategy",".","Returns","--","--","--","-","global_triples",":","list","of","[","subject",",","relation",",","object","]","The","added","triples","using","merge_strategy","."]
code: def _graph_connect(cls, triple_list, merge_strategy=None):
      """
          This method will connect entities in the ``triple_list`` to ensure the graph
          is connected.
  
      Parameters
      ----------
      triple_list: list of [subject, relation, object]
          A list of all triples extracted from ``raw_text_data`` using coref and openie.
  
      merge_strategy: None or str, option=[None, "global", "user_define"]
          Strategy to merge sub-graphs into one graph
          ``None``:  Do not add additional nodes and edges.
  
          ``global``: All subjects in extracted triples are connected by a "GLOBAL_NODE"
                      using a "global" edge
  
          ``"user_define"``: We will give this option to the user.
          User can override this method to define your merge strategy.
  
      Returns
      -------
      global_triples: list of [subject, relation, object]
          The added triples using merge_strategy.
      """
  
      if merge_strategy == "global":
          graph_nodes = []
          global_triples = []
          for triple in triple_list:
              if triple[0] not in graph_nodes:
                  graph_nodes.append(triple[0])
                  global_triples.append(
                      [triple[0], "global", "GLOBAL_NODE"]
                  )
  
              if triple[2] not in graph_nodes:
                  graph_nodes.append(triple[2])
  
          return global_triples
      elif merge_strategy is None:
          return []
      else:
          raise NotImplementedError(
              "Not Implemented Merge Strategy: {}.".format(
                  merge_strategy
              )
          )
  
file_path: graph4nlp/graph4nlp/pytorch/modules/graph_construction/ie_graph_construction.py
imports: import json
  from ...data.data import GraphData
  from .base import StaticGraphConstructionBase
label_desc: Use image node_id 6 for calling the IEBasedGraphConstruction obj's underlying member method code with example usage: obj._graph_connect(cls, triple_list, merge_strategy) and returns: global_triples, list