Exemplo n.º 1
0
    """
    parser = argparse.ArgumentParser()
    parser.add_argument("-i", "--input", type=str,
                        help="Input file path")
    parser.add_argument("-l", "--logfile", type=str,
                        help="Log file path")
    args = parser.parse_args()

    return args


if __name__ == '__main__':

    args = arg_parser()

    set_log_config(args.logfile, logging.ERROR)

    if not args.input:
        logging.error("Please insert options -i (input annotation "
                      "file path)")
        sys.exit()
    if not os.path.isfile(args.input):
        logging.error('Input file not valid')
        sys.exit()

    inpath, intype = args.input.rsplit('.', 1)

    if intype == 'json':
        with open(args.input, 'r') as jinf:
            tweets_annotated = json.load(jinf)
    else:
    parser.add_argument("-d",
                        "--dataset",
                        type=str,
                        dest='dataset',
                        help="Dataset name")
    parser.add_argument("-M",
                        "--min-tracks",
                        type=int,
                        dest='min_tracks',
                        default=3,
                        help="Min. number of track for a playlist")
    parser.add_argument("-l", "--logfile", type=str, help="Log file path")
    args = parser.parse_args()

    return args


if __name__ == "__main__":

    args = arg_parser()
    set_log_config(args.logfile, logging.INFO)

    if args.dataset not in ALLOWED_DATASETS:
        logging.error("Dataset '{}' not allowed!".format(args.dataset))
        logging.info("DATASET ALLOWED:")
        logging.info("{}".format(ALLOWED_DATASETS))
        sys.exit()
    else:
        pDI = PlaylistDI(args.dataset, args.min_tracks)
        pDI.run()
Exemplo n.º 3
0
        default=2,
        help="The minimum topic for select best topic Model.Default is 3.")
    parser.add_argument(
        '--max_topic',
        type=int,
        default=15,
        help="The maximum topic for select best topic Model.Default is 15")
    parser.add_argument(
        '--best_topic',
        type=int,
        default=4,
        help="Determined topic nums for train model.Default is 4.")

    parser.add_argument('--eval_modes',
                        type=str,
                        nargs='+',
                        default=['u_mass'],
                        choices=['u_mass', 'c_v', 'c_uci', 'c_npmi'],
                        help='Evaluate method for different topic nums model.')

    parser.add_argument('--do_select',
                        action='store_true',
                        help='Determined evaluate model or not.')
    parser.add_argument('--do_train',
                        action='store_true',
                        help='Determined train model or not.')
    args = parser.parse_args()
    #set program logging level
    set_log_config()
    main(args)