Skip to Content
Python文本分析
book

Python文本分析

by Jens Albrecht, Sidharth Ramachandran, Christian Winkler
August 2022
Intermediate to advanced
441 pages
11h 26m
Chinese
China Electric Power Press Ltd.
Content preview from Python文本分析
文本摘要
271
以结构化方式编写的长文本,包含多个段落,而且有很多页。例如案件处理、
研究论文、教材等。
短小的文本,比如新闻文章和博客等,其中可能包含图片、数据或其他图形元素。
多个短小的、对话形式的文本,可能包含表情符等特殊字符,而且没有良好的
结构。例如推文、论坛以及群聊应用程序。
每种类型的文本数据表示信息的方式都不同,因此用于生成某个文档摘要的方法可
能并不适合其他文档。在下面的案例中,我们将介绍处理这些类型的文本的方法,
还会提供选择正确方法的指南。
9.2.1
提取式摘要
所有提取方法都遵循以下三个基本的步骤:
1.
创建文本的中间表示。
2.
根据所选的表示,给句子
/
短语打分。
3.
给句子排名,然后选出句子来创建文本摘要。
虽然大多数解决方案都会遵循上述步骤,但每种方法创建中间表示或打分的方法各
有不同。
9.2.2
数据的预处理
在处理真实的案例之前,首先我们需要使用第
3
章介绍的解决方案,读取我们希望
总结的文本的
URL
。在这个案例中,我们将重点介绍文本的摘要生成,有关如何通
URL
提取数据的详细介绍,请参见第
3
章。为简洁起见,如下示例中的文本输出
经过了删减。如果想浏览整篇文章,请访问
URL
import reprlib
r = reprlib.Repr()
r.maxstring = 800
url1 = "https://www.reuters.com/article/us-qualcomm-m-a-broadcom-5g/\
what-is-5g-and-who-are-the-major-players-idUSKCN1GR1IN" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精益AI

精益AI

Lomit Patel
构建知识图谱

构建知识图谱

Jesus Barrasa, Jim Webber
写给系统管理员的Python脚本编程指南

写给系统管理员的Python脚本编程指南

Posts & Telecom Press, Ganesh Sanjiv Naik

Publisher Resources

ISBN: 9787519864446