Пример #1
0
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)
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)
Пример #3
0
    def split_sentences(self):
        """
        ROUGE requires texts split into sentences. In case the texts
        are not already split, this method can be used.

        """
        from pyrouge.utils.sentence_splitter import PunktSentenceSplitter
        ss = PunktSentenceSplitter()
        sent_split_to_string = lambda s: "\n".join(ss.split(s))
        process_func = partial(DirectoryProcessor.process,
                               function=sent_split_to_string)
        self.__process_summaries(process_func)
Пример #4
0
    def split_sentences(self):
        """
        ROUGE requires texts split into sentences. In case the texts
        are not already split, this method can be used.

        """
        from pyrouge.utils.sentence_splitter import PunktSentenceSplitter
        self.log.info("Splitting sentences.")
        ss = PunktSentenceSplitter()
        sent_split_to_string = lambda s: "\n".join(ss.split(s))
        process_func = partial(
            DirectoryProcessor.process, function=sent_split_to_string)
        self.__process_summaries(process_func)