def get_arguments():
    try:
        (opts, args) = getopt.getopt(sys.argv[1:], 't:s:r:w:h', ['text=', 'summary=', 'ratio=', 'words=', 'help'])
    except getopt.GetoptError as err:
        exit_with_error(err)
    path = None
    summarize_by = SENTENCE
    ratio = 0.2
    words = None
    for (o, a) in opts:
        if (o in ('-t', '--text')):
            path = a
        elif (o in ('-h', '--help')):
            usage()
            sys.exit()
        elif (o in ('-s', '--summary')):
            summarize_by = int(a)
        elif (o in ('-w', '--words')):
            words = int(a)
        elif (o in ('-r', '--ratio')):
            ratio = float(a)
        else:
            assert False, 'unhandled option'
    if (path is None):
        exit_with_error('-t option is required.')
    return (path, summarize_by, ratio, words)
def get_arguments():
    try:
        (opts, args) = getopt.getopt(sys.argv[1:], 't:s:r:w:h', ['text=', 'summary=', 'ratio=', 'words=', 'help'])
    except getopt.GetoptError as err:
        exit_with_error(err)
    path = None
    summarize_by = SENTENCE
    ratio = 0.2
    words = None
    for (o, a) in opts:
        if (o in ('-t', '--text')):
            path = a
        elif (o in ('-h', '--help')):
            usage()
            sys.exit()
        elif (o in ('-s', '--summary')):
            summarize_by = int(a)
        elif (o in ('-w', '--words')):
            words = int(a)
        elif (o in ('-r', '--ratio')):
            ratio = float(a)
        else:
            assert False, 'unhandled option'
    if (path is None):
        exit_with_error('-t option is required.')
    return (path, summarize_by, ratio, words)