https://archive.org/download/stackexchange、特にダンプのPosts.xml
ファイルから質問/回答のペアを抽出したいとします(Anime
ダンプをかなりランダムに選択しました。上)。このファイルがどのようにレイアウトされているかについて私の理解は、1
という質問(質問、タイトル、および他のメタデータの本文を含む)と回答の2
の2種類があります(スコア、答えの本文を含みます、およびその他のメタデータ)。XMLスタックエクスチェンジダンプからQ&Aペアを抽出する
PostTypeId="1"
内部この行があることを示している
<row Id="8" PostTypeId="2" ParentId="1" CreationDate="2012-12-11T20:47:52.167" Score="60" Body="<p>No, there is a reason why they can't. </p>

<p>Basically the <a href="http://onepiece.wikia.com/wiki/New_World">New World</a> is beyond the <a href="http://onepiece.wikia.com/wiki/Red_Line">Red Line</a>, but you cannot "walk" on it, or cross it. It's a huge continent, very tall that you cannot go through. You can't cross the <a href="http://onepiece.wikia.com/wiki/Calm_Belt">Calm Belt</a> either, unless you have some form of locomotion such as the Navy or <a href="http://onepiece.wikia.com/wiki/Boa_Hancock">Boa Hancock</a>.</p>

<p>So the only way is to start from one of the Four Seas, then to go the <a href="http://onepiece.wikia.com/wiki/Reverse_Mountain">Reverse Mountain</a> and follow the Grand Line until you reach <em><a href="http://onepiece.wikia.com/wiki/Raftel">Raftel</a></em>, which supposedly is where One Piece is located.</p>

<p><img src="http://i.stack.imgur.com/69IZ0.png" alt="enter image description here"></p>
" OwnerUserId="15" LastEditorUserId="1528" LastEditDate="2013-05-06T19:21:04.703" LastActivityDate="2013-05-06T19:21:04.703" CommentCount="1" />
:
データを容易に十分に、我々は、そのような
<row Id="1" PostTypeId="1" AcceptedAnswerId="8" CreationDate="2012-12-11T20:37:08.823" Score="69" ViewCount="22384" Body="<p>Assuming the world in the One Piece universe is round, then there is not really a beginning or an end of the Grand Line.</p>

<p>The Straw Hats started out from the first half and are now sailing across the second half.</p>

<p>Wouldn't it have been quicker to set sail in the opposite direction from where they started? </p>
" OwnerUserId="21" LastEditorUserId="1398" LastEditDate="2015-04-17T19:06:38.957" LastActivityDate="2015-05-26T12:50:40.920" Title="The treasure in One Piece is at the end of the Grand Line. But isn't that the same as the beginning?" Tags="<one-piece>" AnswerCount="5" CommentCount="0" FavoriteCount="2" />
としてエントリを持っている場合、ここで対応する回答は次のようになりに関し質問AcceptedAnswerId="8"
は回答のId
を示します。そして、2番目のxmlスニペットでは、質問であるAcceptedAnswerId
であるId="8"
と、これが回答であることを示すPostTypeId="2"
と、Id
であるParentId
があります。
ここで、このデータを質問/回答のペアで簡単にポーリングできます。理想的には、これを私がこれらの種類のデータ構造に精通しているSQLite3またはMysqlデータベースに変換できると便利です。それが可能でない場合(データベース関数自体を介して、またはデータベースを移植するためのスクリプト化されたラッパーを介して)、Ruby
でこのデータを解析すると、title
とbody
の質問を抽出するXML文書全体を調べることができます適切なanswer
ボディとペアにします。
お時間をいただきありがとうございます。
ありがとうございました。私はすべてのデータダンプのQ&Aペアとプロジェクトのための他のデータを掻きたいので、私はインターフェイスをオンラインで探していません。これには、自分自身がダンプからデータを取り出し、私が説明したように簡単にアクセスできるように格納する方法が必要です。私はそれをDBにインポートしようとします。再度、感謝します。 –