# Path: corpkit/constants.py
# INPUTFUNC = input if PYTHON_VERSION == 3 else raw_input
# 
# PYTHON_VERSION = sys.version_info.major


from corpkit.constants import INPUTFUNC, PYTHON_VERSION
    from os.path import join, isfile, isdir, basename, splitext, exists
    from corpkit.build import folderise, can_folderise
    from corpkit.process import saferead, make_dotfile
    from corpkit.build import (get_corpus_filepaths, 
                               check_jdk, 
                               rename_all_files,
                               make_no_id_corpus, parse_corpus, move_parsed_files)
    from corpkit.constants import REPEAT_PARSE_ATTEMPTS, OPENER, PYTHON_VERSION
                from joblib import Parallel, delayed
                    from corpkit.constants import OPENER
            from corpkit.conll import convert_json_to_conll
        from corpkit.tokenise import plaintext_to_conll
    import sys
    import os
    import shutil
    import codecs
        import __main__ as main
                import __main__ as main
                    import multiprocessing
            import shutil
                    if len(data) > split_texts:
                        chk = chunks(data, split_texts)
                        for index, c in enumerate(chk):
                            newname = fp.replace('.txt', '-%s.txt' % str(index + 1).zfill(3))
                            split_f_names.append(newname)
                            data = '\n'.join(c) + '\n'
                            # does this work?
                            with OPENER(newname, 'w') as fo: 
                                if PYTHON_VERSION == 2:
                                    data = data.encode('utf-8', errors='ignore')
                                fo.write(data)
                        os.remove(fp)
                    else:
                        pass
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            for f in split_f_names:
                os.remove(f)
            pass

        if outname:
            newpath = os.path.join(os.path.dirname(unparsed_corpus_path), outname)
        else:
            newpath = unparsed_corpus_path + '-parsed'
        if restart:
            restart = newpath
        if speaker_segmentation or metadata:
            if isdir(newpath) and not root:
                if not restart and not hasattr(main, '__file__'):

# Path: corpkit/constants.py
# INPUTFUNC = input if PYTHON_VERSION == 3 else raw_input
# 
# PYTHON_VERSION = sys.version_info.major


# Path: corpkit/make.py
from corpkit.constants import INPUTFUNC, PYTHON_VERSION
    from os.path import join, isfile, isdir, basename, splitext, exists
    from corpkit.build import folderise, can_folderise
    from corpkit.process import saferead, make_dotfile
    from corpkit.build import (get_corpus_filepaths, 
                               check_jdk, 
                               rename_all_files,
                               make_no_id_corpus, parse_corpus, move_parsed_files)
    from corpkit.constants import REPEAT_PARSE_ATTEMPTS, OPENER, PYTHON_VERSION
                from joblib import Parallel, delayed
                    from corpkit.constants import OPENER
            from corpkit.conll import convert_json_to_conll
        from corpkit.tokenise import plaintext_to_conll
    import sys
    import os
    import shutil
    import codecs
        import __main__ as main
                import __main__ as main
                    import multiprocessing
            import shutil

                    if len(data) > split_texts:
                        chk = chunks(data, split_texts)
                        for index, c in enumerate(chk):
                            newname = fp.replace('.txt', '-%s.txt' % str(index + 1).zfill(3))
                            split_f_names.append(newname)
                            data = '\n'.join(c) + '\n'
                            # does this work?
                            with OPENER(newname, 'w') as fo: 
                                if PYTHON_VERSION == 2:
                                    data = data.encode('utf-8', errors='ignore')
                                fo.write(data)
                        os.remove(fp)
                    else:
                        pass
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            for f in split_f_names:
                os.remove(f)
            pass

        if outname:
            newpath = os.path.join(os.path.dirname(unparsed_corpus_path), outname)
        else:
            newpath = unparsed_corpus_path + '-parsed'
        if restart:
            restart = newpath
        if speaker_segmentation or metadata:
            if isdir(newpath) and not root:
                if not restart and not hasattr(main, '__file__'):

                    ans = INPUTFUNC('\n Path exists: %s. Do you want to overwrite? (y/n)\n' %newpath)