当前位置: 首页 > 工具软件 > Summa > 使用案例 >

自然语言处理(NLP)-第三方库(工具包):summa【抽取文本中的“关键词”、“关键句” 】【基于TextRank】

满俊楠
2023-12-01
from summa import summarizer
from summa import keywords

if __name__ == "__main__":
    text = """
        Automatic summarization is the process of reducing a text document with a computer program in order to create a summary that retains the most important points of the original document. 
        As the problem of information overload has grown, and as the quantity of data has increased, so has interest in automatic summarization. 
        Technologies that can make a coherent summary take into account variables such as length, writing style and syntax. 
        An example of the use of summarization technology is search engines such as Google. 
        Document summarization is another.
        """

    my_summary = summarizer.summarize(text)
    my_keywords = keywords.keywords(text)

    print("my_summary = \n{0}".format(my_summary))
    print("my_keywords = \n{0}".format(my_keywords))

打印结果:

my_summary = 
Automatic summarization is the process of reducing a text document with a computer program in order to create a summary that retains the most important points of the original document.

my_keywords = 
document
automatic summarization
technologies
technology

Process finished with exit code 0
 类似资料: