Honours Year Project Report

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection)

By

Lee Chee How

Department of Computer Science School of Computing National University of Singapore 2003 / 2004

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection)

________________________________________________________________________

Honours Year Project Report

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection)

By

Lee Chee How

Department of Computer Science School of Computing National University of Singapore 2003 / 2004

Project: Advisor:

H79010 Assistant Professor Kan Min-Yen

Deliverables: Report: Program: 1 Volume 1 CD

________________________________________________________________________
i

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection)

________________________________________________________________________

Abstract
Web documents that look similar often use different HTML tags to achieve their layout effect. These tags make it difficult for a machine to find text or images of interest. PARCELS is a Java backend system designed to classify different components of a web page by obtaining the logical structure from its layout and stylistic characteristics. Each component is given a PARCELS label which identifies its purpose, like Main Content, Links, etc. A recall and precision of 71.9% is obtained. This backend system is currently released under GPL.

Subject Descriptors:

I.5.2 I.5.4 I.7.2 I.7.5

Style guides Text Processing Format and notation Document Analysis

Keywords:

Text Processing, Logical structure of web pages, Segmentation of web pages, Classification of web page components / segments

Implementation Software and Hardware:

Intel Pentium Centrino processor, 512 MB DDR RAM, Windows / UNIX / Linux, Java SDK 1.4.2

________________________________________________________________________
ii

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection)

________________________________________________________________________

Acknowledgement
There are many people whom helped me accomplish the work for this thesis. I would like to thank my partner, Sandra, who has worked along side with me in formulating the PARCELS toolkits. She is in charge of the textual engine.

I would also like to thank the people who release their tools and codes under GNU Public License (GPL) or Open Source. They have made our work on PARCELS easier by not re-inventing the wheel. In return, PARCELS is released under GPL as well.

Over the past year, there’s one person whom I owe the greatest thanks. During the year, Assistant Professor Kan Min-Yen truly took me under his wing and guided me in countless ways. I would like to thank him for all his support and patience I have received for the past year.

________________________________________________________________________
iii

..................................................................................27 Distribution of HTML Structure Tags.......................................................................................17 PARCELS labels and purposes .....................................15 Resultant DOM Tree Representation ........................................................25 Preliminary Investigation of Results ..................................................................15 Partial DOM Tree Representation........................................................................9 9 Regions on Screen...........................................................................................................................................................................6 Patterns for Visual Separator Detection .........................................5 Cues for segmentation of web pages .......................................... News Articles ...24 Co-Training Flowchart.....PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ List of Figures Figure 1: Figure 2: Figure 3: Figure 4: Figure 5: Figure 6: Figure 7: Figure 8: Figure 9: Figure 10: Figure 11: Figure 12: Figure 13: Figure 14: Figure 15: Figure 16: VIPS Representation ........ A3 ________________________________________________________________________ iv .........................6 Observations: Related Work vs.......................................23 Breakdown of features in Feature Vector...............................................19 PARCELS labels’ Stylistic Features ..............................................................................................................25 Example of Co-Training Classification.................12 National Geographic News Site ...............................................................................16 Stylistic Observations on Figure 8 ..........

..................... iii List of Figures..........................................................................................3..................................................................................................................1 5.....................................................................11 Division / Span Structure ...........................................................4 4................iv Table of Contents.......................8 4..10 Grouping of Cells by Value.12 Position of Division / Span.....................1 1.................................................................1 4..........12 Layers Structure .................................................................................................................3 4..............................................2 4..............................4...........................7 Stylistic Properties ................1..............................1 2..................................................................................1..........................................1 3.........................................................................................................6 Body............3 Background Analysis ..............10 4..........4 4................................11 Position of Cells .....................1.......1 3.....................................1 4...............................................................................................................................................................................13 5.......................................................................................................10 Flow of Cells................3...............14 5................v 1...................16 PARCELS Tags for News Domain .................................................................................................ii Acknowledgement ...........2 5...................... Motivations .................................................................1...........1 Related Works ...............PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Table of Contents Abstract ............. Applications of PARCELS ........................ Analysis of HTML Structures......................................................13 Priority of Layers ............................10 Table Structure.................................................1 4..........18 ________________________________________________________________________ v .......................................2 Analysis of News sites ....14 Parser .....7 3................1 4.14 DOM Tree.11 Ordering of Tables by Depth..................................5....1 5.............................2 4.......................................................................................2 DOM Tree Parser............................................................3 4.................................. 3...............................................3......................................13 Other Structures .......10 Paragraph . Formulation of the PARCELS toolkits .....................................................................................................................................................................................................................................................3.............5 4...7 Structural Properties..........................................................................................................

.............. A1 Appendix B – Listing of Features in Feature Vector ............... Machine Learning and Co-Training ......................................................20 6.....................................................................3...........................................................................PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 6...........20 PARCELS Labels vs..................................................................................................1 6............ B1 ________________________________________________________________________ vi .............27 Detailed Investigation of Results ..1..................... Stylistic Features......................24 Analysis of Results .........................................................1 7.................1 7.................................29 References ................. Conclusion ................................. Support Vector Machine ..................2 Preliminary Investigation of Results ..............................2 6...............23 Boostexter ...................................................24 Co-Training.........................................................................................31 Appendix A – Distribution of HTML Structural Tags ..29 8......................................................................2 6.......24 Stylistic and Textual Engine...................................................................................................28 8...............................27 7...............................................1 Future Work..................3 6.....20 Formulation of Feature Vector .............................1.....................................................................................1 6....................................

