class_docstr:     Line based graph construction class
  Parameters
  ----------
  embedding_style: dict
      Specify embedding styles including ``word_emb_type``, ``node_edge_level_emb_type``
      and ``graph_level_emb_type``.
  vocab: VocabModel
      Vocabulary including all words appeared in graphs.
class_docstr_tok: ["Line","based","graph","construction","class","Parameters","--","--","--","--","--","embedding_style",":","dict","Specify","embedding","styles","including","``","word_emb_type","``",",","``","node_edge_level_emb_type","``","and","``","graph_level_emb_type","``",".","vocab",":","VocabModel","Vocabulary","including","all","words","appeared","in","graphs","."]
docstr: Parameters
  ----------
  raw_text_data: list of list of word tokens
  Returns
  -------
  parsed_results: list of dict
      key, value
      "node_num": int
          the node amount
      "node_content": list[dict]
          The list consisting node information. Each node is organized by a dict.
          'token': str
              word token
          'position_id': int
              the word's position id in original sentence. eg: It is a dog.
              position_id: 0, 1, 2, 3
          'id': int,
              the node token's id which will be used in GraphData
          "sentence_id": int
              The sentence's id in the whole text.
      "graph_content": list[dict]
          The list consisting edge information. Each edge is organized by a dict.
          "edge_type": str
              The edge type token, eg: 'nsubj'
          'src': int
              The source node ``id``
          'tgt': int
              The target node ``id``
docstr_tok: ["Parameters","--","--","--","--","--","raw_text_data",":","list","of","list","of","word","tokens","Returns","--","--","--","-","parsed_results",":","list","of","dict","key",",","value","``","node_num","''",":","int","the","node","amount","``","node_content","''",":","list","[","dict","]","The","list","consisting","node","information",".","Each","node","is","organized","by","a","dict",".","'token","'",":","str","word","token","'position_id","'",":","int","the","word","'s","position","id","in","original","sentence",".","eg",":","It","is","a","dog",".","position_id",":","0",",","1",",","2",",","3","'id","'",":","int",",","the","node","token","'s","id","which","will","be","used","in","GraphData","``","sentence_id","''",":","int","The","sentence","'s","id","in","the","whole","text",".","``","graph_content","''",":","list","[","dict","]","The","list","consisting","edge","information",".","Each","edge","is","organized","by","a","dict",".","``","edge_type","''",":","str","The","edge","type","token",",","eg",":","'nsubj'","'src","'",":","int","The","source","node","``","id","``","'tgt","'",":","int","The","target","node","``","id","``"]
code: def parsing(cls, raw_text_data, tokenizer=None):
      """
      Parameters
      ----------
      raw_text_data: list of list of word tokens
      Returns
      -------
      parsed_results: list of dict
          key, value
          "node_num": int
              the node amount
          "node_content": list[dict]
              The list consisting node information. Each node is organized by a dict.
              'token': str
                  word token
              'position_id': int
                  the word's position id in original sentence. eg: It is a dog.
                  position_id: 0, 1, 2, 3
              'id': int,
                  the node token's id which will be used in GraphData
              "sentence_id": int
                  The sentence's id in the whole text.
          "graph_content": list[dict]
              The list consisting edge information. Each edge is organized by a dict.
              "edge_type": str
                  The edge type token, eg: 'nsubj'
              'src': int
                  The source node ``id``
              'tgt': int
                  The target node ``id``
      """
      if isinstance(raw_text_data, str):
          if tokenizer is None:
              raw_text_data = raw_text_data.split(" ")
          else:
              raw_text_data = tokenizer(raw_text_data)
      parsed_results = []
      # for sent_id in range(len(raw_text_data)):
      parsed_sent = {}
      parsed_sent["graph_content"] = []
      parsed_sent["node_content"] = []
      sent = raw_text_data  # [sent_id]
      assert len(sent) >= 2
      parsed_sent["node_num"] = len(sent)
      # generate node content in a text
      # dep_parser = CoreNLPDependencyParser(url='http://localhost:9020')
      # processor = stanfordcorenlp.StanfordCoreNLP('F:/xiaojie/stanford-corenlp-4.1.0',
      # port=9080, timeout=1000)
      for token_id in range(len(sent)):
          node = {}
          node["token"] = sent[token_id]
          node["sentence_id"] = 0
          node["id"] = token_id
          node["position_id"] = token_id
          parsed_sent["node_content"].append(node)
      # generate graph content in a text
      raw_sent = " ".join(sent)
      if len(sent) < 20:
          dep_json = cls.processor.annotate(raw_sent)
          dep_dict = json.loads(dep_json)
          tokens = dep_dict["sentences"][0]["tokens"]
          for dep in dep_dict["sentences"][0]["basicDependencies"]:
              if cls.verbose > 0:
                  print(dep)
              if dep["governorGloss"] == "ROOT":
                  continue
              if dep["dependentGloss"] == "ROOT":
                  continue
              g = {}
              if (
                  tokens[int(dep["governor"] - 1)] in sent
                  and tokens[int(dep["dependent"] - 1)] in sent
              ):
                  g["src"] = int(dep["governor"] - 1)
                  g["tgt"] = int(dep["dependent"] - 1)
                  g["edge_type"] = dep["dep"]
                  parsed_sent["graph_content"].append(g)
  
      #        (parse_sent, ),(null, )=dep_parser.parse_sents([sent,sent])
      #        dep_info = parse_sent.to_conll(10)
      #        new_sent=get_new_sent(dep_info)
      #        for line in dep_info.strip().split('\n'):
      #                    g={}
      #                    if line.split('\t')[1] in sent:
      #                      g['src']=sent.index(line.split('\t')[1])
      #                      if int(line.split('\t')[6])>0:
      #                          if new_sent[int(line.split('\t')[6])-1] in sent:
      #                              token=new_sent[int(line.split('\t')[6])-1]
      #                              g['tgt']=sent.index(token)
      #                              g['edge_type']=line.split('\t')[-3]
      #                              parsed_sent['graph_content'].append(g)
      parsed_results.append(parsed_sent)
  
      return parsed_results
  
file_path: graph4nlp/examples/pytorch/name_entity_recognition/dependency_graph_construction_without_tokenize.py
imports: import copy
  import itertools
  import json
  from collections import Counter
  from graph4nlp.pytorch.data.data import GraphData
  from graph4nlp.pytorch.modules.graph_construction.base import StaticGraphConstructionBase
label_desc: Use image node_id 3 for calling the DependencyBasedGraphConstruction_without_tokenizer obj's underlying member method code with example usage: obj.parsing(cls, raw_text_data, tokenizer) and returns: parsed_results