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


from corpkit.constants import STRINGTYPE, PYTHON_VERSION, INPUTFUNC
    from subprocess import Popen, PIPE, STDOUT
    from time import localtime, strftime
    from corpkit.dictionaries.word_transforms import wordlist
    from collections import Counter
    from corpkit.dictionaries.process_types import Wordlist
    from time import localtime, strftime
        from corpkit.other import as_regex
        from traitlets import TraitError
            from ipywidgets import IntProgress, HTML, VBox
            from IPython.display import display
            from ipywidgets.widgets.widget_box import Box
        from corpkit.textprogressbar import TextProgressBar
            from corpkit.build import get_speaker_names_from_parsed_corpus
    from time import localtime, strftime
    from corpkit.process import is_number
    from collections import Counter
    from pandas import DataFrame
    from corpkit.editor import editor
        from corpkit.dictionaries import taglemma
        from corpkit.dictionaries import taglemma
    from nltk.tree import ParentedTree
    from nltk.tgrep import tgrep_nodes, tgrep_positions
        from cPickle import UnpickleableError as unpick_error
        from cPickle import PicklingError as unpick_error_2
        from pickle import UnpicklingError as unpick_error
        from pickle import PicklingError as unpick_error_2
    from corpkit.gui import corpkit_gui
    from corpkit.constants import transshow, transobjs
    from corpkit.dictionaries.process_types import Wordlist
    from corpkit.constants import transshow, transobjs
    from corpkit.constants import CONLL_COLUMNS
        from corpkit.process import lemmatiser
    from corpkit.dictionaries.word_transforms import wordlist, taglemma
        from nltk.stem.wordnet import WordNetLemmatizer
    from corpkit.corpus import Corpus
    from corpkit.build import get_all_metadata_fields, get_speaker_names_from_parsed_corpus
    from corpkit.constants import OPENER
    from corpkit.corpus import Corpus
    from corpkit.constants import OPENER
    from corpkit.corpus import Corpus, Subcorpus
    import corpkit
    import subprocess 
    import re
    import os
    import sys
    import corpkit
    import sys
    import os
    import inspect
    import nltk
    import os
    import inspect
    import os
    import sys
    import os
    import os
    import re
            import traceback
            import sys
    import re
    import inspect
    import os
        import subprocess
    import os
    import sys
    import re
    import glob
    import os
        import cPickle as pickle
        import pickle
    import chardet
    import sys
    import re
    import os
    import re
    import re
    import re
    import os
    import os
    import json
    import os
    import json
    import re

    return lookup.get(mc, 'plaintext'), singlefile

def filtermaker(the_filter, case_sensitive=False, **kwargs):
    """
    Create a search/exclude value
    """
    root = kwargs.get('root')
    if isinstance(the_filter, (list, Wordlist)):
        the_filter = as_regex(the_filter, case_sensitive=case_sensitive)
    try:
        output = re.compile(the_filter)
        is_valid = True
    except:
        is_valid = False
        if root:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            lst = traceback.format_exception(exc_type, exc_value, exc_traceback)
            error_message = lst[-1]
            thetime = strftime("%H:%M:%S", localtime())
            print('%s: Filter %s' % (thetime, error_message))
            return 'Bad query'
    
    while not is_valid:
        if root:
            time = strftime("%H:%M:%S", localtime())
            print(the_filter)
            print('%s: Invalid regular expression.' % time)
            return False
        time = strftime("%H:%M:%S", localtime())

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


# Path: corpkit/process.py
from corpkit.constants import STRINGTYPE, PYTHON_VERSION, INPUTFUNC
    from subprocess import Popen, PIPE, STDOUT
    from time import localtime, strftime
    from corpkit.dictionaries.word_transforms import wordlist
    from collections import Counter
    from corpkit.dictionaries.process_types import Wordlist
    from time import localtime, strftime
        from corpkit.other import as_regex
        from traitlets import TraitError
            from ipywidgets import IntProgress, HTML, VBox
            from IPython.display import display
            from ipywidgets.widgets.widget_box import Box
        from corpkit.textprogressbar import TextProgressBar
            from corpkit.build import get_speaker_names_from_parsed_corpus
    from time import localtime, strftime
    from corpkit.process import is_number
    from collections import Counter
    from pandas import DataFrame
    from corpkit.editor import editor
        from corpkit.dictionaries import taglemma
        from corpkit.dictionaries import taglemma
    from nltk.tree import ParentedTree
    from nltk.tgrep import tgrep_nodes, tgrep_positions
        from cPickle import UnpickleableError as unpick_error
        from cPickle import PicklingError as unpick_error_2
        from pickle import UnpicklingError as unpick_error
        from pickle import PicklingError as unpick_error_2
    from corpkit.gui import corpkit_gui
    from corpkit.constants import transshow, transobjs
    from corpkit.dictionaries.process_types import Wordlist
    from corpkit.constants import transshow, transobjs
    from corpkit.constants import CONLL_COLUMNS
        from corpkit.process import lemmatiser
    from corpkit.dictionaries.word_transforms import wordlist, taglemma
        from nltk.stem.wordnet import WordNetLemmatizer
    from corpkit.corpus import Corpus
    from corpkit.build import get_all_metadata_fields, get_speaker_names_from_parsed_corpus
    from corpkit.constants import OPENER
    from corpkit.corpus import Corpus
    from corpkit.constants import OPENER
    from corpkit.corpus import Corpus, Subcorpus
    import corpkit
    import subprocess 
    import re
    import os
    import sys
    import corpkit
    import sys
    import os
    import inspect
    import nltk
    import os
    import inspect
    import os
    import sys
    import os
    import os
    import re
            import traceback
            import sys
    import re
    import inspect
    import os
        import subprocess
    import os
    import sys
    import re
    import glob
    import os
        import cPickle as pickle
        import pickle
    import chardet
    import sys
    import re
    import os
    import re
    import re
    import re
    import os
    import os
    import json
    import os
    import json
    import re


    return lookup.get(mc, 'plaintext'), singlefile

def filtermaker(the_filter, case_sensitive=False, **kwargs):
    """
    Create a search/exclude value
    """
    root = kwargs.get('root')
    if isinstance(the_filter, (list, Wordlist)):
        the_filter = as_regex(the_filter, case_sensitive=case_sensitive)
    try:
        output = re.compile(the_filter)
        is_valid = True
    except:
        is_valid = False
        if root:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            lst = traceback.format_exception(exc_type, exc_value, exc_traceback)
            error_message = lst[-1]
            thetime = strftime("%H:%M:%S", localtime())
            print('%s: Filter %s' % (thetime, error_message))
            return 'Bad query'
    
    while not is_valid:
        if root:
            time = strftime("%H:%M:%S", localtime())
            print(the_filter)
            print('%s: Invalid regular expression.' % time)
            return False
        time = strftime("%H:%M:%S", localtime())

        selection = INPUTFUNC('\n%s: filter regular expression " %s " contains an error. You can either:\n\n' \