<!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>Towards Building Open Knowledge Base From Programming Question-Answering Communities</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Wei Emma Zhang</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ermyas Abebe</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Quan Z. Sheng</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Kerry Taylor</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>IBM Research Australia</institution>
          ,
          <country country="AU">Australia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Research School of Computer Science, Australian National University</institution>
          ,
          <country country="AU">Australia</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>School of Computer Science, The University of Adelaide</institution>
          ,
          <country country="AU">Australia</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this paper, we propose the rst system, so-called Open Programming Knowledge Extraction (OPKE), to automatically extract knowledge from programming Question-Answering (QA) communities. OPKE is the rst step of building a programming-centric knowledge base. Data mining and Natural Language Processing techniques are leveraged to identify duplicate questions and construct structured information. Preliminary evaluation shows the e ectiveness of OPKE.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>lead to high computation cost. Instead, we propose to use features of posts
themselves to identify the duplicates. Speci cally, we transform every post title to a
numerical vector and perform clustering on a set of vectors. Then we consider
the posts that are closest to a master post (i.e., the original post) as the
duplicate posts. After identifying and removing duplicate posts, we extract the key
information from master posts and rewrite them to the \question" component
of knowledge triples. This can be done by using NLP techniques. Finally, triples
are constructed by given question and answer, as well as the tags.
2</p>
      <p>Building Programming Knowledge Base
The input of OPKE is the post contents of programming QA communities and
the output is a set of triples. Figure 1 illustrates the extraction process which
contains three main steps: Preprocessing, Question-answer Extraction and Triple
Generation described as following.</p>
      <sec id="sec-1-1">
        <title>Preprocessing</title>
        <p>• Extract web page
contents
• Prune invalid posts
• Obtain language
specific tag</p>
      </sec>
      <sec id="sec-1-2">
        <title>Question-Answer</title>
      </sec>
      <sec id="sec-1-3">
        <title>Extraction</title>
        <p>• Identify
paraphrased
questions
• Select answer</p>
      </sec>
      <sec id="sec-1-4">
        <title>Triple</title>
        <p>Generation
• Form triples
with questions
and answers
&lt;Q1; A1; “java”,”casting”,..&gt;
&lt;Q2; A2; “java”,’’string”,..&gt;
&lt;Q3; A3; “java”,..&gt;
…
In the preprocessing step, OPKE parses the post content of the target
programming community and extracts all the questions and answers. Invalid posts which
have no accepted answers are pruned. For SO, post contents can be retrieved
through Stack Exchange API2. The accepted answer and tags can be obtained
by considering two parameters `AcceptedAnswerId ' and `Tags' respectively.
2 https://api.stackexchange.com/</p>
        <p>
          Building Programming Community Knowledge Base
{ Parse master questions. We parse the master questions and rewrite it to
capture the meaning of the questions. Our method is inspired by Open IE
work [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], where dependency parsing has been applied to detect query
meaning. We discuss OPKE parsing process using an example question \Java
How do I convert from int to String?": i) remove language speci c words if
exist (e.g. Java), ii) parse dependencies of questions (using method in [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ],
see Figure 2(a)), iii) identify subject (I ), if subject is rst person pronoun,
then parse object part under the root in following steps (see the circled
part in Figure 2(a)), iv) identify root action (covert ), v) identify
relationship (hconvert; f romint; tostringi) and vi) rewrite question (\convert int to
string"). For more details, please refer to [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ].
        </p>
        <p>convert
How
do</p>
        <p>I
from
p
o
b
j
int
to
p
o
b
j
string</p>
        <p>Final Triple for “Java - How do I convert int to string”:
&lt;“convert int to string”;
“Normal ways would be Integer.toString(i) or String.valueOf(i)…….”;
“java”&gt;
(a) Dependency Parse Tree
(b) Generated Tuple</p>
        <p>OPKE simply uses the accepted answer as the nal answer for a post.
Although it might not be the best solution with highest votes, we believe that the
questioner has the judgment on the solutions.
After obtaining the questions and answers from previous steps, OPKE
generate triples with the format of h\question"; \answer"; \tag1",\tag2",...i where
question and answers are obtained from Section 2.2 and tags are obtained from
Section 2.1. So for the example question, the triple is depicted as in Figure 2(b).
3</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Experiment</title>
      <p>The performance of OPKE system has been evaluated by performing extraction
on Stack Over ow dump datasets3 (the version is 2016-06-13). We choose valid
posts with non-empty titles and have accepted answers as the master posts.
We obtain the duplicate and linked posts of these master posts. These result in
3 https://archive.org/details/stackexchange
339,990 posts in total. We de ne the evaluation metrics, clustering recall, as the
number of correctly labeled posts (i.e., duplicate or not) divided by the total
posts. Figure 3 reports the clustering recall rate on di erent number of clusters
for duplicate and linked questions. Duplicate has higher recall rate than linked
ones because linked posts do not always represent the same meaning with the
master questions. When the cluster number is the 1/2000 of the total number
of posts, the recall rate achieves the best.</p>
      <p>40
10
36% 36%
38%
34%</p>
      <p>Conclusion and Future Works
In this work, we discuss our attempt to extract structured information from
programming QA communities. The method, which combines data mining and
NLP techniques, can also be applied to other QA communities. In the future, we
will develop more ne-grained methods to identify paraphrased questions and
consider the evolvement of programming language/tools. A programming-centric
knowledge base and corresponding QA system will be built.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>M.</given-names>
            <surname>Ahasanuzzaman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Asaduzzaman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. K.</given-names>
            <surname>Roy</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K. A.</given-names>
            <surname>Schneider</surname>
          </string-name>
          .
          <article-title>Mining Duplicate Questions in Stack Over ow</article-title>
          .
          <source>In Proc. of MSR</source>
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Q. V.</given-names>
            <surname>Le</surname>
          </string-name>
          and
          <string-name>
            <given-names>T.</given-names>
            <surname>Mikolov</surname>
          </string-name>
          .
          <article-title>Distributed Representations of Sentences and Documents</article-title>
          .
          <source>In Proc. of ICML</source>
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>M.-C. D. Marne</surname>
            e, B. MacCartney, and
            <given-names>C. D.</given-names>
          </string-name>
          <string-name>
            <surname>Manning</surname>
          </string-name>
          .
          <article-title>Generating Typed Dependency Parses From Phrase Structure Parses</article-title>
          .
          <source>In Proc. of LREC</source>
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>S.</given-names>
            <surname>Nam</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Hahm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Nam</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Choi</surname>
          </string-name>
          .
          <article-title>SRDF: korean open information extraction using singleton property</article-title>
          .
          <source>In Proc. of ISWC</source>
          <year>2015</year>
          (
          <article-title>Posters &amp; Demonstrations Track)</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>D.</given-names>
            <surname>Sculley</surname>
          </string-name>
          .
          <string-name>
            <surname>Web-Scale K-Means Clustering</surname>
          </string-name>
          .
          <source>In Proc. of WWW</source>
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>P.</given-names>
            <surname>Yin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Duan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Kao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Bao</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Zhou</surname>
          </string-name>
          .
          <article-title>Answering Questions with Complex Semantic Constraints on Open Knowledge Bases</article-title>
          .
          <source>In Proc. of CIKM</source>
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>