WO2013178193A2 - 一种文本内容提取方法和装置 - Google Patents

一种文本内容提取方法和装置 Download PDF

Info

Publication number
WO2013178193A2
WO2013178193A2 PCT/CN2013/080666 CN2013080666W WO2013178193A2 WO 2013178193 A2 WO2013178193 A2 WO 2013178193A2 CN 2013080666 W CN2013080666 W CN 2013080666W WO 2013178193 A2 WO2013178193 A2 WO 2013178193A2
Authority
WO
WIPO (PCT)
Prior art keywords
module
link
text
length
content
Prior art date
Application number
PCT/CN2013/080666
Other languages
English (en)
French (fr)
Other versions
WO2013178193A3 (zh
Inventor
叶伟
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2013178193A2 publication Critical patent/WO2013178193A2/zh
Publication of WO2013178193A3 publication Critical patent/WO2013178193A3/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a text content extraction method and apparatus.
  • BACKGROUND With the rapid development of Internet technologies, browsing web pages has gradually become the main means for people to obtain information, and in all the contact page information, text information has occupied a major part. How to effectively extract the text information in the page is very important, because if the content of the text is completely extracted, it will inevitably be mixed with many unnecessary contents, such as advertising information, navigation information, etc., which is usually a large number of repetitions. And not the content that users are interested in and need; in addition, a large amount of repeated and invalid information will also reduce the accuracy of text clustering and text categorization, and will increase the workload of content retrieval.
  • the layout and layout of the pages are various. If the modules are divided by modules or locations, it is difficult to accurately obtain valid text information.
  • Embodiments of the present invention provide a text content extraction method and apparatus, which are used to solve the problem that a text content extraction method adopted in the prior art cannot accurately extract text content.
  • the technical solution adopted by the embodiment of the present invention is as follows:
  • the embodiment of the present invention provides a text content extraction method, including: decomposing an input hypertext markup language HTML webpage into multiple modules, according to each module.
  • the position score of each module determines the position score of each module, and calculate the text length of each module; extract the link address included in each module, and count the character content of all the link addresses except the protocol character, which will contain the Each link address of the most frequently used character content is marked as a valid link, and each link address not including the character content having the highest frequency of use is marked as an invalid link;
  • the comprehensive score module position score x (the text length of the module + the length of the text of the valid link in the module) / the length of the text of the invalid link in the module, determine the comprehensive score of each module, and determine that the module whose comprehensive score exceeds the set threshold is Content module.
  • the input HTML webpage is decomposed into multiple modules by using a Table tag or a Div tag. Further, in the method according to the embodiment of the present invention, if the decomposed module can continue to decompose and the label is not mixed, the decomposed module continues to be decomposed. Further, in the method of the embodiment of the present invention, when marking the valid link and the invalid link, the length of the text in each link is uniformly calculated; or, when determining the comprehensive score of each module, each link included in each module is separately calculated. The length of the text inside.
  • calculating the text length of each module specifically includes: for each module, extracting a Hypertext Mark-Up Language (HTML) label of the module, according to the The HTML tag obtains the text information contained in the corresponding module, and calculates the length of the text information to obtain the text length of the corresponding module. Further, in the method of the embodiment of the present invention, the link address of each module is extracted by using the achor tag.
  • HTML Hypertext Mark-Up Language
  • the webpage processing unit is specifically configured to use the Table tag or the Div tag to decompose the input HTML webpage into multiple modules. Further, in the device according to the embodiment of the present invention, the webpage processing unit is further configured to determine whether the decomposed module can continue to be decomposed and the label is not mixed, and if so, the decomposed module continues to be decomposed.
  • the marking processing unit is further configured to uniformly calculate the length of the text in each link when marking the valid link and the invalid link; or, the content extracting unit is further configured to When determining the comprehensive score of each module, the length of the text in each link included in each module is calculated separately.
  • the webpage processing unit is configured to extract an HTML tag of the module for each module, obtain text information included in the corresponding module according to the HTML tag, and calculate the text. The length of the information is the length of the text of the corresponding module.
  • the marking processing unit is specifically configured to extract the link address of each module by using the achor tag.
  • the method and the device according to the embodiment of the present invention use the ratio of the length of the normal text to the length of the valid link text and the length of the invalid link text, so as to be more accurate on the HTML webpage.
  • the content is extracted, and redundant information such as advertisements is removed, so that the workload of the subsequent word segmentation phase is greatly reduced, and the accuracy of text clustering, text classification, and automatic summarization is improved.
  • FIG. 1 is a flowchart of a text content extraction method according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a webpage layout according to an embodiment of the present invention
  • FIG. 3 is a specific flowchart of a text content extraction method according to an embodiment of the present invention
  • a structural block diagram of a text content extraction apparatus provided by an embodiment of the present invention.
  • the embodiment of the invention provides a text content extraction method and device. As shown in FIG.
  • a text content extraction method specifically includes: Step S101, decomposing an input HTML webpage into a plurality of modules, and determining each module according to a position of each module in a webpage layout. Position score, and calculate the text length of each module; in this step, preferably, the input HTML web page is decomposed into a plurality of modules using a Table tag or a Div tag. Further, in this step, if the decomposed module can continue to decompose and the label is not mixed, the decomposed module continues to be decomposed.
  • the labels are mixed:
  • the mainstream page layout methods are mainly divided into two types, that is, the layout of the page structure is performed by the ⁇ Table> tag or the ⁇ Div>3 ⁇ 4 sign, but when editing the page content, the two tags may also be Included with each other, that is, pages with ⁇ Table> layout may contain ⁇ 0 ⁇ > tags, and pages with same ⁇ 0> layout may also contain ⁇ Talbe>tags; in addition, tags are also referred to as control structure tags (such as ⁇ Table>, ⁇ hl>) and tags that control performance (such as ⁇ font>, ⁇ b>) are mixed together, making it difficult to redesign and divide data.
  • the label miscellaneous used herein mainly refers to the mixed use of the ⁇ a & ⁇ > and ⁇ 0 ⁇ > tags.
  • calculating the text length of each module specifically includes: for each module, extracting an HTML tag of the module, obtaining text information included in the corresponding module according to the HTML tag, and calculating a length of the text information, to obtain The text length of the corresponding module.
  • Step S102 extracting the link address included in each module, counting the character content of all the link addresses except the protocol character, and marking each link address including the character content with the highest frequency as a valid link, which does not include the highest frequency of use.
  • Each link address of the character content is marked as an invalid link; in this step, preferably, the link address of each module is extracted by the achor tag.
  • the module is a content module.
  • the length of the text of the valid link and the length of the text of the invalid link in the step are preferably uniformly calculated when the valid link and the invalid link are marked; of course, when determining the comprehensive score of each module, Each module is calculated separately.
  • FIG. 2 to FIG. 3 specifically relates to the following content:
  • An improved HTML content-based text content extraction method which can more accurately and reasonably divide text content.
  • the webpage layout is divided into a content module and a non-content module.
  • the content module is a content part of the webpage
  • the non-content module is generally used to display navigation information, a banner, a copyright statement, or Advertising and other information.
  • the goal of the solution in the embodiment of the present invention is to accurately decompose the HTML webpage and extract the content module from the HTML webpage.
  • the method for extracting text content based on HTML features specifically includes: Step 1: Decomposing the input HTML webpage into a plurality of modules by using a label; in the step, preferably, using a Table or a Div label The input HTML page is broken down into multiple modules.
  • the embodiment of the present invention uses the Table label and the Div label, which are two labels for layout, to decompose the module, on the one hand, because they are used for webpage layout, and on the other hand, it can reduce the complexity of analyzing webpages, such as span. These other tags are not processed, which greatly speeds up the parsing speed of web pages and reduces the analysis of system resources.
  • Step 2 if the module decomposed in step 1 can continue to be decomposed again, and there is no case where the Table or Div label is mixed, then the module is sent to step 1 to continue the decomposition; step 3, the input module is based on the layout. Different locations give different positions to score.
  • Step 4 Calculate the length of the text in each module.
  • Step 5 Count the character content with the highest frequency of use among the link addresses of all modules. Since the link addresses belonging to the content related to the web page must have some of the same character content, such as Link addresses such as advertisements do not contain the same character content, so you can use the most frequently used character content to distinguish between valid link addresses (links to web-related content) and invalid link addresses (advertising). Equivalent to the unrelated link of the webpage content.
  • Step 6 when the character content with the highest frequency of use is counted, all the common resource locators (Uniform Resource Locator, referred to as URL) have common characters, such as www and http.
  • the comprehensive score in the step 8 is determined. If the score is higher than the set threshold, the content of the module is considered to be the extracted text content.
  • the method includes: after obtaining a webpage, taking a webpage as an input, as in step L, if the table label and the Div label can be used to decompose the input webpage. For multiple modules, the input web page is broken down. In step 2, it is judged whether the decomposed module can continue to decompose, if it can then go back to step 1 to continue the decomposition, otherwise proceed to step 3.
  • Step 3 proposes a simple text after all the HTML tags in the module input by step 2, and calculates the length of the text.
  • Step 4 Extract all the links using the acher tag and count the most frequently used character content in the link addresses of all modules.
  • Step 5 calculates the length of the link text with and without the character content counted in step 4, and marks them as valid links and invalid links, respectively.
  • the method in the embodiment of the present invention uses the ratio of the length of the normal text to the length of the valid link text and the length of the invalid link text, so that the content of the HTML web page can be extracted more accurately, and the redundancy is removed.
  • the remaining advertisements and other information greatly reduce the workload of the subsequent word segmentation stage, improving the accuracy of text clustering and text classification, and automatic summarization. As shown in FIG.
  • an embodiment of the present invention further provides a text content extracting apparatus, which specifically includes: a webpage processing unit 410, configured to decompose an input HTML webpage into a plurality of modules, according to positions of each module in a webpage layout, Determining the position score of each module, and calculating the text length of each module; the marking processing unit 420 is configured to extract the link address included in each module, and count the character content of all the link addresses except the protocol character, which will include the frequency of use.
  • a webpage processing unit 410 configured to decompose an input HTML webpage into a plurality of modules, according to positions of each module in a webpage layout, Determining the position score of each module, and calculating the text length of each module
  • the marking processing unit 420 is configured to extract the link address included in each module, and count the character content of all the link addresses except the protocol character, which will include the frequency of use.
  • the webpage processing unit 410 specifically uses the Table label or the Div label to decompose the input HTML webpage into multiple And for each module, extracting the HTML tag of the module, obtaining the text information contained in the corresponding module according to the HTML tag, calculating the length of the text information, and obtaining the text length of the corresponding module. Further, the webpage processing unit 410 is further configured to determine whether the decomposed module can continue to be decomposed and the label is not mixed, and if so, the decomposed module continues to be decomposed.
  • the tag processing unit 420 is further configured to uniformly calculate the length of the characters in each link when marking the valid link and the invalid link; or, the content extracting unit 430 separately calculates the comprehensive score of each module.
  • the tag processing unit 420 is specifically configured to extract the link address of each module by using the achor tag.
  • the device according to the embodiment of the present invention uses the ratio of the length of the normal text to the length of the valid link text and the length of the invalid link text, so that the content of the HTML web page can be extracted more accurately, and the redundancy is removed.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种文本内容提取方法和装置,其中,所述方法包括:将输入的HTML网页分解为多个模块,根据各模块在网页布局中的位置,确定各模块的位置得分,并计算各模块的文本长度;提取各模块包含的链接地址,统计所有链接地址中使用频率最高的字符内容,将包含所述字符内容的各链接地址标记为有效链接,将不包含所述字符内容的各链接地址标记为无效链接;根据综合得分=位置得分×(文本长度+有效链接的文字长度)/无效链接的文字长度,确定各模块的综合得分,并判定综合得分超过设定阈值的模块为内容模块。本发明所述方法能够有效去除网页中非内容部分的冗余的信息,实现了更为准确的对网页的有效内容进行提取。

Description

一种文本内容提取方法和装置 技术领域 本发明涉及通信技术领域, 尤其涉及一种文本内容提取方法和装置。 背景技术 随着互联网技术的迅猛发展, 浏览网页逐渐成为人们获取信息的主要手段, 而在 所有接触的页面信息中, 文本信息又占了其中的主要部分。 如何有效的提取页面中的 文本信息是很重要的, 因为如果将文本的内容全部提取出来, 其中必然会掺杂许多不 必要的内容, 如广告信息、 导航信息等等, 这些信息通常是大量重复的, 而且并不是 用户感兴趣和需要的内容; 再者, 大量重复和无效的信息也会降低文本聚类和文本分 类的准确性, 会加大内容检索的工作量。 而在不同的网页中, 页面的排版和布局是多 种多样的, 若单从模块或位置进行划分, 则很难准确的获取有效的文本信息。 目前, 文本内容的提取手段是将输入网页分解为多个模块, 并通过计算每个模块 的综合得分来确定对应模块是否为内容模块。 其中, 综合得分的计算方式为: 综合得 分=位置得分 X文字长度 /链接文字长度, 然而, 该计算方式仍然不够精确, 并不能准确 对内容进行划分。 所以, 目前如何能提供一种文本提取方法, 实现对文本内容的准确 提取成为目前亟待解决的技术问题。 发明内容 本发明实施例提供一种文本内容提取方法和装置, 用以解决现有技术中采用的文 本内容提取方法不能准确提取文本内容的问题。 为了解决上述问题, 本发明实施例采用的技术方案如下: 一方面, 本发明实施例提供一种文本内容提取方法, 包括: 将输入的超文本标记语言 HTML网页分解为多个模块,根据各模块在网页布局中 的位置, 确定各模块的位置得分, 并计算各模块的文本长度; 提取各模块包含的链接地址, 统计所有链接地址中除协议字符外使用频率最高的 字符内容, 将包含所述使用频率最高的字符内容的各链接地址标记为有效链接, 将不 包含所述使用频率最高的字符内容的各链接地址标记为无效链接; 根据综合得分 =模块的位置得分 x (模块的文本长度 +模块内有效链接的文字长度) /模块内无效链接的文字长度, 确定各模块的综合得分, 并判定综合得分超过设定阈值 的模块为内容模块。 进一步地,本发明实施例所述方法中,使用 Table标签或 Div标签将输入的 HTML 网页分解为多个模块。 进一歩地, 本发明实施例所述方法中, 若分解得到的模块还能够继续分解且未出 现标签混杂的情况, 则对分解后的模块继续分解。 进一步地, 本发明实施例所述方法中, 在标记有效链接和无效链接时, 统一计算 各链接内的文字长度; 或者, 在确定各模块的综合得分时, 分别计算各模块包含的每 个链接内的文字长度。 进一歩地, 本发明实施例所述方法中, 计算各模块的文本长度具体包括: 对于每 个模块, 提取出模块的超文本标记语言 (Hypertext Mark-Up Language,简称为 HTML) 标签,根据所述 HTML标签获取对应模块中包含的文本信息,计算该文本信息的长度, 得到对应模块的文本长度; 进一步地, 本发明实施例所述方法中, 通过 achor标签提取出各模块的链接地址。 另一方面, 本发明实施例还提供一种文本内容提取装置, 包括: 网页处理单元, 设置为将输入的超文本标记语言 HTML网页分解为多个模块, 根 据各模块在网页布局中的位置, 确定各模块的位置得分, 并计算各模块的文本长度: 标记处理单元, 设置为提取各模块包含的链接地址, 统计所有链接地址中除协议 字符外使用频率最高的字符内容, 将包含所述使用频率最高的字符内容的各链接地址 标记为有效链接, 将不包含所述使用频率最高的字符内容的各链接地址标记为无效链 接; 内容提取单元, 设置为根据综合得分 =模块的位置得分 X (模块的文本长度十模块 内有效链接的文字长度) /模块内无效链接的文字长度, 确定各模块的综合得分, 并判 定综合得分超过设定阈值的模块为内容模块。 进一步地, 本发明实施例所述装置中, 所述网页处理单元, 具体设置为使用 Table 标签或 Div标签将输入的 HTML网页分解为多个模块。 进一步地, 本发明实施例所述装置中, 所述网页处理单元, 还设置为判断分解得 到的模块是否还能够继续分解且未出现标签混杂的情况, 若是, 则对分解后的模块继 续分解。 进一步地, 本发明实施例所述装置中, 所述标记处理单元, 还设置为在标记有效 链接和无效链接时, 统一计算各链接内的文字长度; 或者, 所述内容提取单元, 还设 置为在确定各模块的综合得分时, 分别计算各模块包含的每个链接内的文字长度。 进一步地, 本发明实施例所述装置中, 所述网页处理单元, 具体设置为对于每个 模块, 提取出模块的 HTML标签, 根据所述 HTML标签获取对应模块中包含的文本 信息, 计算该文本信息的长度, 得到对应模块的文本长度; 进一步地, 本发明实施例所述装置中, 所述标记处理单元, 具体设置为通过 achor 标签提取出各模块的链接地址。 与现有技术相比, 本发明有益效果如下: 本发明实施例所述方法和装置, 使用了普通文本同有效链接文字长度之和与无效 链接文字长度的比例, 能够更为准确的对 HTML网页的内容进行提取, 去除了冗余的 广告等信息, 使得后面的分词阶段的工作量大大降低, 提高了文本聚类和文本分类、 自动摘要的准确性。 附图说明 为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实施例或现 有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅 是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的前 提下, 还可以根据这些附图获得其他的附图。 图 1为本发明实施例提供的一种文本内容提取方法的流程图; 图 2为本发明实施例中网页布局示意图; 图 3为本发明实施例提供的文本内容提取方法具体流程图; 图 4为本发明实施例提供的一种文本内容提取装置的结构框图。 具体实施方式 下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完 整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有做出创造性劳动前提下所获得的 所有其他实施例, 都属于本发明保护的范围。 为了解决现有技术中采用的文本内容提取方法不能准确提取文本内容的问题, 本 发明实施例提供一种文本内容提取方法和装置。 如图 1所示, 本发明实施例提供的一种文本内容提取方法, 具体包括- 步骤 S101 , 将输入的 HTML网页分解为多个模块, 根据各模块在网页布局中的 位置, 确定各模块的位置得分, 并计算各模块的文本长度; 该步骤中, 优选地, 使用 Table标签或 Div标签将输入的 HTML网页分解为多个 模块。 进一步地, 该步骤中, 若分解得到的模块还能够继续分解且未出现标签混杂的情 况, 则对分解后的模块继续分解。 其中, 标签混杂: 目前主流的页面布局方式主要分 为两种, 即通过 <Table>标签或 <Div>¾签进行页面结构上的布局划分, 但在编辑页面 内容时, 这两个标签也可能互相包含, 即釆用 <Table>布局的页面中可能包含<0^>标 签, 同样采用<0 >布局的页面中也可能包含 <Talbe>标签; 另外, 标签混杂也指控制 结构的标签 (如 <Table>、 <hl>)和控制表现的标签 (如 <font>、 <b>)混杂在一起使用, 造 成改版和数据划分的困难。 本发明实施例中由于是需要对模块进行划分, 所以此处所 用的标签混杂主要是指 <了& ^>和<0^>标签的混杂使用。 进一步地, 该步骤中, 计算各模块的文本长度具体包括: 对于每个模块, 提取出 模块的 HTML标签, 根据所述 HTML标签获取对应模块中包含的文本信息, 计算该 文本信息的长度, 得到对应模块的文本长度。 步骤 S102, 提取各模块包含的链接地址, 统计所有链接地址中除协议字符外使用 频率最高的字符内容,将包含使用频率最高的字符内容的各链接地址标记为有效链接, 将不包含使用频率最高的字符内容的各链接地址标记为无效链接; 该步骤中, 优选地, 通过 achor标签提取出各模块的链接地址。 步骤 S103, 根据综合得分 =模块的位置得分 x (模块的文本长度 +模块内有效链接 的文字长度) /模块内无效链接的文字长度, 确定各模块的综合得分, 并判定综合得分 超过设定阈值的模块为内容模块。 该步骤中所述的有效链接的文字长度和无效链接的文字长度, 优选地, 是在标记 有效链接和无效链接时, 统一计算得到的; 当然, 也可以在确定各模块的综合得分时, 针对每个模块分别计算得到的。
为了更清楚的阐述本发明实施例所述方法的实现过程, 下面结合附图 2至 3对本 发明实施例所述方法进行进一步说明, 具体涉及如下内容: 本发明实施例提供的文本内容提取方法为改进型的基于 HTML特征的文本内容提 取方法, 该方法能够更加准确和合理的划分文本内容。 本发明实施例中, 把网页布局 分为内容模块和非内容模块, 如图 2所示, 内容模块是网页中的内容部分, 而非内容 模块一般是用来展示导航信息, 横幅, 版权申明或者广告等信息。 本发明实施例所述 方案的目标就是能够准确分解 HTML网页, 把内容模块从 HTML网页中提取出来。 针对每个分解出来的模块, 根据它所在的网页布局中的位置给与不同的得分, 处于用 户视线焦点的模块得分越高, 反之得分越低, 如果无效链接文字长度相对该模块比例 过大, 那么该模块展示的可能是广告或者导航信息。 本发明实施例所述的基于 HTML特征的文本内容提取方法, 具体包括: 步骤 1, 使用标签把输入的 HTML网页分解成多个模块; 该歩骤中,优选地,釆用 Table或 Div标签把输入的 HTML网页分解成多个模块。 本发明实施例之所以采用 Table标签和 Div标签这两个用于布局的标签来分解模块, 一方面是由于它们是用于网页布局, 另一方面也能够减少分析网页的复杂度, 对诸如 span, br这些其他的标签不进行处理, 大大的加快了网页的解析速度, 减少了系统资 源的分析。 步骤 2, 如果步骤 1中分解的模块还能继续再分解, 而且没有出现 Table或 Div标 签混杂的情况, 那么再把该模块送到步骤 1继续分解; 步骤 3, 把输入的模块根据在布局中的不同位置给于不同位置得分。 当然, 该步 骤中, 对于布局中每个位置的具体得分是预先设置的好的, 其基本原则是模块越处于 布局中用户注意力集中的位置其权重越高, 位置得分也越高; 步骤 4, 计算每个模块内的文本长度; 步骤 5, 统计所有模块的链接地址中使用频率最高的字符内容, 由于同属于该网 页相关内容的链接地址必然有部分字符内容是相同的, 而诸如广告之类的链接地址则 不会包含这部分相同的字符内容, 因此可以用所统计出的使用频率最高的字符内容来 区分有效的链接地址 (网页相关内容的链接) 和无效的链接地址 (广告等同网页内容 不相关的链接) ,该步骤中, 在统计使用频率最高的字符内容时, 将所有统一资源定位 符 (Uniform Resource Locator, 简称为 URL) 均具有的共有字符, 如 www、 http这些 共有的协议字符, 排除在统计之外; 步骤 6, 将包含步骤 5中所统计出的字符内容的链接地址标记为有效链接, 并计 算各有效链接内的文字长度; 步骤 7, 将不包含步骤 5中所统计出的字符内容的链接地址标记为无效链接, 并 计算各无效链接内的文字长度; 步骤 8, 根据模块的综合得分 =模块的位置得分 X (模块内的文本长度 +有效链接内 的文字长度) /无效链接内的文字长度, 得出每个模块综合得分, 综合得分高于所设阈 值的即认为是内容模块; 步骤 9, 根据事先设定的阈值(即认为内容模块所应达到的综合得分下限), 判断 所述的步骤 8中的综合得分, 其分值若高于所设定的阈值, 则认为该模块的内容是需 要提取的文本内容。 基于上述的原理表述, 下面结合以具体示例进行说明, 如图 3所示, 包括: 在获 取网页后, 把网页作为输入, 如步骤 L中, 如果能使用 Table标签和 Div标签把输入 的网页分解为多个模块, 就把输入的网页分解。 在步骤 2中判断分解出来的模块是否 还可以继续分解, 如果可以那么回到步骤 1继续分解, 否则进入步骤 3。 步骤 3提出 由步骤 2输入的模块中的所有 HTML标签后获得简单的文本,计算出这个文本的长度。 歩骤 4使用 achor标签提取出所有的链接, 并统计所有模块的链接地址中使用频率最 高的字符内容。步骤 5计算包含和不包含步骤 4所统计出的字符内容的链接文字长度, 分别标记为有效链接和无效链接。 步骤 6利用公式: 综合得分=位置得分 X (文字长度 +有效链接文字长度) /无效链接文字长度, 计算出每个模块的综合得分。 综合得分小 于阈值的模块经过歩骤 7删除, 综合得分高于阈值的模块进入歩骤 8输出。 综上所述, 本发明实施例所述方法, 使用了普通文本同有效链接文字长度之和与 无效链接文字长度的比例, 能够更为准确的对 HTML网页的内容进行提取, 去除了冗 余的广告等信息, 使得后面的分词阶段的工作量大大降低, 提高了文本聚类和文本分 类、 自动摘要的准确性。 如图 4所示, 本发明实施例还提供一种文本内容提取装置, 具体包括- 网页处理单元 410, 设置为将输入的 HTML网页分解为多个模块, 根据各模块在 网页布局中的位置, 确定各模块的位置得分, 并计算各模块的文本长度; 标记处理单元 420, 设置为提取各模块包含的链接地址, 统计所有链接地址中除 协议字符外使用频率最高的字符内容, 将包含使用频率最高的字符内容的各链接地址 标记为有效链接, 将不包含使用频率最高的字符内容的各链接地址标记为无效链接; 内容提取单元 430, 设置为根据综合得分 =模块的位置得分 X (模块的文本长度 + 模块内有效链接的文字长度) /模块内无效链接的文字长度, 确定各模块的综合得分, 并判定综合得分超过设定阈值的模块为内容模块。 基于上述原理框架, 下面给出上述各单元在实现对应功能时的具体实现方式, 具 体如下: 本发明实施例中, 网页处理单元 410, 具体使用 Table标签或 Div标签将输入的 HTML网页分解为多个模块; 以及对于每个模块, 提取出模块的 HTML标签, 根据所 述 HTML标签获取对应模块中包含的文本信息, 计算该文本信息的长度, 得到对应模 块的文本长度。 进一步地, 网页处理单元 410, 还设置为判断分解得到的模块是否还能够继续分 解且未出现标签混杂的情况, 若是, 则对分解后的模块继续分解。 本发明实施例中, 标记处理单元 420, 还设置为在标记有效链接和无效链接时, 统一计算各链接内的文字长度; 或者, 内容提取单元 430, 在确定各模块的综合得分 时, 分别计算各模块包含的每个链接内的文字长度。 进一步地, 本发明实施例中, 标记处理单元 420, 具体设置为通过 achor标签提取 出各模块的链接地址。 综上所述, 本发明实施例所述装置, 使用了普通文本同有效链接文字长度之和与 无效链接文字长度的比例, 能够更为准确的对 HTML网页的内容进行提取, 去除了冗 余的广告等信息, 使得后面的分词阶段的工作量大大降低, 提高了文本聚类和文本分 类、 自动摘要的准确性。 显然, 本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精 神和范围。 这样, 倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的 范围之内, 则本发明也意图包含这些改动和变型在内。

Claims

权 利 要 求 书 、 一种文本内容提取方法, 包括:
将输入的超文本标记语言 HTML网页分解为多个模块,根据各模块在网页 布局中的位置, 确定各模块的位置得分, 并计算各模块的文本长度;
提取各模块包含的链接地址, 统计所有链接地址中除协议字符外使用频率 最高的字符内容, 将包含所述使用频率最高的字符内容的各链接地址标记为有 效链接,将不包含所述使用频率最高的字符内容的各链接地址标记为无效链接; 根据综合得分 =模块的位置得分 X (模块的文本长度十模块内有效链接的文 字长度) /模块内无效链接的文字长度, 确定各模块的综合得分, 并判定综合得 分超过设定阈值的模块为内容模块。 、 如权利要求 1所述的方法, 其中, 所述方法中, 使用 Table标签或 Div标签将 输入的 HTML网页分解为多个模块。 、 如权利要求 2所述的方法, 其中, 所述方法中, 若分解得到的模块还能够继续 分解且未出现标签混杂的情况, 则对分解后的模块继续分解。 、 如权利要求 1所述的方法, 其中, 所述方法中, 在标记有效链接和无效链接时, 统一计算各链接内的文字长度; 或者, 在确定各模块的综合得分时, 分别计算 各模块包含的每个链接内的文字长度。 、 如权利要求 1至 4中任一项所述的方法, 其中, 所述方法中, 计算各模块的文本长度具体包括: 对于每个模块, 提取出模 块的 HTML标签, 根据所述 HTML标签获取对应模块中包含的文本信息, 计算该文本信息的长度, 得到对应模块的文本长度;
所述方法中, 通过 achor标签提取出各模块的链接地址。 、 一种文本内容提取装置, 其中, 包括- 网页处理单元,设置为将输入的超文本标记语言 HTML网页分解为多个模 块, 根据各模块在网页布局中的位置, 确定各模块的位置得分, 并计算各模块 的文本长度; 标记处理单元, 设置为提取各模块包含的链接地址, 统计所有链接地址中 除协议字符外使用频率最高的字符内容, 将包含所述使用频率最高的字符内容 的各链接地址标记为有效链接, 将不包含所述使用频率最高的字符内容的各链 接地址标记为无效链接;
内容提取单元, 设置为根据综合得分 =模块的位置得分 X (模块的文本长度 十模块内有效链接的文字长度) /模块内无效链接的文字长度, 确定各模块的综 合得分, 并判定综合得分超过设定阈值的模块为内容模块。 、 如权利要求 6所述的装置, 其特征在于, 所述网页处理单元, 具体设置为使用 Table标签或 Div标签将输入的 HTML网页分解为多个模块。 、 如权利要求 7所述的装置, 其特征在于, 所述网页处理单元, 还设置为判断分 解得到的模块是否还能够继续分解且未出现标签混杂的情况, 若是, 则对分解 后的模块继续分解。 、 如权利要求 6所述的装置, 其特征在于,
所述标记处理单元, 还设置为在标记有效链接和无效链接时, 统一计算各 链接内的文字长度;
或者, 所述内容提取单元, 还设置为在确定各模块的综合得分时, 分别计 算各模块包含的每个链接内的文字长度。 0、 如权利要求 6至 9中任一项所述的装置, 其特征在于,
所述网页处理单元,具体设置为对于每个模块,提取出模块的 HTML标签, 根据所述 HTML 标签获取对应模块中包含的文本信息, 计算该文本信息的长 度, 得到对应模块的文本长度;
所述标记处理单元, 具体设置为通过 achor标签提取出各模块的链接地址。
PCT/CN2013/080666 2012-11-20 2013-08-01 一种文本内容提取方法和装置 WO2013178193A2 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210469940.6 2012-11-20
CN201210469940.6A CN103020129B (zh) 2012-11-20 2012-11-20 一种文本内容提取方法和装置

Publications (2)

Publication Number Publication Date
WO2013178193A2 true WO2013178193A2 (zh) 2013-12-05
WO2013178193A3 WO2013178193A3 (zh) 2014-01-23

Family

ID=47968733

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/080666 WO2013178193A2 (zh) 2012-11-20 2013-08-01 一种文本内容提取方法和装置

Country Status (2)

Country Link
CN (1) CN103020129B (zh)
WO (1) WO2013178193A2 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190303501A1 (en) * 2018-03-27 2019-10-03 International Business Machines Corporation Self-adaptive web crawling and text extraction

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103020129B (zh) * 2012-11-20 2015-11-18 中兴通讯股份有限公司 一种文本内容提取方法和装置
CN105320734B (zh) * 2015-07-14 2019-02-22 中国互联网络信息中心 一种网页核心内容提取方法
CN106528504A (zh) * 2015-09-11 2017-03-22 北京国双科技有限公司 社交应用的数据筛选方法和装置
CN106326445B (zh) * 2016-08-26 2019-09-17 武汉大学 一种基于传感信息量的网页内容评价方法
CN107766419B (zh) * 2017-09-08 2021-08-31 广州汪汪信息技术有限公司 一种基于阈值去噪的TextRank文档摘要方法及装置
CN109063996A (zh) * 2018-07-23 2018-12-21 长沙知了信息科技有限公司 多用户协同编辑的信息处理方法及装置
CN110377810B (zh) * 2019-06-25 2022-04-08 浙江大学 一种移动端网页的分类方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101093487A (zh) * 2006-06-22 2007-12-26 上海新纳广告传媒有限公司 基于html特征的文本内容提取方法
CN101702160A (zh) * 2009-10-28 2010-05-05 深圳市同洲电子股份有限公司 一种互联网主题信息采集方法及装置
CN102479181A (zh) * 2010-11-22 2012-05-30 中国电信股份有限公司 基于div位置的网页正文抽取方法和装置
CN103020129A (zh) * 2012-11-20 2013-04-03 中兴通讯股份有限公司 一种文本内容提取方法和装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020124020A1 (en) * 2001-03-01 2002-09-05 International Business Machines Corporation Extracting textual equivalents of multimedia content stored in multimedia files
CN102411587B (zh) * 2010-09-21 2013-08-21 腾讯科技(深圳)有限公司 一种网页分类方法和装置
CN102622382A (zh) * 2011-03-14 2012-08-01 北京小米科技有限责任公司 一种网页重排版的方法
CN102184227B (zh) * 2011-05-10 2013-05-08 北京邮电大学 一种面向web服务的通用爬虫引擎系统及其工作方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101093487A (zh) * 2006-06-22 2007-12-26 上海新纳广告传媒有限公司 基于html特征的文本内容提取方法
CN101702160A (zh) * 2009-10-28 2010-05-05 深圳市同洲电子股份有限公司 一种互联网主题信息采集方法及装置
CN102479181A (zh) * 2010-11-22 2012-05-30 中国电信股份有限公司 基于div位置的网页正文抽取方法和装置
CN103020129A (zh) * 2012-11-20 2013-04-03 中兴通讯股份有限公司 一种文本内容提取方法和装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190303501A1 (en) * 2018-03-27 2019-10-03 International Business Machines Corporation Self-adaptive web crawling and text extraction
US10922366B2 (en) * 2018-03-27 2021-02-16 International Business Machines Corporation Self-adaptive web crawling and text extraction

Also Published As

Publication number Publication date
WO2013178193A3 (zh) 2014-01-23
CN103020129B (zh) 2015-11-18
CN103020129A (zh) 2013-04-03

Similar Documents

Publication Publication Date Title
WO2013178193A2 (zh) 一种文本内容提取方法和装置
US8819028B2 (en) System and method for web content extraction
CN107608949B (zh) 一种基于语义模型的文本信息抽取方法及装置
CN102253979B (zh) 基于视觉的web页面萃取方法
WO2019085355A1 (zh) 互联网新闻的舆情聚类分析方法、应用服务器及计算机可读存储介质
CN101727461B (zh) 一种网页的正文抽取方法
Trampuš et al. Internals of an aggregated web news feed
US9449114B2 (en) Removing non-substantive content from a web page by removing its text-sparse nodes and removing high-frequency sentences of its text-dense nodes using sentence hash value frequency across a web page collection
CN102270206A (zh) 一种有效网页内容的抓取方法及装置
US20120005686A1 (en) Annotating HTML Segments With Functional Labels
CN103577466A (zh) 一种在浏览器中显示网页内容的方法和装置
CN103166981B (zh) 一种无线网页转码方法及装置
CN103544178A (zh) 一种用于提供与目标页面相对应的重构页面的方法和设备
CN103473263A (zh) 一种面向新闻事件演变过程的可视化展现方法
CN101093487A (zh) 基于html特征的文本内容提取方法
CN102193944A (zh) 网页主题内容抽取方法
CN106446072A (zh) 网页内容的处理方法和装置
CN106372232B (zh) 基于人工智能的信息挖掘方法和装置
CN104572874B (zh) 一种网页信息的抽取方法及装置
CN107590288A (zh) 用于抽取网页图文块的方法和装置
CN105589918B (zh) 一种提取页面信息的方法及装置
CN107145591A (zh) 一种基于标题的网页有效元数据内容提取方法
CN106897287B (zh) 网页发布时间抽取方法和用于网页发布时间抽取的装置
CN111639250A (zh) 企业描述信息获取方法、装置、电子设备及存储介质
Bing et al. Primary content extraction with mountain model

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13797187

Country of ref document: EP

Kind code of ref document: A2

122 Ep: pct application non-entry in european phase

Ref document number: 13797187

Country of ref document: EP

Kind code of ref document: A2