code: def doc2txt(fp_doc, fp_txt):
      """
      Standard NER.
      .docx -> .txt
      """
      doc = docx.Document(fp_doc)
      temp_sentence = ""
      d = {}
      sentences = []
      for num in range(len(doc.paragraphs)):
          text = doc.paragraphs[num].text
          if text.find("Sentence") == 0:
              if temp_sentence != "":
                  sentences.append(d)
                  d = {}
              temp_sentence = text[9:]
              d["sentence"] = text[9:]
              d["entities"] = []
          else:
              label = text.split(":")[0]
              words = text.split(":")[1]
              words = words.split(",")
              for word in words:
                  d["entities"].append({"word": word, "label": label})
      if temp_sentence != "":
          sentences.append(d)
  
      symbol = []
      for line in sentences:
          sentence = line.get("sentence")
          labels = ["O"] * len(sentence)
          entities = line.get("entities")
          for entity in entities:
              word = entity.get("word")
              label = entity.get("label")
              for idx in range(len(sentence) - len(word)):
                  if sentence[idx : idx + len(word)] == word:
                      labels[idx] = "B-" + label
                      for i in range(idx + 1, idx + len(word)):
                          labels[i] = "I-" + label
          symbol.append(labels)
  
      with open(fp_txt, "w", encoding="utf-8") as f2:
          for idx in range(len(sentences)):
              for i in range(len(sentences[idx].get("sentence"))):
                  f2.write(
                      sentences[idx].get("sentence")[i]
                      + " "
                      + symbol[idx][i]
                      + "\n"
                  )
              if idx != len(sentences) - 1:
                  f2.write("\n")
  
file_path: DeepKE/src/deepke/transform_data.py
imports: import csv
  import json
  import xlrd2
  import docx
label_desc: Use image node_id 4 for calling a global function with example usage: doc2txt(fp_doc, fp_txt) without return types