<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Lifting user generated comments to SIOC</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Julien Subercaze</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Christophe Gravier</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>LT2C, Telecom Saint-Etienne</institution>
          ,
          <addr-line>Universite Jean Monnet 10 rue Tre lerie, F-4200</addr-line>
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>HTML boilerplate code is used on webpages as presentation directives for a browser to display data to a human end user. For machines, our community has made tremenduous e orts to provide querying endpoints using agreed-upon schemas, protocols, and principles since the avent of the Semantic Web. These data lifting e orts have been some of the primary materials for bootstrapping the Web of data. Data lifting usually involves an original data structure from which the semantic architect has to produce a mapper to RDF vocabularies. Less e orts are made in order to lift data produced by a Web mining process, due to the di culty to provide an e cient and scalable solution. Nonetheless, the Web of documents is mainly composed of natural language twisted in HTML boilerplate code, and few data schemas can be mapped into RDF. In this paper, we present CommentsLifter, a system that is able to lift SIOC data from user-generated comments in Web 2.0.</p>
      </abstract>
      <kwd-group>
        <kwd>Data extraction</kwd>
        <kwd>Frequent subtree mining</kwd>
        <kwd>users comments</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The SIOC ontology [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] has been de ned to represent user social interaction on
the web. It aims at interconnecting online communities. Nowadays SIOC data
are mostly produced by exporters 1. These exporters are plugins to existing
frameworks such as blog platforms (Wordpress, DotClear , : : :), content
management systems (Drupal) and bulletin boards. Unfortunately, these exporters
are not yet default installation plugins for these frameworks, except for Drupal 7.
Therefore few administrators enable them and as a consequence the SIOC data
production remains rare2. There exists also numerous closed source platforms
that supports online communities. Among them are the online newspapers that
allow commenting on articles, Q&amp;A systems. This subset of the user generated
content on the web will never be unlocked using exporters.
      </p>
      <p>In this paper we present CommentsLifter, a web-mining approach that aims
at extracting users' comments directly from HTML pages, in order to circumvent
1 http://sioc-project.org/exporters</p>
    </sec>
    <sec id="sec-2">
      <title>2 http://www.w3.org/wiki/SIOC/EnabledSites</title>
      <p>the exporter issue. The comments are identi ed in webpages by mining frequent
induced subtrees from the DOM , and using heuristics allow to discriminate the
di erent eld of the comment (username, date, : : :). This approach does not
require any a priori knowledge of the webpage. We empirically evaluated our
approach and obtained very good results.</p>
      <p>The paper is structured as follows. The next section presents related works
on both structuring data into semantic web formats and web mining approaches.
Section 3 presents a formalisation of the problem and recalls some theoretical tree
mining results. Section 4 details the di erent steps of CommentsLifter, followed
by experimental results. Finally, section 6 concludes.
2</p>
      <sec id="sec-2-1">
        <title>Related works</title>
        <p>
          Converting existing format of data into RDF is a cornerstone in the success of the
