system HF staff commited on
Commit
0814f9c
1 Parent(s): 6b6d3ab

Update files from the datasets library (from 1.7.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.7.0

Files changed (2) hide show
  1. README.md +4 -3
  2. senti_ws.py +3 -3
README.md CHANGED
@@ -20,6 +20,7 @@ task_categories:
20
  task_ids:
21
  - sentiment-scoring
22
  - structure-prediction-other-pos-tagging
 
23
  ---
24
 
25
  # Dataset Card for SentiWS
@@ -27,12 +28,12 @@ task_ids:
27
  ## Table of Contents
28
  - [Dataset Description](#dataset-description)
29
  - [Dataset Summary](#dataset-summary)
30
- - [Supported Tasks](#supported-tasks-and-leaderboards)
31
  - [Languages](#languages)
32
  - [Dataset Structure](#dataset-structure)
33
  - [Data Instances](#data-instances)
34
- - [Data Fields](#data-instances)
35
- - [Data Splits](#data-instances)
36
  - [Dataset Creation](#dataset-creation)
37
  - [Curation Rationale](#curation-rationale)
38
  - [Source Data](#source-data)
20
  task_ids:
21
  - sentiment-scoring
22
  - structure-prediction-other-pos-tagging
23
+ paperswithcode_id: null
24
  ---
25
 
26
  # Dataset Card for SentiWS
28
  ## Table of Contents
29
  - [Dataset Description](#dataset-description)
30
  - [Dataset Summary](#dataset-summary)
31
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
32
  - [Languages](#languages)
33
  - [Dataset Structure](#dataset-structure)
34
  - [Data Instances](#data-instances)
35
+ - [Data Fields](#data-fields)
36
+ - [Data Splits](#data-splits)
37
  - [Dataset Creation](#dataset-creation)
38
  - [Curation Rationale](#curation-rationale)
39
  - [Source Data](#source-data)
senti_ws.py CHANGED
@@ -120,13 +120,13 @@ class SentiWS(datasets.GeneratorBasedBuilder):
120
  # TODO: This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
121
  # It is in charge of opening the given file and yielding (key, example) tuples from the dataset
122
  # The key is not important, it's more here for legacy reason (legacy from tfds)
123
- for filepath in sourcefiles:
124
  with open(filepath, encoding="utf-8") as f:
125
  for id_, row in enumerate(f):
126
  word = row.split("|")[0]
127
  if self.config.name == "pos-tagging":
128
  tag = row.split("|")[1].split("\t")[0]
129
- yield id_, {"word": word, "pos-tag": tag}
130
  else:
131
  sentiscore = row.split("|")[1].split("\t")[1]
132
- yield id_, {"word": word, "sentiment-score": float(sentiscore)}
120
  # TODO: This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
121
  # It is in charge of opening the given file and yielding (key, example) tuples from the dataset
122
  # The key is not important, it's more here for legacy reason (legacy from tfds)
123
+ for file_idx, filepath in enumerate(sourcefiles):
124
  with open(filepath, encoding="utf-8") as f:
125
  for id_, row in enumerate(f):
126
  word = row.split("|")[0]
127
  if self.config.name == "pos-tagging":
128
  tag = row.split("|")[1].split("\t")[0]
129
+ yield f"{file_idx}_{id_}", {"word": word, "pos-tag": tag}
130
  else:
131
  sentiscore = row.split("|")[1].split("\t")[1]
132
+ yield f"{file_idx}_{id_}", {"word": word, "sentiment-score": float(sentiscore)}