[ 
https://issues.apache.org/jira/browse/TIKA-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867473#action_12867473
 ] 

Christian Kohlschütter commented on TIKA-420:
---------------------------------------------

Dependencies:
With the changes made in boilerpipe 1.0.4 there is no dependency on any third 
party jar (not even NekoHTML / Xerces as up to version 1.0.3). boilerpipe now 
likes TagSoup as well.

Central maven repo:
I will try to get it in central. Even though I am not a big fan of central 
repositories, I think it is worthwile to put boilerpipe there. However, this 
probably means I have to completely mavenize boilerpipe, get a new GPG key for 
that purpose etc. This may take some time!

In the meantime:
Could anyone please review my patch from a code perspective?

Jukka, regarding your feature requirements:

> Streaming mode, i.e. without having to read the entire document in memory 
> before writing out anything?
The algorithm supports it; boilerpipe 1.0 currently doesn't. Maybe in 1.1.

> Also, it would be awesome if we could have BoilerpipeContentHandler emit 
> structured XHTML SAX events instead of just plain text. Being able to 
> preserve things like <p> and <a> tags in main content while dropping 
> surrounding boilerplate would be really nice.
Yes, this would also be possible (also, not with 1.0.4). Getting <a> tags is 
quite simple as boilerpipe already keeps track of them internally. <p>s are 
more difficult since you likely want to have them at sensible segment 
boundaries, not wherever a <p> tag was in the original document and also not 
where boilerpipe thought a text block boundary was.

I have written a paper about densitometric text segmentation, available from 
here: http://www.l3s.de/web/upload/documents/1/cikm549-kohlschuetter.pdf (A 
Densitometric Approach to Web Page Segmentation, CIKM 2008)  It essentially 
also uses shallow text features, like boilerpipe, and can probably quite easily 
be added to the boilerpipe code at a later version. Maybe 2.0.

Would these two features be a show stopper for the inclusion into Tika?



> [PATCH] Integration of boilerpipe: Boilerplate Removal and Fulltext 
> Extraction from HTML pages
> ----------------------------------------------------------------------------------------------
>
>                 Key: TIKA-420
>                 URL: https://issues.apache.org/jira/browse/TIKA-420
>             Project: Tika
>          Issue Type: New Feature
>          Components: parser
>            Reporter: Christian Kohlschütter
>            Assignee: Ken Krugler
>         Attachments: tika-app.patch, tika-parsers.patch
>
>
> Hi all,
> while Tika already provides a parser for HTML that extracts the plain text 
> from it, the output generally contains all text portions, including the 
> surplus "clutter" such as navigation menus, links to related pages etc. 
> around the actual main content. This "boilerplate text" typically is not 
> related to the main content and may deteriorate search precision.
> I think Tika should be able to automatically detect and remove the 
> boilerplate text. I propose to use "boilerpipe" for this purpose, an Apache 
> 2.0 licensed Java library written by me. Boilerpipe provides both generic and 
> specific strategies for common tasks (for example: news article extraction) 
> and may also be easily extended for individual problem settings.
> Extracting content is very fast (milliseconds), just needs the input document 
> (no global or site-level information required) and is usually quite accurate. 
> In fact, it outperformed the state-of-the-art approaches for several test 
> collections.
> The algorithms used by the library are based on (and extending) some concepts 
> of my paper "Boilerplate Detection using Shallow Text Features", presented at 
> WSDM 2010 -- The Third ACM International Conference on Web Search and Data 
> Mining New York City, NY USA. (online at 
> http://www.l3s.de/~kohlschuetter/boilerplate/ )
> To use boilerpipe with Tika, I have developed a custom ContentHandler 
> (BoilerpipeContentHandler; provided as a patch to tika-parsers) that can 
> simply be passed to HtmlParser#parse. The BoilerpipeContentHandler can be 
> configured in several ways, particularly which extraction strategy should be 
> used and where the extracted content should go -- into Metadata or to a 
> Writer).
> I also provide a patch to TikaCLI, such that you can use boilerpipe via Tika 
> from the command line (use a capital "-T" flag instead of "-t" to extract the 
> main content only).
> I must note that boilerplate removal is considered a research problem:
> While one can always find clever rules to extract the main content from 
> particular web pages with 100% accuracy, applying it to random, previously 
> unseen pages on the web is non-trivial.
> In my paper, I have shown that on the Web (i.e. independent of a particular 
> site owner, page layout etc.), textual content can apparently be grouped into 
> two classes, long text (i.e., a lot of subsequent words without markup -- 
> most likely the actual content) and short text (i.e., a few words between two 
> HTML tags, most likely navigational boilerplate text) respectively. Removing 
> the words from the short text class alone already is a good strategy for 
> cleaning boilerplate and using a combination of multiple shallow text 
> features achieves an almost perfect accuracy. To a large extent the detection 
> of boilerplate text does not require any inter-document knowledge (frequency 
> of text blocks, common page layout etc.) nor any training at token level. The 
> costs for detecting boilerplates are negligible, as it comes down simply to 
> counting words.
> The algorithms provided in my paper seem to generally work well and 
> especially for news article-like pages (for a Zipf-representative collection 
> of English news pages crawled via Google News: 90-95% F1 on average, 95-98% 
> F1 median), well ahead of the competition (78-89% avg. F1, 87-95% median F1).
> Patches are attached, questions welcome.
> Best,
> Christian

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to