# 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
    def chunks(l, n):
        for i in range(0, len(l), n):
            yield l[i:i+n]

    if (parse or tokenise) and coref:
            
        # this loop shortens files containing more than 500 lines,
        # for corenlp memory's sake. maybe user needs a warning or
        # something in case s/he is doing coref?

        # try block because it isn't necessarily essential that this works.
        # just delete generated files if it fails part way
        split_f_names = []
        try:
            for rootx, dirs, fs in os.walk(unparsed_corpus_path):
                for f in fs:
                    # skip hidden files
                    if f.startswith('.'):
                        continue
                    fp = join(rootx, f)
                    data, enc = saferead(fp)
                    data = data.splitlines()
                    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: 

# 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

    def chunks(l, n):
        for i in range(0, len(l), n):
            yield l[i:i+n]

    if (parse or tokenise) and coref:
            
        # this loop shortens files containing more than 500 lines,
        # for corenlp memory's sake. maybe user needs a warning or
        # something in case s/he is doing coref?

        # try block because it isn't necessarily essential that this works.
        # just delete generated files if it fails part way
        split_f_names = []
        try:
            for rootx, dirs, fs in os.walk(unparsed_corpus_path):
                for f in fs:
                    # skip hidden files
                    if f.startswith('.'):
                        continue
                    fp = join(rootx, f)
                    data, enc = saferead(fp)
                    data = data.splitlines()
                    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: