#!/usr/bin/env python

from __future__ import print_function, unicode_literals, division

import argparse
import os

from tempfile import mkdtemp

from pyrouge import Rouge155
from pyrouge.utils.argparsers import io_parser, ss_parser

def get_args():
	parser = argparse.ArgumentParser(parents=[io_parser, ss_parser])
	return parser.parse_args()

def main():
	args = get_args()
	if args.split_sents:
		from pyrouge.utils.sentence_splitter import PunktSentenceSplitter
		tmp = mkdtemp()
		PunktSentenceSplitter.split_files(args.input_dir, tmp)
		args.input_dir = tmp
	Rouge155.convert_summaries_to_rouge_format(args.input_dir, args.output_dir)

if __name__ == "__main__":
        main()

