File size: 5,135 Bytes
5166ea5
 
6aaa5a7
5166ea5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6aaa5a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5166ea5
 
 
 
 
6aaa5a7
 
 
 
a4ee478
 
 
 
 
 
 
 
 
 
 
 
5166ea5
 
f8a3f33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f1cbe26
f8a3f33
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
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)