Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
json
Sub-tasks:
sentiment-classification
Languages:
Russian
Size:
10K - 100K
License:
import datasets | |
import pandas as pd | |
class KinopoiskReviewsConfig(datasets.BuilderConfig): | |
def __init__(self, **kwargs): | |
super(KinopoiskReviewsConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs) | |
class Kinopoisk(datasets.GeneratorBasedBuilder): | |
BUILDER_CONFIGS = [ | |
KinopoiskReviewsConfig( | |
name="plain_text", | |
description="Plain text", | |
) | |
] | |
def _info(self): | |
return datasets.DatasetInfo( | |
description='Kinopoisk movie reviews dataset.', | |
features=datasets.Features( | |
{ | |
"content": datasets.Value("string"), | |
"title": datasets.Value("string"), | |
"grade3": datasets.Value("string"), | |
"movie_name": datasets.Value("string"), | |
"part": datasets.Value("string"), | |
"review_id": datasets.Value("string"), | |
"author": datasets.Value("string"), | |
"date":datasets.Value("string") | |
} | |
), | |
supervised_keys=None, | |
homepage='', | |
citation='', | |
) | |
def _generate_examples(self, filepath): | |
df = pd.read_json(filepath, lines=True) | |
rows = df.to_dict(orient="records") | |
for n, row in enumerate(rows): | |
example = row | |
example["Idx"] = n | |
yield example["Idx"], example | |