code: def parse_txt(
      parser: SpacyBISTParser,
      txt_path: Union[str, PathLike],
      out_dir: Union[str, PathLike] = None,
      show_tok=True,
      show_doc=True,
  ):
      """Parse raw documents in the form of lines in a text file.
  
      Args:
          parser (SpacyBISTParser)
          txt_path (str or PathLike)
          out_dir (str or PathLike): If specified, the output will also be written to this path.
          show_tok (bool, optional): Specifies whether to include token text in output.
          show_doc (bool, optional): Specifies whether to include document text in output.
  
      Yields:
          CoreNLPDoc: the annotated document.
      """
      with open(txt_path, encoding="utf-8") as f:
          if out_dir:
              print("Writing parsed documents to {}".format(out_dir))
          for i, doc_text in enumerate(
              tqdm(f, total=line_count(txt_path), file=sys.stdout)
          ):
              parsed_doc = parser.parse(
                  doc_text.rstrip("\n"), show_tok, show_doc
              )
  
              if out_dir:
                  out_path = Path(out_dir) / (str(i + 1) + ".json")
                  with open(
                      out_path, "w", encoding="utf-8"
                  ) as doc_file:
                      doc_file.write(parsed_doc.pretty_json())
              yield parsed_doc
  
imports: import csv
  import json
  import sys
  from os import walk, path, makedirs, PathLike, listdir
  from os.path import join, isfile, isdir
  from pathlib import Path
  from typing import Union
  from tqdm import tqdm
  import numpy
  from nlp_architect.common.core_nlp_doc import CoreNLPDoc
  from nlp_architect.models.absa import INFERENCE_LEXICONS
  from nlp_architect.models.absa.inference.data_types import LexiconElement, Polarity
  from nlp_architect.models.absa.train.data_types import OpinionTerm
  from nlp_architect.pipelines.spacy_bist import SpacyBISTParser
  from nlp_architect.utils.io import download_unlicensed_file, line_count
  from types import GeneratorType
label_desc: Use image node_id 7 for calling a global function with example usage: parse_txt(parser, txt_path, out_dir, show_tok, show_doc) without return types