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 of word tokens or string of sequence
  tokenizer: the tokenizer will be used if raw_text_data is a str; if None, use the default             tokenizoer will be used. The output of the required tokenizer should be a list             of 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: I am 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","of","word","tokens","or","string","of","sequence","tokenizer",":","the","tokenizer","will","be","used","if","raw_text_data","is","a","str",";","if","None",",","use","the","default","tokenizoer","will","be","used",".","The","output","of","the","required","tokenizer","should","be","a","list","of","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",":","I","am","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 of word tokens or string of sequence
          tokenizer: the tokenizer will be used if raw_text_data is a str; if None, use the default \
              tokenizoer will be used. The output of the required tokenizer should be a list \
              of 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: I am 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"] = None
      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
      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)
      parsed_results.append(parsed_sent)
  
      return parsed_results
  
file_path: graph4nlp/examples/pytorch/name_entity_recognition/line_graph_construction.py
imports: import copy
  import itertools
  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 LineBasedGraphConstruction obj's underlying member method code with example usage: obj.parsing(cls, raw_text_data, tokenizer) and returns: parsed_results