Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

    def convert_text_to_rouge_format(text, title="dummy title"):
        Convert a text to a format ROUGE understands. The text is
        assumed to contain one sentence per line.

            text:   The text to convert, containg one sentence per line.
            title:  Optional title for the text. The title will appear
                    in the converted file, but doesn't seem to have
                    any other relevance.

        Returns: The converted text as string.

        sentences = text.split("\n")
        sent_elems = [
            "[{i}] "
            "{text}".format(i=i, text=sent)
            for i, sent in enumerate(sentences, start=1)]
        html = """



""".format(title=title, elems="\n".join(sent_elems))

        return html

src/p/y/pyrouge-0.1.2/pyrouge/tests/Rouge155_test.py   pyrouge(Download)
    def test_text_conversion(self):
        rouge = Rouge155()
        text = str_from_file(add_data_path("spl_test_doc"))
        html = rouge.convert_text_to_rouge_format(text, "D00000.M.100.A.C")
        target = str_from_file(add_data_path("spl_test_doc.html"))