semantic web. The W3C maintains a list of available RDFizers on its website
3. Input data can be either structured or unstructured. In the former case, if
the semantics of the data can be extracted, then the conversion can take place
without human intervention [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ], otherwise the user needs to manually speci y
the semantics of the data. Sesame contains an API called SAIL (Storage And
Inference Layer) that can be used to wrap existing data format into RDF. The
BIO2RDF project [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] uses this API to build bioinformatics knowledge systems.
Van Assem presented a method for converting Thesauri to RDF/OWL [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] that
has been successfully applied for biological databases [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. In order to convert a
mailing list archive into a RDF format, the authors of [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] developed SWAML,
a python script that reads a collection of messages in a mailbox and generates a
RDF description based on the SIOC ontology. Since the input data are already
structured (i.e. emails follow the RFC 4155) the conversion is straightforward.
On the other side, there exist several approaches that aims at automatically or
semi-automatically adressing the case where user intervention is usually required.
Text-To-Onto [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ] is a framework to learn an ontology from text using text
mining techniques as well as its successor Text2Onto [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. However none of these
papers provide a sound evaluation of the quality of learnt ontologies. This is due
to the very nature of ontology modeling in which no ground truth can be assessed,
as there exists as many models as one could imagine for describing the same
thing. In [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ], Berendt details relationships between web mining and semantic web
mining. The di erent cases (ontology learning, mapping, mining the semantic
web, : : :) are detailed. From this categorization, the purpose of our research falls
into the category of instance mining, which focuses on populating instances for
existing semantics. For this purpose, learning techniques have been proposed for
web scale extraction with a few semantic concepts [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] and presented promising
results at the time of publication. Textrunner [
          <xref ref-type="bibr" rid="ref22">22</xref>
          ] also learns to perform
webscale information extraction, presenting good precision but a very low recall.
Concerning non learning techniques, automatic modelling of user pro les has
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3 http://www.w3.org/wiki/ConverterToRdf</title>
      <p>
        been performed in [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], using term recognition and OpenCalais for named entity
recognition.
      </p>
      <p>
        Several techniques have been developed for web extraction. In [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], the authors
simulate how a user visually understands Web layout structure. [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] divided the
page based on the type of tags. Many recent research works exploit text density
to extract content on pages [
        <xref ref-type="bibr" rid="ref15 ref16 ref21">16, 21, 15</xref>
        ]. This approach presents good results
regarding article content extraction. In order to do so, the boilerpipe library4,
based on the work from Kohlschutter [
        <xref ref-type="bibr" rid="ref15 ref16">16, 15</xref>
        ] is widely used. For a more detailed
survey on the di erent Web data extraction techniques we encourage the reader
to refer to [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Among other techniques DEPTA [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ] (an extension of works
done in [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ]) presents a hybrid approach of visual and tree analysis. It uses a
tag tree alignment algorithm combined with visual information. In a rst step
DEPTA processes the page using a rendering engine (Internet Explorer) to get
the boundaries information of each HTML element. Then the algorithm detects
rectangles that are contained in another rectangle, and thus build a tag tree
in which the parent relationships indicates a containment in the rendered page.
DEPTA then uses a string edit distance to cluster similar nodes into regions.
Since each data region in a page contains multiple data records, extracted tag
trees must be aligned to produce a coherent database table. A tree edit distance
(like in [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ]) is then de ned and used to merge trees. However DEPTA is not able
to extract nested comments. We will use a di erent approach, that only requires a
DOM parsing technique and that is suitable for analyzing huge amount of pages.
Our approach is based on a theoretical tree mining background, presented in the
next section.
3
      </p>
      <sec id="sec-3-1">
        <title>Problem De nition</title>
        <p>The purpose of our work is to provide a solution for the leverage of Linked Data
using the SIOC schema from user generated comments on webpages, without any
a priori knowledge on the webpage. Our main assumption is that comments on a
given webpage (even at website scale) are embedded in the same HTML pattern.
This assumption is well ful lled in practice since comments are usually stored
in a relational database and exposed into HTML after an automatic processing
step. Therefore our goal is to automatically determine the HTML pattern that
is used to expose the comments and then to identify the relevant information in
the content to ll SIOC instances.</p>
        <p>Basically a comment is a sioc:Post contained in a sioc:Forum container. We
identi ed the following subset of the core-ontology properties of sioc:Post to be
relevant for the extraction (we marked with * the mandatory properties and
relationships) :
sioc:content *: text-only representation of the content
dc:terms: title of the comment
dcterms:created : creation date</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4 http://code.google.com/p/boilerpipe/</title>
      <p>and relationships :
sioc:has creator *: points to a sioc:UserAccount which is the resource
sioc:has container *: indicates a sioc:Container object
sioc:reply to: links to a sioc:Post item
sioc:has reply : links to sioc:Post items</p>
      <p>The sioc:Container pointed by sioc:has container can be from di erent types
in our case. We consider extraction from user reviews (sioct:ReviewArea), posts
on forum (sioc:Forum), comments from blogs (sioct:Weblog ), Q&amp;A answers
(sioct:) or generally for newspaper discussion (sioc:Thread ). However,
distinguishing these di erents subclasses of sioc:Container would require classi
cation from the webpages we intend to perform extraction on. This is out of the
scope of our paper, we will therefore uniformally consider the container as an
instance of sioc:Container. Similarly there exists subclasses of a sioc:Post for
each container. As for the container, our algorithm will output sioc:Post items.</p>
      <p>To summarize, our problem is the following : in order to generate SIOC
data from raw HTML, we must identify the di erent items (sioc:Post ) and their
conversational relationships (sioc:reply to and sioc:has reply ). For each item we
must identify the user (sioc:UserAccount ), the content of the post (sioc:content )
and when possible the date and the title.
3.1</p>
      <sec id="sec-4-1">
        <title>Frequent Subtree Mining</title>
        <p>In the case of product listing extraction, the goal is to extract frequent subtrees
that are identical in the page. For this purpose, a bottom-up subtree mining
objective is su cient. For selecting a feature among mined items, for example
title and price, a lter on the leaf nodes can be applied. In the case of comments
extraction, the patterns can be nested. Assuming that the pattern we are looking
for is [a[p; br; p; div]], if we encounter a reply to a comment, i.e. nested instances
in the pattern, the tag tree for the comment and its answer could be as follows :
[a[p; br; p; div; [a[p; br; p; div]]]]. In the case of a single comment we will encounter
our pattern [a[p; br; p; div]]. We observe that nodes can be skipped horizontally
along with their descendants.</p>
        <p>
          In frequent subtree mining, three types of subtrees are distinguished :
bottomup, induced and embedded. Figure 1 depicts these di erent subtrees. For more
details on frequent subtree mining, we refer the reader to [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ].
        </p>
        <p>We observed empirically that instances are nested in the way we described
previously : the direct parenting relation is preserved. Consequently induced
subtree is a su cient type of subtree for our purpose. Embedded subtree
mining could also be used, however since the algorithms complexity grow with the
complexity of the pattern to mine, induced subtree mining is de nitely more
appropriate. The main advantage of subtree mining over existing works is that
it provides a mine once extract many approach. In order to mine large
websites, one would need to mine the pattern from only one webpage from each site
and could later extract data by simple pattern matching on other pages, thus
D</p>
        <p>B
E
saving large amount of computational resources and time. In the next section,
we present CommentsLifter, our approach to comments' extraction based on
frequent subtree mining.
4</p>
        <sec id="sec-4-1-1">
          <title>CommentsLifter</title>
          <p>We now start the description of CommentsLifter. This section presents the
different steps of our algorithm. The underlying idea of CommentsLifter is to use
simple observations on Web page structures to reduce the candidate set
generation. This allows us to minimize the error rate while selecting the winning
pattern, and to contribute to the runtime performance optimization objective.
To extract comments from a Web page, CommentsLifter uses seven steps:
Document preprocessing, Frequent subtrees extraction, Clustering, Merging, Pattern
expansion, Winner selection, Field extraction, Data extraction. In the next
subsections we detail the process followed in each step of our algorithm.
4.1</p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>Preprocessing</title>
        <p>Recommendations issued by the W3C aim at specifying the languages of the
World Wide Web, with various versions of HTML and CSS. While pages
following these recommendations produce clean DOM trees, they represent only 4.13
% of the Web pages5. The remaining pages are made up of wrongly formatted
HTML code that is often referred to as "tag soup"6. Due to the large portion
that these pages represent, Web browser engines are able to handle malformed
HTML tags, improperly nested elements, and other common mistakes. In our
algorithm, the rst step is to convert any input HTML document (malformed
or not) and to output a well-formed document as a DOM tree. For this purpose,
any dedicated library (Jsoup7, Jtidy8) or browser engine can be used.
5
http://arstechnica.com/Web/news/2008/10/opera-study-only-4-13-of-the-Web-isstandards-compliant.ars</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>6 http://en.wikipedia.org/wiki/Tag_soup</title>
    </sec>
    <sec id="sec-6">
      <title>7 http://jsoup.org/</title>
    </sec>
    <sec id="sec-7">
      <title>8 http://jtidy.sourceforge.net/</title>
      <p>4.2</p>
      <sec id="sec-7-1">
        <title>Frequent subtrees extraction</title>
        <p>
          The next step of our algorithm consists of the generation of a rst candidate set.
For this purpose we extract frequent depth-two trees from the DOM and store
them in a cardinality map (an example is given in Table 1). The basis of our
approach is to select patterns with a depth of two that will be expanded into
larger patterns (empirical results in Section 5 show that the average depth of
a comment pattern is 4.58). For this purpose, a tag tree is generated from the
preprocessed DOM. CommentsLifter traverses the tree in a top down fashion
and stores the encountered trees of size two (each node that has children, along
with its children). The results are sorted, as presented in Table 1. Candidates
with less than two occurrences are discarded, since we assume that there are at
least two comments. The same assumption is made for instance by [
          <xref ref-type="bibr" rid="ref23">23</xref>
          ]. For each
pattern occurrence, the encountered instance is stored in a multimap (in fact we
only store the label of the parent node).
        </p>
        <p>Count 13 12 10 8
Tree div[a;br;i;p] ul[li;li] div[p;p] div[p;p;p]</p>
        <p>Table 1. Example of two depth candidates.</p>
        <p>At this stage our candidate set is initialized and contains the instances of
comments we are looking for.
4.3</p>
      </sec>
      <sec id="sec-7-2">
        <title>Clustering</title>
        <p>Comments in a Web page appear in a continuous manner, so it is very unlikely
that comments are stored in di erent branches of the DOM tree. We did not
encounter the case of split comments in di erent subtrees during our experiments.
In fact, comments are organized in a tree structure, where the beginning of the
comments block is the root of the tree. Since comments are located in the same
subtree, we proceed to a clustering phase of the occurrences for each pattern.</p>
        <p>In this step, we aim at clustering co-located instances of the same pattern.
In other words, the algorithm builds the pairs (pattern; Instances), where each
pattern is associated with a set of instances matching it that are located in the
same subtree and close to each other. Consequently, one pattern can be
associated multiple times with a unique set of instances, whose member is distinct from
any other member of another associated set to the pattern. This means that each
pair (pattern; Instances) is splitted into di erent (pattern; Instances) where the
instances in Instances do belong to the same subtree in the DOM. The basis
of our algorithm is a distance-based clustering.For each given pattern, the
algorithm sorts its instances along their depth in the tree. At each depth, we check
for each instance if it has a parent in the previously found (pattern; Instances).
For the remaining instances, we cluster them using a classical node distance in
trees : d(a; b) 2 N is the length of the shortest path between the nodes a and
b. After building the set of (pattern; Instances), we remove elements where the
cardinality of instances is equal to one.</p>
        <p>For example, running our algorithm on the tree provided by Figure 2 with the
pattern ul[li; li] would produce two pairs (pattern; Instances) that are depicted
with dotted and dashed boxes in the same gure.</p>
        <p>lllllllllRRRRRRRRR
div
: : :
a
yyyyyyEEEEEE
ul
yyyyyyEEEEEE
li li</p>
        <p>ul
yyyyyyEEEEEE
li li</p>
        <p>div
_ _ _ _ _ _ _</p>
        <p>ul
yyyyyyEEEEEE
li li
_ _ _ _ _ _ _</p>
        <p>At the end of this step, CommentsLifter holds the set of pairs (pattern; Instances)
that matches a pattern to a set of co-located instances in the DOM tree. In the
next step, we try to identify mergeable patterns from this data structure.
HTML patterns that contain comments often have a depth greater than two
(see Section 5 for more details). Consequently our candidate set may at this step
contain pairs of (pattern; Instances) that belong to the same global pattern,
that we did not discover yet because the pattern expansion process will occur
later. Instead of discovering the same pattern from di erent candidates, we aim
at merging these candidates beforehand for optimization.</p>
        <p>For this purpose we perform a pairwise comparison between the sets of
instances. We process a merge between sets of instance when every element of a
set S1 is topped by an element from the other set of instances. An element is
topped by another if the latter is a parent of the former. If a set of instances
is topped by another set, we discard this set and restart the process until no
further updates to the candidate set are performed.</p>
        <p>Algorithm 1 presents this merging process. After this step, the candidate set
is again drastically pruned since we eliminated all potentially duplicate patterns
for the expansion phase. This process, together with the previous clustering
process, are the key phases of our algorithm since they discard both duplicate
and irrelevant candidates.</p>
        <p>Algorithm 1: M ergeP atterns : Merge similar pattern</p>
        <p>Data: A collection of couple (Pattern,Instances) Input where all patterns are
di erent,
minDepth the mininum depth of the instances in the DOM tree
Result: A collection Candidates of (pattern,Instances) where similar couples
have been merged
recursion f alse;
Candidates ;;
for i : 0 : : : Input:size do
for j : i : : : Input:size do
//Depth of the highest common element ;
commonDepth depth(HighestCommon(Input[i]:Instances;;
Input[j]:Instances));
//Save useless computation ;
if commonDepth &lt; minDepth then</p>
        <p>continue ;
end
end
return Candidates;
end
Small setW ithLessInstances(Input[i]; Input[j]);
Large setW ithM oreInstances(Input[i]; Input[j]);
if 8k 2 Small:Instances; 9l 2 Large:Instances; isP arentOf (l; k) then
Candidates Input n Small;
//Restart the merging process;
M ergeP atterns(Candidates);
//Cut the current call;
break;;
else Candidates</p>
        <p>Candidates [ Large [ Small
Since the candidate set contains simple patterns (i.e. of depth two), we process
a pattern expansion to discover the fully matching patterns. Patterns may be
expanded in both directions, towards the top and the bottom of the tree.</p>
        <p>For each candidate (pattern; Instances), we distinguish two cases. In the
rst case every instance is at the same depth in the tree, this is the case of
product listing extraction that we call the at case. This is the case of
bottomup subtree mining (see Figure 1). The second case also called the nested case is
the one where instances belong to the same subtree but at di erent depths, this
is the case of induced subtrees in Figure 1 . Top expansion is straightforward,
we check if the type of the parent node (i.e. HTML markup tags) for every
instance is the same, in this case we expand the pattern with the new parent
node and update the instances consequently. This process is executed until all
the instances do not share the same tag as parent node or if the same node (in
sense of label in the tree, not HTML markup tag) is the parent of all instances.
This process is the same for both nested and at cases.</p>
        <p>div
_ _ _ _ _ _jj_jj_jjj_jj_jjU_UU_UUU_UU_UUU_ _ _ _
ul
////
div
: : :
li li p li li p
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _</p>
        <p>Once a pattern is expanded in the top direction, the bottom expansion takes
place. This bottom expansion in the at case, similar to the top expansion is
simple since top-down subtrees are easy to extract. One just needs to traverse the
instances trees in a top-down lefmost direction, looking for nodes that are shared
by all instances. Once a node is not present in every instance the algorithm uses
backtracking to select the next sibling, and then continues its process.</p>
        <p>
          However the nested case is not trivial since we look for embedded subtrees.
Standard algorithms such as AMIOT [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ] and FREQT [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] are dedicated to this
task, but as we mentioned in section 3.1 they performed poorly on the full Web
page, either the running was excessively long (some minutes) or the program
ended with an exception. To make e cient use of these algorithms, we take
advantage of the speci cities of comments extraction. Apart from the
aforementioned issues, the biggest problem we encountered using AMIOT or FREQT was
that we were unable to adaptatively select the support (in fact, a percentage)
for a Web page. However in our pattern expansion case, we know how much
instances are present for each couple (pattern; Instances). Thus, we performed
a modi cation in the algorithms (see Implementation in section 5.1 for further
details) to discard candidate patterns not on a minimum support base, but on a
strict occurrence equality base. Finally, instead of using the complete Web page
as the data tree, we construct a tree by adding all the instances in a tree. More
precisely since the instances are stored using only their top nodes (the whole
instance is retrieved by applying the pattern to this node in the data tree), we build
the data tree by adding the subtrees under the instances' top nodes as children
of the root node. Therefore, our data tree contains on ly the relevant instances.
Consequently the set of candidate patterns is drastically reduced, compared
with the use of the whole DOM page. To drive AMIOT in the right direction,
the candidate pattern set is initialized with the current depth-two pattern, thus
avoiding useless candidate generation for the rst stage. Figure 3 depicts this
expansion process. In this gure we present the instances as they appear in the
DOM tree. Our starting pattern is ul[li; li], and its instances are represented
within the dotted boxes. Both instances have a div node with a di erent label
as parent, consequently the pattern is expanded to the top : div[ul[li; li]]. Next,
both instances again have a div node as parent but in this case this is the same
node. The top expansion process nishes. For the bottom expansion, we consider
this subtree as the data tree. AMIOT (resp. FREQT) performs a left to right
expansion that adds the node a to the pattern: div[ul[li; li]; a]. The rightmost div
node is discarded since it does not belong with the left instance (the occurrence
is one whereas the algorithm expects two). Then AMIOT adds the node p to the
pattern that becomes div[ul[li; li]; a[p]]. The gure does not show the part under
the right most div, in this part we could nd for example another instance of
div[ul[li; li]; a[p]], resulting in a nested comment.
4.6
        </p>
      </sec>
      <sec id="sec-7-3">
        <title>Winner selection</title>
        <p>
          Recurring structures competing with the comments pattern in the candidate set
are usually menu elements, links to other articles. In [
          <xref ref-type="bibr" rid="ref15 ref16">15, 16</xref>
          ], Kohlschutter
developed a densitometric approach based on simple text features that presents
excellent results (F1 Score : 95 %) for news article boilerplate removal. User
generated comments also di erentiate from menu elements on their text
features. Comments are from di erent text lengths, the link density is low since
comments are not part of a link in comparison to menu items. We developed
simple heuristics, based on our observations, to discard irrelevant candidates
and to rank the remaining candidates.
        </p>
        <p>Our experimentation showed that instances with a link density greater than
0:5 (Kohlschutter found 0.33 for news article) are always boilerplate. Short
comments in very complex HTML boilerplate patterns can produce instances with a
quite high link density. We empirically observed that links are on the username
or on its avatar and link to a pro le page. Consequently we discard candidates
where the average link density is above 0:5.</p>
        <p>For the remaining candidates their score is given by the following formula:
Score(p; I) = lgt(I)
v
u
u
t n
1
1
n
X lgt(I)
j=1
lgt(Ij )
2
(1)</p>
        <p>
          The above formula computes the average text length times its standard
deviation. This heuristic promotes candidates where the instances have longer
text length with variable length. Finally we did not use heuristics based on
a lower bound of words (as in [
          <xref ref-type="bibr" rid="ref15 ref16">15, 16</xref>
          ]). Once again comments extraction di ers
from traditional boilerplate removal since some comments are sometimes just
one word (e.g. lol, +1, rst ) or they may be longer than the article they are
commenting on. Therefore the standard deviation is very useful for eliminating
menu items where the text length is often very close among their instances. The
(pattern; Instances) couple with the highest score is promoted as the winner.
At this step, the algorithm output the tree of instances, i.e. we have the
structure of the conversation, but we need to further structure the conversation by
identifying the di erent elds in the pattern.
4.7
        </p>
      </sec>
      <sec id="sec-7-4">
        <title>Structuring the content</title>
        <p>Once the HTML pattern containing comments has been selected, the next step
of our algorithm consists of extracting the related SIOC elds as we described
in section 3. Two elds are always present in a comment : the username and
the content of the comment. From our observations on various websites (online
press, Q&amp;A, blogs, reviews), two other elds appear often. Firstly the date when
the comment has been posted occurs in 97.95 % of the cases (See Table 2).
Comments less often have a title, but the percentage we measured (24.48 %) remains
high enough to be of interest. We voluntarily skipped the extraction of rare elds
(vote on comments, account creation date) because of their few occurrences and
the fact that they complicate the whole eld's identi cation process. From our
observations, we noticed that content and title are always contained in their own
HTML markup tags, i.e. it is very unlikely to see the title and the content in
the same div. However we noticed that username and date often occur between
the same markup tag, for example we often encountered comments elds such
as &lt;div&gt;John, May 25, 2012 at 5:00 p.m&lt;/div&gt;. Therefore we apply the
following procedures : rst, identifying the date eld within the pattern. We store
the location of the date in the pattern and remove dates in every instances. For
instance, the previous example will become&lt;div&gt;John&lt;/div&gt;. At this point we
are sure that the elds we are looking for will be in distinct nodes of the pattern.
Date parsing Date parsing library such as JodaTime9 and JChronic10 perform
well on extracting date from messy data. These libraries takes a String as input
and return a Date object. However they do not o er the feature of returning the
original text without the substring containing the date. Therefore we developed
our library, using features and heuristics from both of the above mentioned
libraries, that o ers the date string removal feature.</p>
        <p>Fields selection Our heuristic is based again on simple observations. We know
that every comment contains at least a username and a content, with date and
title being optional. For each leaf of our pattern, we compute the following
measures over its instances : percentage of date found, average text length, standard
deviation of text length, text entropy and average word count, standard
deviation on word count. Using these values, we build two candidate sets, the rst one
for the date, and the other one for title, content and username. We distinguish
these elds using the fact that title, content and username are unstructured text,
however dates have a particular structure (containing year, days, : : :).</p>
        <p>A node in the pattern is a candidate for the date eld if its percentage of
date found is over 0:7 (to take into account the fact that date extraction is
not perfect), has more than two words and has a coe cient of variation on
the word count that is inferior to 0:2. This latter condition requires that the
number of words is very close from one instance to another. We did not set the
value to zero to avoid discarding elds where the date has a variable length, for
example one hour ago and yesterday. From these candidates, we pick the eld
with the highest entropy in order to discard constant elds that may have been
recognized as a date. However if the set is empty, then no dates are speci ed for
the comments, in practice this happens very rarely.</p>
        <p>The second candidate set should contain only nodes that instances own
textual data. For this purpose we discard the nodes in the pattern where the
variation of text entropy is equal to zero (constant text in every instance). Since we
know that the node containing the content must be present within this set, we
aim at identifying this eld in the rst place. Luckily the content is very simple
to identify since it contains the most words, has a very variable length and word
count. In the practice, selecting the node having the highest word count average
is su cient. Once the content has been removed from this candidate set, we rst
check its size. If the size is equal to one, the remaining candidate matches the
username. In the case where two candidates are present, we have to distinguish
between username and title. Usernames are very short names, usually one or two
words, and are then in average shorter than the title. If two elds are present,
the shorter is identi ed as being the username and the longest is then the title.</p>
      </sec>
    </sec>
    <sec id="sec-8">
      <title>9 http://joda-time.sourceforge.net/ 10 https://github.com/samtingleff/jchronic</title>
      <p>This section presents the evaluation protocol of CommentsLifter as well as our
experiment's results. We rst detail the experimental setup, which is a bit
particuliar for comments extraction due to the large use of AJAX. Finally we present
global and detailed results for both at and nested cases.
Many Web pages handle comments using AJAX, consequently downloading raw
HTML along manual ground truth construction is not su cient for building the
dataset. To circumvent this issue we developed two components:
Firefox Extension We implemented a Firefox extension that sends the current</p>
      <p>DOM (after browser-side Javascript processing) to a Web server.
Web Server The server receives the DOM from the browser through a POST
request on a servlet, then runs CommentsLifter and presents an evaluation
form along with the extracted comments. The user is asked to evaluate the
pertinence of the extraction. We distinguish three cases for the result. We
used Jena11 to generate the SIOC output.
5.2</p>
      <sec id="sec-8-1">
        <title>Evaluation</title>
        <p>The results obtained from our evaluation are given in Table 2 and Table 3.
Table 2 presents extraction results of the pattern mining part (steps 1 to 6 of
11 http://jena.apache.org/
the algorithm) whereas Table 3 presents the eld identi cation results (step 7).
The rst six steps of the algorithm present very good results, with a global F1
score over 92%. Concerning eld identi cation we rst present the occurrence of
the di erent elds over our dataset. Username and content are always present,
while the date is not far from being present in every comment. However titles
are to be found in one quarter of the comments. The evaluation accords to the
heuristics we describe in section 4.7. Content extraction is a straightforward task
since it is easy to "measure" di erences with other elds, our algorithm performs
perfectly at this task. Date parsing is no easy task, however our algorithm still
performs well with an identi cation rate of 83.67 %. However we note that while
the rest of the process is language agnostic, date parsing libraries are designed
to work with western languages (English, German, french, spanish, : : :) but may
fail with other languages, especially with non latin alphabet.
6</p>
        <sec id="sec-8-1-1">
          <title>Conclusions and future work</title>
          <p>In this paper, we presented CommentsLifter, an algorithm that extracts users'
comments and outputs SIOC data. Our algorithm combines mining induced
subtrees from the DOM with simple yet robust heuristics to select the pattern
containing the comment as well as identifying several elds within the pattern.
The empirical evaluation presents very good results, for both extraction and
eld identi cation. We successfully extracted comments from various types of
Web sites, without a priori knowledge, such as online newspapers, forum, user
reviews, blogs and we were able to reconstruct the conversations.</p>
          <p>Further research will focus on re ning the category of the extracted container,
in order to determine whether the discussion takes into a forum, Q&amp;A, blog or
review area.</p>
        </sec>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Tatsuya</given-names>
            <surname>Asai</surname>
          </string-name>
          , Kenji Abe, Shinji Kawasoe, Hiroshi Sakamoto, and
          <string-name>
            <given-names>Setsuo</given-names>
            <surname>Arikawa</surname>
          </string-name>
          .
          <article-title>E cient substructure discovery from large semi-structured data</article-title>
          .
          <source>pages 158{174</source>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2. Mark Van Assem,
          <string-name>
            <surname>Maarten R. Menken</surname>
            , Guus Schreiber, Jan Wielemaker, and
            <given-names>Bob</given-names>
          </string-name>
          <string-name>
            <surname>Wielinga</surname>
          </string-name>
          .
          <article-title>A method for converting thesauri to rdf/owl</article-title>
          .
          <source>In Proc. of the 3rd Intl Semantic Web Conf. (ISWC04)</source>
          ,
          <source>number 3298 in Lecture Notes in Computer Science</source>
          , pages
          <volume>17</volume>
          {
          <fpage>31</fpage>
          . Springer-Verlag,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>F.</given-names>
            <surname>Belleau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.A.</given-names>
            <surname>Nolin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Tourigny</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rigault</surname>
          </string-name>
          , and
          <string-name>
            <surname>J. Morissette.</surname>
          </string-name>
          <article-title>Bio2rdf: towards a mashup to build bioinformatics knowledge systems</article-title>
          .
          <source>Journal of biomedical informatics</source>
          ,
          <volume>41</volume>
          (
          <issue>5</issue>
          ):
          <volume>706</volume>
          {
          <fpage>716</fpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Bettina</given-names>
            <surname>Berendt</surname>
          </string-name>
          , Andreas Hotho, and
          <string-name>
            <given-names>Gerd</given-names>
            <surname>Stumme</surname>
          </string-name>
          .
          <article-title>Towards semantic web mining</article-title>
          .
          <source>In Intl Semantic Web Conf. (ISWC02)</source>
          , pages
          <fpage>264</fpage>
          {
          <fpage>278</fpage>
          . Springer,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>J.</given-names>
            <surname>Breslin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Harth</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Bojars</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Decker</surname>
          </string-name>
          .
          <article-title>Towards semantically-interlinked online communities</article-title>
          .
          <source>The Semantic Web: Research and Applications</source>
          , pages
          <volume>71</volume>
          {
          <fpage>83</fpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>D.</given-names>
            <surname>Cai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Yu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.R.</given-names>
            <surname>Wen</surname>
          </string-name>
          , and W.Y. Ma.
          <article-title>Extracting content structure for web pages based on visual representation</article-title>
          .
          <source>In Proc. of the 5th Asia-Paci c conference on Web technologies and applications</source>
          , pages
          <volume>406</volume>
          {
          <fpage>417</fpage>
          . Springer-Verlag,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>C.H.</given-names>
            <surname>Chang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kayed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Girgis</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.F.</given-names>
            <surname>Shaalan</surname>
          </string-name>
          .
          <article-title>A survey of web information extraction systems. Knowledge and Data Engineering</article-title>
          , IEEE Transactions on,
          <volume>18</volume>
          (
          <issue>10</issue>
          ):
          <volume>1411</volume>
          {
          <fpage>1428</fpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Y.</given-names>
            <surname>Chi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.R.</given-names>
            <surname>Muntz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Nijssen</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.N.</given-names>
            <surname>Kok</surname>
          </string-name>
          .
          <article-title>Frequent subtree mining-an overview</article-title>
          .
          <source>Fundamenta Informaticae</source>
          ,
          <volume>66</volume>
          (
          <issue>1-2</issue>
          ):
          <fpage>161</fpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>P.</given-names>
            <surname>Cimiano</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Vo</surname>
          </string-name>
          <article-title>lker</article-title>
          .
          <source>Text2onto. Natural Language Processing and Information Systems</source>
          , pages
          <fpage>257</fpage>
          {
          <fpage>271</fpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>M. Craven</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>DiPasquo</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Freitag</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>McCallum</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          <string-name>
            <surname>Mitchell</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          <string-name>
            <surname>Nigam</surname>
            , and
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Slattery</surname>
          </string-name>
          .
          <article-title>Learning to construct knowledge bases from the world wide web</article-title>
          .
          <source>Arti cial Intelligence</source>
          ,
          <volume>118</volume>
          (
          <issue>1</issue>
          ):
          <volume>69</volume>
          {
          <fpage>113</fpage>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>S.</given-names>
            <surname>Fernandez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Berrueta</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.E.</given-names>
            <surname>Labra</surname>
          </string-name>
          .
          <article-title>Mailing lists meet the semantic web</article-title>
          .
          <source>In Proc. of the Workshop on Social Aspects of the Web</source>
          , Poznan, Poland,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <given-names>A.</given-names>
            <surname>Gentile</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lanfranchi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Mazumdar</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Ciravegna</surname>
          </string-name>
          .
          <article-title>Extracting semantic user networks from informal communication exchanges</article-title>
          .
          <source>The Semantic Web{ISWC</source>
          <year>2011</year>
          , pages
          <fpage>209</fpage>
          {
          <fpage>224</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <given-names>S.</given-names>
            <surname>Hido</surname>
          </string-name>
          and
          <string-name>
            <given-names>H.</given-names>
            <surname>Kawano</surname>
          </string-name>
          .
          <article-title>Amiot: induced ordered tree mining in tree-structured databases</article-title>
          .
          <source>In Data Mining</source>
          , Fifth IEEE International Conference on,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>D.</given-names>
            <surname>Huynh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Mazzocchi</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D.</given-names>
            <surname>Karger</surname>
          </string-name>
          .
          <article-title>Piggy bank: Experience the semantic web inside your web browser</article-title>
          .
          <source>The Semantic Web{ISWC</source>
          <year>2005</year>
          , pages
          <fpage>413</fpage>
          {
          <fpage>430</fpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15. C. Kohlschutter, P. Fankhauser, and
          <string-name>
            <given-names>W.</given-names>
            <surname>Nejdl</surname>
          </string-name>
          .
          <article-title>Boilerplate detection using shallow text features</article-title>
          .
          <source>In Proceedings of the third ACM international conference on Web search and data mining</source>
          , pages
          <volume>441</volume>
          {
          <fpage>450</fpage>
          . ACM,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Kohlschutter and</article-title>
          <string-name>
            <given-names>W.</given-names>
            <surname>Nejdl</surname>
          </string-name>
          .
          <article-title>A densitometric approach to web page segmentation</article-title>
          .
          <source>In Proceeding of the 17th ACM conference on Information and knowledge management</source>
          , pages
          <volume>1173</volume>
          {
          <fpage>1182</fpage>
          . ACM,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <given-names>S.H.</given-names>
            <surname>Lin</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.M.</given-names>
            <surname>Ho</surname>
          </string-name>
          .
          <article-title>Discovering informative content blocks from web documents</article-title>
          .
          <source>In Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining</source>
          , pages
          <volume>588</volume>
          {
          <fpage>593</fpage>
          . ACM,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18. B.
          <string-name>
            <surname>Liu</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Grossman</surname>
            , and
            <given-names>Y.</given-names>
          </string-name>
          <string-name>
            <surname>Zhai</surname>
          </string-name>
          .
          <article-title>Mining data records in web pages</article-title>
          .
          <source>In Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and data mining</source>
          , pages
          <volume>601</volume>
          {
          <fpage>606</fpage>
          . ACM,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <given-names>A.</given-names>
            <surname>Maedche</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Staab</surname>
          </string-name>
          .
          <article-title>Ontology learning for the semantic web</article-title>
          .
          <source>Intelligent Systems</source>
          , IEEE,
          <volume>16</volume>
          (
          <issue>2</issue>
          ):
          <volume>72</volume>
          {
          <fpage>79</fpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>D.D.C. Reis</surname>
            ,
            <given-names>P.B.</given-names>
          </string-name>
          <string-name>
            <surname>Golgher</surname>
            ,
            <given-names>A.S.</given-names>
          </string-name>
          <string-name>
            <surname>Silva</surname>
            , and
            <given-names>AF</given-names>
          </string-name>
          <string-name>
            <surname>Laender</surname>
          </string-name>
          .
          <article-title>Automatic web news extraction using tree edit distance</article-title>
          .
          <source>In Proceedings of the 13th international conference on World Wide Web</source>
          , pages
          <volume>502</volume>
          {
          <fpage>511</fpage>
          . ACM,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <given-names>F.</given-names>
            <surname>Sun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Song</surname>
          </string-name>
          , and
          <string-name>
            <given-names>L.</given-names>
            <surname>Liao</surname>
          </string-name>
          .
          <article-title>Dom based content extraction via text density</article-title>
          .
          <source>In Proceedings of the 34th international ACM SIGIR conference on Research and development in Information</source>
          , pages
          <volume>245</volume>
          {
          <fpage>254</fpage>
          . ACM,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <given-names>A.</given-names>
            <surname>Yates</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Cafarella</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Banko</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Etzioni</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Broadhead</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Soderland</surname>
          </string-name>
          .
          <article-title>Textrunner: open information extraction on the web</article-title>
          .
          <source>In Proceedings of Human Language Technologies</source>
          , pages
          <volume>25</volume>
          {
          <fpage>26</fpage>
          .
          <string-name>
            <surname>ACL</surname>
          </string-name>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23.
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhai</surname>
          </string-name>
          and
          <string-name>
            <given-names>B.</given-names>
            <surname>Liu</surname>
          </string-name>
          .
          <article-title>Web data extraction based on partial tree alignment</article-title>
          .
          <source>In Proceedings of the 14th international conference on World Wide Web</source>
          , pages
          <volume>76</volume>
          {
          <fpage>85</fpage>
          . ACM,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>