Hugo Abonizio commited on
Commit ·
fda4f25
1
Parent(s): 5664973
Initial commit
Browse filesFiles changed (4)
- .gitattributes+1
- sst2_pt.pyAdded+65
- train.csvAdded+3
- validation.csvAdded+3
51 unmodified lines52535451 unmodified lines*.jpg filter=lfs diff=lfs merge=lfs -text*.jpeg filter=lfs diff=lfs merge=lfs -text*.webp filter=lfs diff=lfs merge=lfs -text51 unmodified lines5253545551 unmodified lines*.jpg filter=lfs diff=lfs merge=lfs -text*.jpeg filter=lfs diff=lfs merge=lfs -text*.webp filter=lfs diff=lfs merge=lfs -text*.csv filter=lfs diff=lfs merge=lfs -text
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465"""IMDB movie reviews dataset translated to Portuguese."""
import csv
import datasetsfrom datasets.tasks import TextClassification
_DESCRIPTION = """\The Stanford Sentiment Treebank consists of sentences from movie reviews andhuman annotations of their sentiment. The task is to predict the sentiment of agiven sentence. We use the two-way (positive/negative) class split, and use onlysentence-level labels."""
_CITATION = """\@inproceedings{socher2013recursive, title={Recursive deep models for semantic compositionality over a sentiment treebank}, author={Socher, Richard and Perelygin, Alex and Wu, Jean and Chuang, Jason and Manning, Christopher D and Ng, Andrew and Potts, Christopher}, booktitle={Proceedings of the 2013 conference on empirical methods in natural language processing}, pages={1631--1642}, year={2013}}"""
_HOMEPAGE = "https://nlp.stanford.edu/sentiment/"
_DOWNLOAD_URL = "https://huggingface.co/datasets/maritaca-ai/sst2_pt/resolve/main"
class Imdb(datasets.GeneratorBasedBuilder): """The Stanford Sentiment Treebank to Portuguese."""
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( {"text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["negativo", "positivo"])} ), supervised_keys=None, homepage=_HOMEPAGE, citation=_CITATION, task_templates=[TextClassification(text_column="text", label_column="label")], )
def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(f"{_DOWNLOAD_URL}/train.csv") test_path = dl_manager.download_and_extract(f"{_DOWNLOAD_URL}/test.csv") return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path, "split": "train"} ), datasets.SplitGenerator( name=datasets.Split.TEST, gen_kwargs={"filepath": test_path, "split": "test"} ), ]
def _generate_examples(self, filepath, split): with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.reader( csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True ) for row in csv_reader: if id_ == 0: continue idx, text, label = row yield idx, {"text": text, "label": label}123version https://git-lfs.github.com/spec/v1oid sha256:71cced99a8182ce47e314b20eb91b843ca24b95fa0b96aa723a59f4778c7cbafsize 4406612123version https://git-lfs.github.com/spec/v1oid sha256:30b859576d8f5e60283669869344c7ee1db64ccec80b28dd76abbd246c727b91size 103379.gitattributes+1
sst2_pt.pyAdded+65
train.csvAdded+3
validation.csvAdded+3