class_docstr: Helper class creating xml file to one without references to nkjp: namespace.
  That's needed because the XMLCorpusView assumes that one can find short substrings
  of XML that are valid XML, which is not true if a namespace is declared at top level
class_docstr_tok: ["Helper","class","creating","xml","file","to","one","without","references","to","nkjp",":","namespace",".","That","'s","needed","because","the","XMLCorpusView","assumes","that","one","can","find","short","substrings","of","XML","that","are","valid","XML",",","which","is","not","true","if","a","namespace","is","declared","at","top","level"]
code: def build_preprocessed_file(self):
      try:
          fr = open(self.read_file)
          fw = self.write_file
          line = " "
          while len(line):
              line = fr.readline()
              x = re.split(r"nkjp:[^ ]* ", line)  # in all files
              ret = " ".join(x)
              x = re.split(
                  "<nkjp:paren>", ret
              )  # in ann_segmentation.xml
              ret = " ".join(x)
              x = re.split(
                  "</nkjp:paren>", ret
              )  # in ann_segmentation.xml
              ret = " ".join(x)
              x = re.split("<choice>", ret)  # in ann_segmentation.xml
              ret = " ".join(x)
              x = re.split("</choice>", ret)  # in ann_segmentation.xml
              ret = " ".join(x)
              fw.write(ret)
          fr.close()
          fw.close()
          return self.write_file.name
      except Exception as e:
          self.remove_preprocessed_file()
          raise Exception from e
  
imports: import functools
  import os
  import re
  import tempfile
  from nltk.corpus.reader.util import concat
  from nltk.corpus.reader.xmldocs import XMLCorpusReader, XMLCorpusView
label_desc: Use image node_id 2 for calling the XML_Tool obj's underlying member method code with example usage: obj.build_preprocessed_file() and returns: self