it currently does not live up to this definition. (Cai. Essentially. 2004). accessing relevant information is by no means an easy task.g. Wen and Ma.1 Applications of PARCELS PARCELS can be applied to many real life applications today: • Efficient web page reading ________________________________________________________________________ 1 . (DiPasquo.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 1. Cai. PARCELS is executable on major platforms like Windows. 1998). PARCELS consists of 2 engines – One on the textual detection of web pages (Lai. 2003) and (Gupta. we will be discussing on the stylistic detection engine. However. 2003). 1998) by the World Wide Web Consortium (W3C). In this documentation. e. none of the solutions address the problem exactly. Kaiser. Neistadt and Grimm. (Yu.g. e. Semantic Web. due to the semi-structured nature of raw HTML pages. 1. Motivations Although the Web Wide Web (WWW) is defined as “the universe of network-accessible information. 2003). UNIX and Linux. There are existing projects which tackle part of the problem. the other on the stylistic detection of web pages. However. countless projects were targeted at ways of using machines to harness this knowledge. Pages that look similar often use different HTML tags to achieve their layout effects and this makes it difficult for a machine to find relevant fields of interest. It is true that web pages are increasing at an exponential rate. Yu. the embodiment of human knowledge” (DiPasquo. PARCELS is a backend system designed to address this problem. Wen and Ma. Coded in Java. Thus. Web pages of any nature can be applied to PARCELS.

we will describe our Machine Learning techniques and perform an analysis on the results. we will touch on how we formulate the PARCELS toolkits which is our engine. we can remove items of lower priorities like site links. reducing the size needed. This greatly improves the efficiency of retrieving the relevant information on the WWW. PARCELS greatly improves the effectiveness and efficiency of our everyday tasks. Following that. we can proceed with other tasks like archiving the documents in the correct domain. • Improving results for Web Search / Mining With information on the layout of the pages. As we can see. • Classification of web page cluster through web design We can identify web pages of the same nature using the logical structure of the web pages. Thus. • Reducing size for Data Archiving Given the number of web pages today. we can extract the title and/or main body of any web pages. advertisements and images of no relevance. This greatly improves the accuracy and efficiency of the search. we will do an analysis on prominent web pages and their HTML structures. With PARCELS. This allows better access of “the universe of network-accessible information. In the next few chapters. archiving these pages will require enormous amounts of disk space. ________________________________________________________________________ 2 . With this classification. we can target the search and mining on the relevant components. like reading a News articles without all the advertisements. the embodiment of human knowledge” mentioned earlier.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ With PARCELS. Lastly.

Next. In this section. the results are better than those not using the HTML Struct Tree. we must reaffirm our basis that there is information in the layout and stylistic properties of web pages: • In (DiPasquo. We reaffirm the belief that the stylistic properties are useful in classifying segments of web pages. layout improves the classification.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 2. one can improve performance in tasks such as learning to classify segments of documents.6% and recall of 64. 1998). Thus. we noted from related works that most papers modified the representation of the DOM Tree: • In (DiPasquo. As we can see. As web pages are meant to be ________________________________________________________________________ 3 . Related Works Our research is closely related to several areas which have been heavily worked on.1%. For companies’ locations. the thesis reported a precision of 71. 1998).0% and recall of 27. Firstly. we will look at some of the more prominent research on text processing and information retrieval on the Web. The focus of the thesis was to extract the names of companies from the web pages and the locations where they have operations in. and that by looking at the HTML formatting in addition to the text on a page. they modified the DOM Tree and called it the HTML Struct Tree. As PARCELS is divided into textual and stylistic engines. the thesis reported a precision of 66. The HTML Struct Tree is intended to represent how a human would parse word relationships on a web page due to its layout. For companies’ names.4%. the thesis argues that there is information in the layout of a web page.

In this release. we made modifications to our parsers instead. they are able to improve the precision and recall for second round search. 2003). a Machine Learner was applied. we will be using the normal DOM Tree. From the tree. The new structure presents an automatic top-down. their new method uses the VIsionsbased Page Segmentation (VIPS) algorithm. tag-tree independent approach to detect web content structure. Thus.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ read by humans. This ensures easier portability of our codes for other uses. the result is better than those not using the HTML Struct Tree. Using the HTML Struct Tree. The main drawback of this paper is that they are handling web pages with linear style (no tables or layers). They proposed that by using local feedback to add keywords from top ranking documents. The usage of feedback described in this paper is good but it will not be included this version of PARCELS. VIPS is used to eliminate such noises by using a tree to represent the flow of text. the relationship between objects on the page can be captured. it is observed that topics of similar content are grouped together. As a result. there is one difficulty they faced: Accurate feedback is impossible due to noises like navigation. VIPS uses a series of heuristics and detection to achieve this. ________________________________________________________________________ 4 . However. Instead of changing the structure. if parsed correctly. the paper proposes a new web content structure based on visual representation of web pages. the paper describes a new method to detect the semantic content of a web page. Instead of a DOM Tree method. decoration and interaction. As mentioned earlier. we will focus on the main framework. • In (Yu et al. 2003). • In (Cai et al. It simulates how a user understands web layout structure based on his visual perception.

layers and frames will be more effective. Lastly. 2003). while preserving the generic-ness of the web page. This paper is also using the VIPS algorithm as described previously. We would do a comparison on this in the Chapter 7 (Analysis of Results). the heuristics used to split contents into blocks are as follows: ________________________________________________________________________ 5 . The main difference is they are handling other Control Structures like tables (Figure 1). the new approach is independent to underlying documentation representation such as HTML and works well even when the HTML structure is far different from layout structure.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Figure 1: VIPS Representation Comparing to other existing techniques. we still feel that using DOM-based Tree with an improved DOM Tree parser to handle tables. we would need to observe their heuristics on stylistic detection: • In (Yu et al. 2003) and (Cai et al. Personally.

Thus.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Cue Tag Cue Color Cue Purpose HTML tags like <HR> are used to split the web page into blocks of text. This is our main focus for the stylistic engine as well. As we can see. We further extended the set of heuristics to suit our purposes. The detailed set can be found in Chapter 5 (Formulation of PARCELS toolkits). it means they belong to 2 different blocks. Figure 2: Cues for segmentation of web pages Visual Separator Detection used: Pattern Distance Tag Font Color Purpose Distance between blocks on both sides of separator Position of tags like <HR> Difference in formatting on both sides of separator Difference in background color on both sides of separator Figure 3: Patterns for Visual Separator Detection The heuristics and detection methods used in VIPS are very useful and are included in PARCELS. Size Cue Difference in the font sizes between 2 blocks of text means they belongs to 2 different blocks. Difference in the background colors between 2 blocks of text means they belongs to 2 different blocks. we shall proceed with our analysis on the layout and stylistic properties of real web pages. Text Cue If one block contains HTML tags and the other does. ________________________________________________________________________ 6 . most of the related works focus on how humans interpret the web pages based on the layout and stylistic properties.

a total of 12 popular news sites were selected. all the News sites are using tables for their main layout. News articles are usually reader friendly but not machine friendly. In Year 2000. <table> tags are widely used and will continue to be so (due to compatibility reasons with existing systems).1 Structural Properties A study was made to find out the dominant layout structure of these sites. and that parsing the HTML formatting appropriately can improve traditional text processing (DiPasquo. we would be able to parse pages of other domains with relative ease. we decided to carry out an analysis on News web pages. 3. Background Analysis Based on the argument that there is information inherent in the layout of each page. Furthermore.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 3. ________________________________________________________________________ 7 . it makes sense to use this domain as a starting point for our analysis. A related study was also made to News articles in Year 2000. • Structural tag <table> is most widely used In Year 2004. we found out that 10 out of the 12 News sites are using tables as their dominant layout structure.1. <div>. Articles are also updated daily and read by millions of people. articles in the News domain are feature rich with complex layout structures. <span> and <layer> tags used.1 Analysis of News sites To facilitate our analysis. 1998). Figure 16 in Appendix A gives the breakdown of the statistics of <table>. With the ability to parse news articles. 3. We will be contrasting these 2 analyses to pin point the trend of layout structural tags usage. The News sites were analyzed for their structural and stylistic properties. Thus. As we observed.

Color of links for different segments The color of links in the navigation bar is sometimes different from the links in the main content and supporting content. we would have to look into the Cascading Style Sheet (CSS) files to obtain the layout properties. • Structural tag <layer> is not used This tag is obsolete due to increased usage of CSS with the z-index properties. <div> and <span> structural tags for the development of PARCELS. Thus. 2003) and (Cai et al. In (Ivory and Hearst. 3. Style of links for different segments The style of links in the navigation bar. The conversion is likely for speed issues (do not need to wait for pages to load) and easier maintenance of web pages. 2003). 2003). (Yu et al.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ • Structural tag <div> and <span> is gaining popularity 2 of the News sites have converted to using <div> tags for their main layout. (Ivory. Related Work Number of links for different segments Our Observations Sitemaps. we applied our knowledge of the stylistic characteristics to News articles today. Next. navigation links and related articles’ links are normally grouped together. For the rendering position of <div> and <span> tags on the screen. Thus. we will be focusing on <table>. the number of links for that segment will be significantly higher. related articles and advertisements are different from the links in the main content and supporting content.1. we noted some of the stylistic aspect which will be useful to us. ________________________________________________________________________ 8 . 2002).2 Stylistic Properties Having determined the dominant structural tags. we proceed with the analysis on the stylistic properties of the pages.

News Articles These characteristics of News sites will act as the foundation for our learning process in Chapter 6 (Machine Learning and Co-training). ________________________________________________________________________ 9 . main content. Font size will be a good indicator for some of our component classification. As such. Figure 4: Observations: Related Work vs. support contents and captions all have different font sizes.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Number of images for different segments Sitemaps and navigations links are more probable to have more images than other segments. Images located in between segments with high density text will likely be images supporting the content. Size of Images This is sometimes useful in determining whether the image is an advertisement as they usually come in fixed sizes. we will be using these styles to aid in our classification. captions and newsletters are in different font styles from the main content. Font styles for different segments Headers. Font sizes for different segments Headers.

All HTML documents must contain a body tag. 4. 4. There are a few papers dedicated to the study of tables.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 4. These papers aided us in our analysis of tables.g. This is where the layout of a web page begins.3.1 Flow of Cells The flow of cells is known as the functional view of a table. tables are the most prominent structure on the Web now. (Hurst. we are referring to HTML tags that will affect the layout position of the contents of a page. ________________________________________________________________________ 10 . 2002). Thus. (Hurst and Douglas. we will do an analysis on the HTML Control Structure that will be used in used in PARCELS. This determines the order of the tables (Hurst et al. 4.1 Body The <body> tag is the trivial case in HTML Structure. PARCELS uses these tags to specify the basic unit for a block of text. 1997). e. As in Control Structure. 1999) and (Cohen.2 Paragraph The next fundamental tag is the Paragraph <p> tags. Hurst and Jenson. we will place more emphasis on the analysis of table structure.3 Table Structure From the analysis we did in Chapter 3. The usage of paragraph tag is pretty straightforward. Functional view is a description of how the information presentation aspects of tables embody a decision structure or reading path. 4. Analysis of HTML Structures In this chapter. 1997).

we would need to order each cell by their depth. 1999). Thus.2 Grouping of Cells by Value Grouping of cells by value will aid in understanding how the webmasters intend the tables to be read (Hurst.3. This will ensure a better classification of that particular segment.3 Ordering of Tables by Depth Nested tables are very common in web designing today. Based on this. From this. 2002). With the visual position tag.3. it would be significantly easier to classify the segments correctly. From the News site we analyzed. 4. 4. Table-based extraction is done by tagging each cell with a visual position tag (Cohen et al. 4.3. we will be able to know the position of this cell with respect to any nested tables. First and foremost. we observed it is possible to classify some of the segments using such characteristics.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ The flow of cells is important as we know there’s a usual layout on how webmasters design their website. the number of nested tables for each cell is different. Furthermore. grouping the cells by value will enable us to understand the contents better. we can gather the following information. If we follow that flow of layout. ________________________________________________________________________ 11 .4 Position of Cells The position of cells is important for information extraction. The value is calculated using the type of data located in the cell and the word density of that particular cell. Cells of the same value are often closely related to each other. it is important to find the relation between nested tables and how each cell affects another cell.

We can assign positional value to both Division and Span in CSS.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ • • • Cut-in header: Cells related to a particular header cell in a table. Region 1 Region 4 Region 7 Region 2 Region 5 Region 8 Region 3 Region 6 Region 9 Figure 5: 9 Regions on Screen ________________________________________________________________________ 12 . there are some layout formats webmasters will follow when designing a web site. 4. the position of a certain block of text is a major factor which contributes to the structure of a web site. Column header: The overall column header of the table (if any).1 Position of Division / Span As we know. If they are using Content Management System (CMS).4.4 Division / Span Structure Division <div> and Span <span> are two tags that are gaining popularity in recent times. we would need to estimate its position on the screen. If a positional value is allocated. Furthermore. it would be useful in our classification. CMS are scripts that are used by webmasters to generate the layout and content of the site. Thus. we will split the screen into 9 regions. 4. Division tag is a Control Structure tag as it will create a Break <br> effect. Row header: The overall row header of the table (if any). Span tag may or may not be a Control Structure tag depending on whether it has a position allocated to it. For this. these layouts will be even similar. using the position of cells will be useful in our classification.

The remaining blocks of text will be placed into each of these regions according to their X-Y coordinates. like Frames and Cross Documents structure.1.4. the functionalities of Layers can be emulated in Division and Span (z-index in CSS). Furthermore. Thus. they will be included in future releases. However. 4. Thus. if layer A has a zindex of 0. The higher the value of zindex. ________________________________________________________________________ 13 . then layer B will appear on top of layer A.5. That block of text will be in region 9. PARCELS focuses on single documents in this release.5 Layers Structure Due to advancement in HTML and CSS specifications. The rest of the regions will be sub divided according to this maximum position. 4. For example.6 Other Structures We recognize that there are other structures on the Web today.1 Priority of Layers Priority of a particular layer depends on the value of z-index. z-index will also be useful as segments like main contents will likely be on top of other segments like background images. 4. the higher it will appear on top of other layers. position of each layer is important as mentioned in Section 4.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ We will locate the maximum position on the X and Y axis. Layers will be handled in the same way as Division and Span. In terms of classifications. layer B has a z-index of 10 and layer A and B overlap each other.

a DOM Tree is created. Due to the complexity of web pages.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 5. 5. Figure 7 shows the partial DOM Tree that is created. we need to ensure the HTML coding is sound. Formulation of the PARCELS toolkits After our analysis on web pages and HTML structures. A DOM Tree is an n-ary tree in which each node corresponds to an HTML tag on the page. Thus. ________________________________________________________________________ 14 . we would now formulate our basic toolkits for PARCELS. Each parent-child relationship loosely means they are directly related. we need their DOM Trees.1. there will likely be errors. we will be able to capture the right relationship between segments correctly. • The ordering of nodes in the DOM Tree is preserved in that children are ordered from left to right in the order they appear on that page. After parsing it through Tidy. This relationship is what we defined as the “Logical Structure”. if we are able to parse it properly. 5. • The parent-child relationship in the tree implies that the child is in the scope of the parents.1 DOM Tree To manipulate with the styles of web pages.1 DOM Tree Parser A DOM Tree parser stimulates how humans parse words on a web page due to its layout. Since a web page is designed to be read by humans. This DOM Tree is created using the default Node class in Java. We would focus on the stylistic engine in this chapter. Before we create the DOM Tree. a program called Tidy is used to correct such errors. Figure 6 shows a web page as viewed in Internet Explorer 6.

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Figure 6: National Geographic News Site Document head body title meta … table table … Text tbody … tr td td Text Text Figure 7: Partial DOM Tree Representation ________________________________________________________________________ 15 .

1. Each block of text is split in a human readable way. ________________________________________________________________________ 16 . “Machine Learning” and “Website”. rather than how it is represented in a DOM Tree.2 Parser This section will focus on the 2 major functions of the DOM Tree parser.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ The next section describes how our parser parses the relevant information out of this DOM Tree. For example. • Splitting of Text from DOM Tree The parser will split the web page into blocks of text (basic unit). given the following block of HTML codes: <body><b>Tom Mitchell’s <i>Machine Learning</i> Website</b></body> The resultant DOM Tree is shown in Figure 8. we will get 3 blocks of text: “Tom Mitchell’s”. 5. body b Tom Mitchell’s i Website Machine Learning Figure 8: Resultant DOM Tree Representation If we were to split it as how the DOM Tree represents it.

This block of text will then be used in the Text Detection Engine of PARCELS (Lai. a table cell <td>. a layer <layer> or a body <body>. • Parsing of Styles from DOM Tree For each block of text. a span <span>. that’s not how human interpret it. the parser will parse its stylistic properties (as mentioned in Section 3. we would obtain the following characteristics: Stylistic Properties (in each segment) All the Control Structures containing this segment Position of each Control Structure Number and type Link elements Colors of Link formatting Number of Graphics elements Size of Images (if available) Total Word Count Font styles.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ However. the block of text will be “Tom Mitchell’s Machine Learning Website”.1. given the block of text and DOM Tree in Figure 8. A Control Structure can be a paragraph <p>. For example. a division <div>. Thus. sizes and colors • • • • • • • • • • • • Our Observations Default Body Structure found No other Control Structure found Position of Body Structure is trivial No links were found No links were found No graphical elements found No graphical elements found Total word count is 5 100% of the text are bold 40% of the text are in italics 100% of the text are of the same size 100% of the text are of the same color Figure 9: Stylistic Observations on Figure 8 ________________________________________________________________________ 17 .2). 2004). So our algorithm will link up all these text under the umbrella of a Control Structure.

we would need to identify the labeling of segments that are of interest to us in the News Domain. When we did the actual annotation for our Machine Learning training data.2 PARCELS Tags for News Domain As mentioned earlier.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ This is a simple demonstration on what the parser will obtain together with the block of text. These labels are easily extended. Thus. These data will be stored in a Vector for Machine Learning purposes in the next chapter. these are the 17 labels: PARCELS Labels Title of article Purpose of Labels Refers to the headline of the article or phrase that summarizes the article Date / Time of article Reporter name Source station Country where news occurred Image supporting contents of article Links supporting contents of article Main content of article Refers to the date and time the article was published Refers to the author of the article Refers to the source / provider broadcast station of the news article Refers to the country. report name and etc. city or state where the event took place Refers to an image (a photograph. like title. These labels are common components found. 5. After looking through articles from 12 News sites. Presently. we would focus on the News Domain in this release. Thus. there are segments which are useful but do not fall into any of the classes. drawing or sketch) related to the contents of the article Refers to a hyperlink placed within the main content of the article Refers to the main text of the news article ________________________________________________________________________ 18 . namely sub header and supporting contents. date. 2 more labels were added. we came up with 15 PARCELS labels.

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Supporting content of article Refers to the other text not belonging to the main text of the news article but is still related to the article. With this information. ________________________________________________________________________ 19 . we shall proceed with our Machine Learning. captions of audio / video files. After formulating the PARCELS toolkits. we are now able to the retrieve useful information from web pages. text ads and banner ads Refers to the text / links related to searching or search options Figure 10: PARCELS labels and purposes More information on the textual engine of PARCELS can be found in (Lai. any text of sidebars containing additional information about the article Sub header Refers to the sub headers which are found within the main content of the article Links to related article Refers to links to other news articles which have similar content or articles previously reported on the same topic. and the date / time of these articles Newsletter Refers to text / links prompting the user to sign up for or subscribe to a newsletter Site image Refers to images which are part of the web page's design and not related to the news article Site content Refers to the text which is part of the web page's content and not related to the news article Site links / navigation Refers to links to other parts of the website. 2004). such as captions of images. including navigation bars but not related to the news article Advertisements Search Refers to advertisements on the website.

Furthermore.1 PARCELS Labels vs. 1998). 6.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 6. we must first tabulate the stylistic features which are likely to affect certain PARCELS labels. Stylistic Features Before we proceed with the feature vector. Labels that are more likely to be classified by the stylistic engine are colored in light grey while labels that are less likely to be classified are in white. ________________________________________________________________________ 20 . Boostexter would also be included as an added feature in the stylistic engine. the size of the feature vector will grow increasingly with additional domains. Machine Learning and Co-Training For the stylistic engine. Thus.1 Support Vector Machine SVM is selected due to some of its core features like its ability to learn is independent of the dimensionality of the feature vector (Joachims. 2004). 1998). we would be using Support Vector Machine (SVM) for our Machine Learning purposes.1. Boostexter would be used (Lai. This allows fully automatic parameter tuning without expensive cross-validation. We can input a bias (cost factor) via a parameter. 6. For comparison purposes. For stylistic detection. this same margin argument suggests a heuristic for selecting good parameter settings for the learner. SVM measure the complexity of hypotheses based on the margin with which they separate the data and not the number of features. This means we can generalize even in the presence of many features (Joachims. For the textual engine. This is to cut down on the number of redundant features.

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ PARCELS Label Title of article Stylistic Feature • • • • Date / Time of article • • • • Reporter name • • • • Source station • • Country where news occurred • • Image supporting contents of article • • • Links supporting contents of article • • • Main content of article • • • • Likely detected by stylistic engine Larger font size May be in Bold font Relatively Top Position Not likely detected by stylistic engine Likely grouped with Reporter name Smaller font size May be in Italics font Not likely detected by stylistic engine Likely grouped with Date / Time Smaller font size May be in Italics font Not likely detected by stylistic engine Likely grouped within blocks of text Not likely detected by stylistic engine Likely grouped within blocks of text Likely detected by stylistic engine Image tags grouped with high Word Count Position within Main Content Likely detected by stylistic engine Links tag grouped with high Word Count Position within Main Content Likely detected by stylistic engine High Word Count Few or no Bold / Italics tags Position across News sites is similar ________________________________________________________________________ 21 .

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Supporting content of article • • • • Sub header • • • Links to related article • • • • Newsletter • • • Site image • • • • Site content • • • Site links / navigation • • • • • • Likely detected by stylistic engine High Word Count Few or no Bold / Italics tags Likely to be using different font color Likely detected by stylistic engine Low Word Count High percentage in Bold Likely detected by stylistic engine High percentage of links tags High percentage of text within <a> tags Position across News sites is similar Not likely detected by stylistic engine Low Word Count May be in smaller font size Likely detected by stylistic engine High percentage of links tags Low Word Count Position across News sites is similar Not likely detected by stylistic engine Low Word Count May be in smaller font size Likely detected by stylistic engine High percentage of links tags High percentage of text within <a> tags May have a high percentage of images Smaller font size Position across News sites is similar ________________________________________________________________________ 22 .

2 Formulation of Feature Vector Having identified the prominent stylistic features. Good for detecting labels like Main Content. etc. we can see that the stylistic engine will likely detect 10 out of the 17 labels with high confidence. span and layer as mentioned in Chapter 4. 2004). Number of features 11 3 8 4 ________________________________________________________________________ 23 . Thus.3. Characteristics Detection Detection of tables and the flow of cells as mentioned in Chapter 4. We will verify this in Chapter 7 (Analysis of Results). The textual engine will handle the rest of the labels with high confidence (Lai. With the observed stylistic features.4. we now formulate our feature vector. Detection of stylistic properties of the segment. We observed the number of nested tables does not go beyond 3 levels on the Web. 6.1. from Figure 11. Detection of weight factor of the segment. Detection of position of div. These features capture the number of <br> tags and word count. the percentage of italics text.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Advertisements (Graphical) • • • • • Search • • • Likely detected by stylistic engine Low percentage of link tags Low percentage of image tags Low or no Word Count May be in fixed sizes Not likely detected by stylistic engine Low Word Count May be in smaller font size Figure 11: PARCELS labels’ Stylistic Features Therefore. This refers to which of the 9 regions on screen are they in. we set the limit to 4 nested tables. we came up with the feature vector for each segment of text. like the percentage of bold text.

The PARCELS labels and formulation of feature vector for Boostexter will be similar to Section 6. The idea of co-training is to use this large unlabelled sample to boost the performance of our learning algorithm since a small set of labeled examples is available to us due to manpower issues (Blum and Mitchell.1. Total Features 31 2 3 Figure 12: Breakdown of features in Feature Vector One feature vector will be outputted for every text block segment and stored in a single file. it is logical to apply co-training to achieve a better result. which are almost mutual exclusive to each other. 2004). 1998). For the full listing on the contents of the feature vector. Useful in detecting labels like Related Links and Navigation Links. 6. ________________________________________________________________________ 24 . they will be left out. we have included a module to convert our SVM feature vector to Boostexter. In the event when one of the features does not apply. Good for advertisements and site links detection.3.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Detection of links ratio in that particular segment of the web page.3 Co-Training In Machine Learning.1 Stylistic and Textual Engine Since we have 2 engines. Detection of images and their sizes. This file will then be trained or classified. please refer to Appendix B. one based on styles and one based on text. 6.2 Boostexter Boostexter is used mainly in the textual engine (Lai. 6. For comparison. unlabelled examples are significantly easier to come by than label ones.

Top k examples with the highest positive confidence will be collected after classification. For example. PARCELS will then compare the top k examples between the two classifiers. After learning is performed on these training data. the SVM classifier will classify the unlabeled examples. The same applies for the Boostexter classifier. there are two sets of training data for the both SVM and Boostexter.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Add top k positive data SVM Training Data SVM Trainer SVM Classifier Classify New Data Remove top k positive data Unlabelled Data Co-training Module Classify New Data BT Training Data BT Trainer BT Classifier Add top k positive data Figure 13: Co-Training Flowchart Firstly. SVM Classifier (Top k) Segment 5 6 10 11 1 Classification Main Content Related Links Main Content Main Content Main Content Boostexter Classifier (Top k) Segment 6 5 11 42 56 Classification Main Content Main Content Main Content Main Content Main Content Figure 14: Example of Co-Training Classification ________________________________________________________________________ 25 . The overlapping examples will be selected first.

These 5 examples will then be removed from the unlabelled examples and added to the training set for both SVM and Boostexter. Segments with two different classifications will be ignored. it is not accurate to compare the level of confidence between two learners. ________________________________________________________________________ 26 . Thus. we will take the top examples from each classifier until 5 is reached. Therefore.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ From Figure 14. 42 and 1 will be included. Segment 5 and 11 will be selected. Since we are looking for top 5 (k = 5 in this example). Since we are using two separate Machine Learners. Segment 10. Segment 6 will be ignored. The whole process will repeat for the number of times specified.

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 7.6 80.1 33. the result peaked in the second round of co-training. Thus. if we do a comparison on the papers (Chapter 2) that uses their own representation tree. like HTML Struct Tree.3 Round 3 P 64.3 80. it would be useful to put it into real use by applying existing web pages in the News domain.0 Round 2 P 71.0 50.8 75.9 100. Related links comes a close second with precision of 100% but with a rather low recall.1 87.0 100. as we know main content extraction is already heavily researched.9% is a good result.8 100. 7.2 Round 4 P 64. Labels Precision / Recall Overall Main Content Related Link Site Content Navigation Links P Initial R 70.9 93.9 93.0 57. The low recall is due to the lack of training data.0 Figure 15: Preliminary Investigation of Results With the available training data. Thus. it is not easy to obtain huge amounts of labeled data in a short time. An overall precision and recall of 71. Not surprisingly. The same can be said for Navigation Links as they both belong to the Links class.2 R 70.0 100.1 33.3 80.5 50.0 60.9 72. Analysis of Results With the PARCELS engines working.1 Preliminary Investigation of Results As we know.0 R 64.0 R 64.1 84.0 80. ________________________________________________________________________ 27 . we would try to obtain some preliminary results.0 40.1 22.0 60.9 72.9 84.0 70.1 66.0 50. In fact.1 22.0 40.3 100.9 100. However. we are more interested in the other labels.0 36.0 Round 1 P 70. our results are on par and even higher in some instances.0 R 71.0 57.9 93.0 33. Main Content is the easiest to classify with its recall constantly over 90% and precision over 70%.1 96.3 75. with a training set of 5 news sites.1 100.4 50.0 38.

an annotation engine is already in place to handle this problem (Lai. We will be providing the detailed investigation of results on our PARCELS website on Sourceforge. 7. ________________________________________________________________________ 28 .2 Detailed Investigation of Results More labeled examples from the annotation engine will be available in near future. we are very confident that the precision and recall will be improved further. not all the labels are available in the training set.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ On the other hand. 2004). Site Content has an increasing precision and a high recall. We are certain that the results can be a lot better. With more labeled examples. Nevertheless. First of all. Those labels not mentioned in Figure 15 are the ones we do not have positive examples of. The increasing precision reflects that co-training works well for our classification given sufficient amount of training data.

PARCELS is currently released under GPL on Sourceforge. PARCELS has done just that. Conclusion We started this paper with a mission to design something that classifies segments of web pages into useful information. some of which mentioned in this thesis. http://parcels. there is always room for further work. we are able to obtain the relevant segments of the web page. • Ability to handle Frame Structure This will ensure we have a complete system that can parse virtually any web pages on the Web today. PARCELS is easily extendable.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ 8. • Ability to handle Cross Documents Structure This will give PARCELS the ability the view web pages as clusters instead of individual pages. This was one of the design considerations of PARCELS – to be able to handle pages from different domains. extending it to other domains poses no problem at all. ________________________________________________________________________ 29 . we can apply it to many tasks.net 8. We have done numerous background analyses on how humans perceive web pages in real life before designing such a system.sourceforge. Below are some of the areas which can be improved. Thus. we are pretty confident PARCELS will be able to classify with accuracy and precision. This is important since most web pages today are part of major web site. Inputting a News article into PARCELS will give us a Logical Structure of how the web page is designed. Since the system is designed modularly. With this Logical Structure.1 Future Work Nevertheless. With the working system now.

our primary focus is still HTML tags. It would be good to have as JavaScript does affect the layout of pages in some instances (though rarely). ________________________________________________________________________ 30 . • JavaScript support We did not handle JavaScript in this release. CSS is gaining popularity and it is useful to take a look at CSS.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ • Improved CSS support Although there is CSS support in this release.

In COLT: Proceedings of the Workshop on Computational Learning Theory. 1997. (1997). Neistadt. P. In the 11 th WWW Conference. Senior thesis. and Mitchell. In the 2nd International Conference on Multi-model Interfaces. and Douglas. 1998. 232 – 241 DiPasquo. Carnegie Mellon University. W. Using HTML formatting to aid in natural language processing on the World Wide Web. M. Yu. S..R. L. Xi’an.E. M.. (2003). 2003.Y. Layout & Language: Preliminary experiments in assigning logical structure to table cells. (2003). Layout and Language: Beyond Simple Text for Information Interaction – Modeling the Table. 2002. T. A flexible learning system for wrapping tables and lists in HTML documents. (1998). 207 – 214 Hurst. Hurst. Computer Science Department.S. M. pp.. In the 12 th WWW Conference. pp. Kaiser. (1999). Cai. Budapest. D. D. G. Washington. J. Wen. D. S.W. Morgan Kaufmann Publishers. and Grimm. pp. Gupta.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ References Blum. pp 217 – 220 ________________________________________________________________________ 31 . Hawaii. and Jenson. Combining labeled and unlabeled data with cotraining. In the Applied Natural Language Processing Conference. S. W. (2002). DOM-based content extraction of HTML documents. and Ma.. 2003. A. 406 – 417 Cohen. Extracting Content Structure for Web Pages Based on Visual Representation. (1998). 1998. Hurst. In the 5 th Asia Pacific Web Conference.. 1999.

(2003). M. pp. M. Honours Thesis.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Ivory. 2003. Joachims. Wen. Improving pseudo-relevance feedback in web information retrieval using web page segmentation. 137 – 142.. Ivory. In HCI International Conference. PARCELS: PARser for Content Extraction and Logical Structure (Text Deduction).R. Text categorization with Support Vector Machines: Learning with many relevant features. M.. Statistical Profiles of Highly-Rated Web Sites. In ACM Conference on Human Factors in Computing Systems. (1998). CHI Letters. W.Y. In the 12 th WWW Conference. (2004). Cai.Y. Recommendation. S. In Machine Learning: ECML-98. pp. School of Computing. 11 – 18 ________________________________________________________________________ 32 . 2002. and Hearst. T.Y. Characteristics of Web Site Designs: Reality vs. 367-374. S. J. National University of Singapore. Lai. (2002). (2003). D. and Ma. Budapest.A. Yu. 2003. Tenth European Conference on Machine Learning. 2004. pp.

2% 49.4% 10.0% <layer> 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% National Geographic (Jan 2004) National Geographic (Jan 2002) Straits Times (Jan 2004) Straits Times (May 2000) CNN (Jan 2004) CNN (Jun 2000) Yahoo News (Jan 2004) Yahoo News (Oct 2000) BBC (Jan 2004) BBC (Feb 2000) ________________________________________________________________________ A1 .7% 96.9% 2.1% 96.0% 5.8% 0% 0% 60.1% 98.1% 50.0% 2.2% 2.3% 3.2% <div> 32.4% 6.9% 39.1% 3.6% 98.4% 99.0% 98.7% 1.0% 22.1% 48.4% <span> 4.2% 96.2% 19.3% 98.1% 12.0% 96.0% 12.4% 8.7% 96. Percentage of tags embed with News Sites Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Total Tags 464 447 454 337 608 425 619 411 943 649 1358 934 1012 769 929 506 622 479 589 465 <table> 97.1% 36.9% 6.8% 1.9% 12.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Appendix A – Distribution of HTML Structural Tags The table below shows the distribution of HTML Control tags for 12 popular News sites on the Web today.0% 31.3% 4.4% 18.6% 31.6% 2.5% 85.6% 9.4% 0% 0% 0.7% 87.2% 98.3% 97.1% 97.1% 95.1% 0% 0% 6.0% 95.2% 29.3% 88.4% 95.

0% 3.8% 97.0% 13.3% 95.0% 17.1% 97.7% 13.8% 97.3% 0% 0.6% 98.3% 0% 0% 97.1% 98.com (Mar 2000) MSNBC (Jan 2004) MSNBC (Feb 2001) Arabic News (Jan 2004) ________________________________________________________________________ A2 .8% 99.3% 0% 0% 0% 0% 0% 0% 0% 29.com (Jan 2004) Space.3% 9.0% 5.5% 98.8% 15.3% 96.7% 0% 0% 0% 0% 8.0% 97.2% 98.4% 97.2% 88.4% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% Slashdot (May 2000) CNet (Jan 2004) CNet (Jan 2002) Wired News (Jan 2004) Wired News (Feb 2000) The Register (Jan 2004) The Register (Feb 2000) Space.3% 0% 0% 0.7% 0% 0% 54.7% 0.2% 95.0% 77.4% 9.4% 12.9% 9.1% 0.1% 1.9% 98.9% 0% 4.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Slashdot (Jan 2004) Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles Index Articles 1116 2894 914 2459 661 431 744 403 402 217 857 410 786 412 679 247 426 586 616 598 1036 538 315 458 417 213 98.8% 94.7% 0% 0% 5.9% 95.3% 31.1% 15.7% 81.4% 2.4% 97.6% 98.1% 95.4% 98.4% 98.2% 94.6% 93.3% 97.2% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0.1% 12.2% 93.8% 98.

3% 86.PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Arabic News (Feb 2000) Index Articles 426 133 95.4% 0% 0% 0% 0% 0% 0% Figure 16: Distribution of HTML Structure Tags ________________________________________________________________________ A3 .

PARCELS: PARser for Content Extraction and Logical Structure (Stylistic Detection) ________________________________________________________________________ Appendix B – Listing of Features in Feature Vector 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: Depth of current cell in the nested tables Row number of current cell in outermost table Row number of current cell in the 1st nested table Row number of current cell in the 2nd nested table Row number of current cell in the 3rd nested table Row number of current cell in the 4th nested table Column number of current cell in outermost table Column number of current cell in the 1 nested table Column number of current cell in the 2nd nested table Column number of current cell in the 3rd nested table Column number of current cell in the 4 nested table Position (1 – 9) of div Position (1 – 9) of span Position (1 – 9) of layer Percentage of words in <i> in this segment Percentage of words in <i> in this segment over all words under <i> in article Percentage of words in <b> in this segment Percentage of words in <b> in this segment over all words under <b> in article Percentage of words in <u> in this segment Percentage of words in <u> in this segment over all words under <u> in article Percentage of words in <font> in this segment Percentage of words in <font> in this segment over all words under <font> in article Number of <br> tags in this segment Percentage of <br> in this segment over all <br> in article Number of words in this segment Percentage of words in this segment over all words in article Percentage of words in <a> in this segment Number of <a> tags in this segment Percentage of <a> in this segment over all <a> in article Number of <img> tags in this segment Percentage of <img> in this segment over all <img> in article th st ________________________________________________________________________ B1 .

Sign up to vote on this title
UsefulNot useful