# Path: linguistica/cli.py
# def main():
#     print('\n================================================================'
#           '\nWelcome to Linguistica {}!'
#           '\n================================================================'
#           .format(lxa_version))
# 
#     # --------------------------------------------------------------------------
#     # determine if file is a wordlist or a corpus text
# 
#     use_wordlist = determine_use_wordlist()
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # get file path
# 
#     file_abspath = get_file_abspath()
# 
#     print('\nFull file path:\n{}'.format(file_abspath))
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # determine output directory
# 
#     output_dir = os.path.join(os.path.dirname(file_abspath), 'lxa_outputs')
# 
#     print('\nDefault output directory:\n{}'.format(output_dir))
# 
#     output_dir = get_output_dir(output_dir)
# 
#     if not os.path.isdir(output_dir):
#         os.mkdir(output_dir)
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # change encoding, if instructed
# 
#     encoding = get_encoding()
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # create the Linguistica object
# 
#     if use_wordlist:
#         lxa_object = lxa.read_wordlist(file_abspath, encoding=encoding)
#     else:
#         lxa_object = lxa.read_corpus(file_abspath, encoding=encoding)
# 
#     # --------------------------------------------------------------------------
#     # change parameters, if instructed
# 
#     print('\nParameters:\n{}'.format(pformat(lxa_object.parameters())))
# 
#     new_parameter_value_pairs = get_new_parameters()
# 
#     if new_parameter_value_pairs:
#         lxa_object.change_parameters(**dict(new_parameter_value_pairs))
# 
#         print('\nParameters after the changes:\n{}'
#               .format(pformat(lxa_object.parameters())))
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # run all Linguistica modules on the given file
# 
#     print('\nRunning all Linguistica modules on the given file:')
# 
#     lxa_object.run_all_modules(verbose=True)
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # output results as files
# 
#     print('\nGenerating output files...\n')
# 
#     lxa_object.output_all_results(directory=output_dir, verbose=True)
# 
#     print('\nResults are in ' + output_dir)


import sys
import linguistica as lxa
from linguistica.cli import main as cli_main
    from linguistica.gui import main as gui_main
        lxa_mode = sys.argv[1].lower()
    except IndexError:
        lxa_mode = None
        error_msg_template = 'Error: no running mode specified.' \
                             '\n\nRun one of the following:\n\n{}'

        sys.exit(error_msg_template.format(
            '\n'.join('linguistica ' + mode for mode in sorted(MODES))))

    if lxa_mode not in MODES:
        sys.exit('Unrecognized mode: ' + sys.argv[1])

    # --------------------------------------------------------------------------
    # launch graphical user interface

    if lxa_mode == 'gui':

        if pyqt5_available:
            print('Running the graphical user interface of Linguistica {}...'
                  .format(lxa_version))
            gui_main()

        else:
            sys.exit('Unable to import PyQt5. '
                     'Graphical user interface cannot be launched.')

    # --------------------------------------------------------------------------
    # launch command line interface

    if lxa_mode == 'cli':

# Path: linguistica/cli.py
# def main():
#     print('\n================================================================'
#           '\nWelcome to Linguistica {}!'
#           '\n================================================================'
#           .format(lxa_version))
# 
#     # --------------------------------------------------------------------------
#     # determine if file is a wordlist or a corpus text
# 
#     use_wordlist = determine_use_wordlist()
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # get file path
# 
#     file_abspath = get_file_abspath()
# 
#     print('\nFull file path:\n{}'.format(file_abspath))
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # determine output directory
# 
#     output_dir = os.path.join(os.path.dirname(file_abspath), 'lxa_outputs')
# 
#     print('\nDefault output directory:\n{}'.format(output_dir))
# 
#     output_dir = get_output_dir(output_dir)
# 
#     if not os.path.isdir(output_dir):
#         os.mkdir(output_dir)
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # change encoding, if instructed
# 
#     encoding = get_encoding()
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # create the Linguistica object
# 
#     if use_wordlist:
#         lxa_object = lxa.read_wordlist(file_abspath, encoding=encoding)
#     else:
#         lxa_object = lxa.read_corpus(file_abspath, encoding=encoding)
# 
#     # --------------------------------------------------------------------------
#     # change parameters, if instructed
# 
#     print('\nParameters:\n{}'.format(pformat(lxa_object.parameters())))
# 
#     new_parameter_value_pairs = get_new_parameters()
# 
#     if new_parameter_value_pairs:
#         lxa_object.change_parameters(**dict(new_parameter_value_pairs))
# 
#         print('\nParameters after the changes:\n{}'
#               .format(pformat(lxa_object.parameters())))
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # run all Linguistica modules on the given file
# 
#     print('\nRunning all Linguistica modules on the given file:')
# 
#     lxa_object.run_all_modules(verbose=True)
# 
#     print('--------------------------------------------')
# 
#     # --------------------------------------------------------------------------
#     # output results as files
# 
#     print('\nGenerating output files...\n')
# 
#     lxa_object.output_all_results(directory=output_dir, verbose=True)
# 
#     print('\nResults are in ' + output_dir)


# Path: linguistica/__main__.py
import sys
import linguistica as lxa
from linguistica.cli import main as cli_main
    from linguistica.gui import main as gui_main

        lxa_mode = sys.argv[1].lower()
    except IndexError:
        lxa_mode = None
        error_msg_template = 'Error: no running mode specified.' \
                             '\n\nRun one of the following:\n\n{}'

        sys.exit(error_msg_template.format(
            '\n'.join('linguistica ' + mode for mode in sorted(MODES))))

    if lxa_mode not in MODES:
        sys.exit('Unrecognized mode: ' + sys.argv[1])

    # --------------------------------------------------------------------------
    # launch graphical user interface

    if lxa_mode == 'gui':

        if pyqt5_available:
            print('Running the graphical user interface of Linguistica {}...'
                  .format(lxa_version))
            gui_main()

        else:
            sys.exit('Unable to import PyQt5. '
                     'Graphical user interface cannot be launched.')

    # --------------------------------------------------------------------------
    # launch command line interface

    if lxa_mode == 'cli':

        cli_main()