Пример #1
0
    def summarize_text(self, sites, articles):
        if (len(articles) < 1):
            return ["Not enought information about player"]

        summary_methods = NaiveBayesClassifier()

        return summary_methods.get_summary(sites, articles)
Пример #2
0
def NBCTest():
    nbc = NaiveBayesClassifier()

    sites = [
        "https://www.theplayerstribune.com/doublelift-league-of-legends-everyone-else-is-trash/"
    ]
    article_extractor = articles.ArticleExtractor('doublelift',
                                                  'league of legends', 5)
    #sites = article_extractor.get_websites()
    article = [article_extractor.parse_websites(site) for site in sites]

    string_text = list_to_string(article)
    string_text = string_text.replace("', '", ' ')
    string_text = string_text.replace('", "', ' ')

    summary = nbc.get_summary(string_text, 5)

    print("Summary:")
    for sentence in summary:
        print(u'\u2022 ' + sentence.lstrip("[]1234567890',.\" "))