---
dataset_info:
- config_name: default
  features:
  - name: question
    struct:
    - name: accepted_answer_id
      dtype: string
    - name: answer_count
      dtype: int64
    - name: body
      dtype: string
    - name: comment_count
      dtype: int64
    - name: content_license
      dtype: string
    - name: creation_date
      dtype: string
    - name: favorite_count
      dtype: int64
    - name: id
      dtype: string
    - name: last_activity_date
      dtype: string
    - name: last_edit_date
      dtype: string
    - name: last_editor_user_id
      dtype: string
    - name: owner_user_id
      dtype: string
    - name: post_type
      dtype: string
    - name: score
      dtype: int64
    - name: tags
      sequence: string
    - name: title
      dtype: string
    - name: view_count
      dtype: int64
  - name: answers
    list:
    - name: body
      dtype: string
    - name: comment_count
      dtype: int64
    - name: content_license
      dtype: string
    - name: creation_date
      dtype: string
    - name: id
      dtype: string
    - name: last_activity_date
      dtype: string
    - name: last_edit_date
      dtype: string
    - name: last_editor_user_id
      dtype: string
    - name: owner_user_id
      dtype: string
    - name: parent_id
      dtype: string
    - name: post_type
      dtype: string
    - name: score
      dtype: int64
  - name: id
    dtype: string
  - name: accepted_answer_id
    dtype: string
  - name: popular_answer_id
    dtype: string
  splits:
  - name: train
    num_bytes: 112596554
    num_examples: 30551
  download_size: 54805530
  dataset_size: 112596554
- config_name: simple
  features:
  - name: id
    dtype: string
  - name: accepted_answer_id
    dtype: string
  - name: popular_answer_id
    dtype: string
  - name: title
    dtype: string
  - name: question_body
    dtype: string
  - name: question_score
    dtype: int64
  - name: accepted_answer_body
    dtype: string
  - name: accepted_answer_score
    dtype: int64
  - name: popular_answer_body
    dtype: string
  - name: popular_answer_score
    dtype: int64
  - name: tags
    sequence: string
  splits:
  - name: train
    num_bytes: 113051344
    num_examples: 30551
  download_size: 56632072
  dataset_size: 113051344
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
- config_name: simple
  data_files:
  - split: train
    path: simple/train-*
license: cc-by-sa-4.0
task_categories:
- text-generation
- question-answering
language:
- ja
tags:
- stackoverflow
- programming
pretty_name: Japanese StackOverflow
size_categories:
- 10K<n<100K
---

# ja-stackoverflow

日本語版 Stack Overflow の [スタック・オーバーフロー](https://ja.stackoverflow.com/) の[データダンプ](https://archive.org/download/stackexchange) をもとにデータを加工し、質問文と回答文のペアになるように調整した QA データセット。

## データ構造

投稿本文は `html2text` を使ってマークダウン化されています。その際、

- コードブロックは \`\`\` で囲まれるように変更されています。
- 画像 URL に base64 エンコードされた画像が含まれる場合、 `[unk]` に置き換えています。

### `default` サブセット

- `id`: 質問投稿の ID
- `question`: 質問投稿
- `answers`: 質問に対する回答投稿のリスト
- `accepted_answer_id`: 質問者に選ばれた回答のID。`null` の可能性がある
- `popular_answer_id`: もっともスコアが高かった回答のID。`null` の可能性がある


### `simple` サブセット 

`default` サブセットから、 `question` と `answers` の辞書を展開しシンプルにしたもの。

- `id`: 質問投稿の ID
- `accepted_answer_id`: 質問者に選ばれた回答のID。`null` の可能性がある
- `popular_answer_id`: もっともスコアが高かった回答のID。`null` の可能性がある
- `title`: 質問のタイトル
- `question_body`: 質問本文
- `question_score`: 質問のスコア
- `tags`: 質問に関連付けられたタグ
- `accepted_answer_body`: 質問者に選ばれた回答の本文。`null` の可能性がある
- `accepted_answer_score`: 質問者に選ばれた回答のスコア。`null` の可能性がある
- `popular_answer_body`: もっともスコアが高かった回答の本文。`null` の可能性がある
- `popular_answer_score`: もっともスコアが高かった回答のスコア。`null` の可能性がある

## 使い方

datasets ライブラリを用いて簡単に利用できます。

```py
from datasets import load_dataset

dataset = load_dataset("p1atdev/ja-stackoverflow", name="simple" split="train")

print(dataset)
#Dataset({
#    features: ['id', 'accepted_answer_id', 'popular_answer_id', 'title', 'question_body', 'question_score', 'accepted_answer_body', 'accepted_answer_score', 'popular_answer_body', 'popular_answer_score', 'tags'],
#    num_rows: 30551
#})
```



## ライセンス

StackOverflow に基づき、[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/deed.ja)