Init
Browse files- .gitattributes +1 -0
- README.md +70 -0
- ru_stackoverflow.jsonl.zst +3 -0
- ru_stackoverflow.py +109 -0
.gitattributes
CHANGED
@@ -52,3 +52,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
+
ru_stackoverflow.jsonl.zst filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,73 @@
|
|
1 |
---
|
2 |
license: other
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
1 |
---
|
2 |
license: other
|
3 |
+
dataset_info:
|
4 |
+
features:
|
5 |
+
- name: question_id
|
6 |
+
dtype: uint32
|
7 |
+
- name: url
|
8 |
+
dtype: string
|
9 |
+
- name: answer_count
|
10 |
+
dtype: uint32
|
11 |
+
- name: text_html
|
12 |
+
dtype: string
|
13 |
+
- name: text_markdown
|
14 |
+
dtype: string
|
15 |
+
- name: score
|
16 |
+
dtype: int32
|
17 |
+
- name: title
|
18 |
+
dtype: string
|
19 |
+
- name: tags
|
20 |
+
sequence: string
|
21 |
+
- name: views
|
22 |
+
dtype: uint64
|
23 |
+
- name: author
|
24 |
+
dtype: string
|
25 |
+
- name: timestamp
|
26 |
+
dtype: uint64
|
27 |
+
- name: comments
|
28 |
+
sequence:
|
29 |
+
- name: text
|
30 |
+
dtype: string
|
31 |
+
- name: author
|
32 |
+
dtype: string
|
33 |
+
- name: comment_id
|
34 |
+
dtype: uint32
|
35 |
+
- name: score
|
36 |
+
dtype: int32
|
37 |
+
- name: timestamp
|
38 |
+
dtype: uint64
|
39 |
+
- name: answers
|
40 |
+
sequence:
|
41 |
+
- name: answer_id
|
42 |
+
dtype: uint32
|
43 |
+
- name: is_accepted
|
44 |
+
dtype: uint8
|
45 |
+
- name: text_html
|
46 |
+
dtype: string
|
47 |
+
- name: text_markdown
|
48 |
+
dtype: string
|
49 |
+
- name: score
|
50 |
+
dtype: int32
|
51 |
+
- name: author
|
52 |
+
dtype: string
|
53 |
+
- name: timestamp
|
54 |
+
dtype: uint64
|
55 |
+
- name: comments
|
56 |
+
sequence:
|
57 |
+
- name: text
|
58 |
+
dtype: string
|
59 |
+
- name: author
|
60 |
+
dtype: string
|
61 |
+
- name: comment_id
|
62 |
+
dtype: uint32
|
63 |
+
- name: score
|
64 |
+
dtype: int32
|
65 |
+
- name: timestamp
|
66 |
+
dtype: uint64
|
67 |
+
splits:
|
68 |
+
- name: train
|
69 |
+
num_bytes: 3013377174
|
70 |
+
num_examples: 437604
|
71 |
+
download_size: 670468664
|
72 |
+
dataset_size: 3013377174
|
73 |
---
|
ru_stackoverflow.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3f6eda2b3df7de1d3cc4a45ce2e69bb1e439b7736cd8d81e911129bd512dab9
|
3 |
+
size 670468664
|
ru_stackoverflow.py
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 The HuggingFace Datasets Authors and Ilya Gusev
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Russian StackOverflow dataset"""
|
18 |
+
|
19 |
+
import os
|
20 |
+
import io
|
21 |
+
|
22 |
+
import zstandard
|
23 |
+
import jsonlines
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
try:
|
27 |
+
import simdjson
|
28 |
+
parser = simdjson.Parser()
|
29 |
+
def parse_json(x):
|
30 |
+
try:
|
31 |
+
return parser.parse(x).as_dict()
|
32 |
+
except ValueError:
|
33 |
+
return
|
34 |
+
except ImportError:
|
35 |
+
import json
|
36 |
+
def parse_json(x):
|
37 |
+
return json.loads(x)
|
38 |
+
|
39 |
+
|
40 |
+
_DESCRIPTION = "Russian StackOverflow dataset"
|
41 |
+
_URL = "ru_stackoverflow.jsonl.zst"
|
42 |
+
|
43 |
+
|
44 |
+
class RuStackOverflowDataset(datasets.GeneratorBasedBuilder):
|
45 |
+
VERSION = datasets.Version("0.0.1")
|
46 |
+
|
47 |
+
BUILDER_CONFIGS = [
|
48 |
+
datasets.BuilderConfig(name="default", version=VERSION, description=""),
|
49 |
+
]
|
50 |
+
|
51 |
+
DEFAULT_CONFIG_NAME = "default"
|
52 |
+
|
53 |
+
def _info(self):
|
54 |
+
features = datasets.Features(
|
55 |
+
{
|
56 |
+
"question_id": datasets.Value("uint32"),
|
57 |
+
"url": datasets.Value("string"),
|
58 |
+
"answer_count": datasets.Value("uint32"),
|
59 |
+
"text_html": datasets.Value("string"),
|
60 |
+
"text_markdown": datasets.Value("string"),
|
61 |
+
"score": datasets.Value("int32"),
|
62 |
+
"title": datasets.Value("string"),
|
63 |
+
"tags": datasets.Sequence(datasets.Value("string")),
|
64 |
+
"views": datasets.Value("uint64"),
|
65 |
+
"author": datasets.Value("string"),
|
66 |
+
"timestamp": datasets.Value("uint64"),
|
67 |
+
"comments": datasets.Sequence(feature={
|
68 |
+
"text": datasets.Value("string"),
|
69 |
+
"author": datasets.Value("string"),
|
70 |
+
"comment_id": datasets.Value("uint32"),
|
71 |
+
"score": datasets.Value("int32"),
|
72 |
+
"timestamp": datasets.Value("uint64")
|
73 |
+
}),
|
74 |
+
"answers": datasets.Sequence(feature={
|
75 |
+
"answer_id": datasets.Value("uint32"),
|
76 |
+
"is_accepted": datasets.Value("uint8"),
|
77 |
+
"text_html": datasets.Value("string"),
|
78 |
+
"text_markdown": datasets.Value("string"),
|
79 |
+
"score": datasets.Value("int32"),
|
80 |
+
"author": datasets.Value("string"),
|
81 |
+
"timestamp": datasets.Value("uint64"),
|
82 |
+
"comments": datasets.Sequence(feature={
|
83 |
+
"text": datasets.Value("string"),
|
84 |
+
"author": datasets.Value("string"),
|
85 |
+
"comment_id": datasets.Value("uint32"),
|
86 |
+
"score": datasets.Value("int32"),
|
87 |
+
"timestamp": datasets.Value("uint64")
|
88 |
+
})
|
89 |
+
})
|
90 |
+
}
|
91 |
+
)
|
92 |
+
return datasets.DatasetInfo(
|
93 |
+
description=_DESCRIPTION,
|
94 |
+
features=features
|
95 |
+
)
|
96 |
+
|
97 |
+
def _split_generators(self, dl_manager):
|
98 |
+
downloaded_file = dl_manager.download(_URL)
|
99 |
+
return [
|
100 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"path": downloaded_file}),
|
101 |
+
]
|
102 |
+
|
103 |
+
def _generate_examples(self, path):
|
104 |
+
with open(path, "rb") as f:
|
105 |
+
cctx = zstandard.ZstdDecompressor()
|
106 |
+
reader_stream = io.BufferedReader(cctx.stream_reader(f))
|
107 |
+
reader = jsonlines.Reader(reader_stream, loads=parse_json)
|
108 |
+
for id_, item in enumerate(reader):
|
109 |
+
yield id_, item
|