init
Browse files- tweet_temporal_shift.py +26 -26
tweet_temporal_shift.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
import json
|
3 |
import datasets
|
4 |
|
5 |
-
_VERSION = "0.0.
|
6 |
_TWEET_TEMPORAL_DESCRIPTION = """"""
|
7 |
_TWEET_TEMPORAL_CITATION = """"""
|
8 |
_TWEET_TOPIC_DESCRIPTION = """
|
@@ -117,13 +117,13 @@ class TweetTemporalShift(datasets.GeneratorBasedBuilder):
|
|
117 |
features=["text", "gold_label_list", "date"],
|
118 |
data_url=f"{_ROOT_URL}/tweet_topic",
|
119 |
),
|
120 |
-
TweetTemporalShiftConfig(
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
),
|
127 |
TweetTemporalShiftConfig(
|
128 |
name="nerd_temporal",
|
129 |
description=_TWEET_NERD_DESCRIPTION,
|
@@ -142,13 +142,13 @@ class TweetTemporalShift(datasets.GeneratorBasedBuilder):
|
|
142 |
features=["text", "gold_label_list", "date"],
|
143 |
data_url=f"{_ROOT_URL}/tweet_topic_test{i}_seed{s}",
|
144 |
),
|
145 |
-
TweetTemporalShiftConfig(
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
),
|
152 |
TweetTemporalShiftConfig(
|
153 |
name=f"nerd_random{i}_seed{s}",
|
154 |
description=_TWEET_NERD_DESCRIPTION,
|
@@ -160,7 +160,7 @@ class TweetTemporalShift(datasets.GeneratorBasedBuilder):
|
|
160 |
|
161 |
def _info(self):
|
162 |
features = {feature: datasets.Value("string") for feature in self.config.features}
|
163 |
-
if "
|
164 |
names = [
|
165 |
"arts_&_culture", "business_&_entrepreneurs", "celebrity_&_pop_culture", "diaries_&_daily_life",
|
166 |
"family", "fashion_&_style", "film_tv_&_video", "fitness_&_health", "food_&_dining", "gaming",
|
@@ -168,16 +168,7 @@ class TweetTemporalShift(datasets.GeneratorBasedBuilder):
|
|
168 |
"science_&_technology", "sports", "travel_&_adventure", "youth_&_student_life"]
|
169 |
features["gold_label_list"] = datasets.Sequence(
|
170 |
datasets.features.ClassLabel(names=names))
|
171 |
-
|
172 |
-
names = [
|
173 |
-
"B-corporation", "B-creative_work", "B-event", "B-group", "B-location", "B-person", "B-product",
|
174 |
-
"I-corporation", "I-creative_work", "I-event", "I-group", "I-location", "I-person", "I-product", "O"]
|
175 |
-
features["gold_label_sequence"] = datasets.Sequence(
|
176 |
-
datasets.features.ClassLabel(names=names))
|
177 |
-
features["text_tokenized"] = datasets.Sequence(
|
178 |
-
datasets.Value("string"))
|
179 |
-
features["entities"] = datasets.features.Sequence({"entity": datasets.Value("string"), "type": datasets.Value("string")})
|
180 |
-
if "nerd_" in self.config.name:
|
181 |
features["target"] = datasets.Value("string")
|
182 |
features["text"] = datasets.Value("string")
|
183 |
features["definition"] = datasets.Value("string")
|
@@ -185,6 +176,15 @@ class TweetTemporalShift(datasets.GeneratorBasedBuilder):
|
|
185 |
features["text_end"] = datasets.Value("int32")
|
186 |
features["gold_label_binary"] = datasets.Value("int32")
|
187 |
features["date"] = datasets.Value("string")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
return datasets.DatasetInfo(
|
189 |
description=_TWEET_TEMPORAL_DESCRIPTION + "\n" + self.config.description,
|
190 |
features=datasets.Features(features),
|
|
|
2 |
import json
|
3 |
import datasets
|
4 |
|
5 |
+
_VERSION = "0.0.2"
|
6 |
_TWEET_TEMPORAL_DESCRIPTION = """"""
|
7 |
_TWEET_TEMPORAL_CITATION = """"""
|
8 |
_TWEET_TOPIC_DESCRIPTION = """
|
|
|
117 |
features=["text", "gold_label_list", "date"],
|
118 |
data_url=f"{_ROOT_URL}/tweet_topic",
|
119 |
),
|
120 |
+
# TweetTemporalShiftConfig(
|
121 |
+
# name="ner_temporal",
|
122 |
+
# description=_TWEET_NER7_DESCRIPTION,
|
123 |
+
# citation=_TWEET_NER7_CITATION,
|
124 |
+
# features=["text", "text_tokenized", "gold_label_sequence", "date"],
|
125 |
+
# data_url=f"{_ROOT_URL}/tweet_ner",
|
126 |
+
# ),
|
127 |
TweetTemporalShiftConfig(
|
128 |
name="nerd_temporal",
|
129 |
description=_TWEET_NERD_DESCRIPTION,
|
|
|
142 |
features=["text", "gold_label_list", "date"],
|
143 |
data_url=f"{_ROOT_URL}/tweet_topic_test{i}_seed{s}",
|
144 |
),
|
145 |
+
# TweetTemporalShiftConfig(
|
146 |
+
# name=f"ner_random{i}_seed{s}",
|
147 |
+
# description=_TWEET_NER7_DESCRIPTION,
|
148 |
+
# citation=_TWEET_NER7_CITATION,
|
149 |
+
# features=["text", "text_tokenized", "gold_label_sequence", "date"],
|
150 |
+
# data_url=f"{_ROOT_URL}/tweet_ner_test{i}_seed{s}",
|
151 |
+
# ),
|
152 |
TweetTemporalShiftConfig(
|
153 |
name=f"nerd_random{i}_seed{s}",
|
154 |
description=_TWEET_NERD_DESCRIPTION,
|
|
|
160 |
|
161 |
def _info(self):
|
162 |
features = {feature: datasets.Value("string") for feature in self.config.features}
|
163 |
+
if "topic" in self.config.name:
|
164 |
names = [
|
165 |
"arts_&_culture", "business_&_entrepreneurs", "celebrity_&_pop_culture", "diaries_&_daily_life",
|
166 |
"family", "fashion_&_style", "film_tv_&_video", "fitness_&_health", "food_&_dining", "gaming",
|
|
|
168 |
"science_&_technology", "sports", "travel_&_adventure", "youth_&_student_life"]
|
169 |
features["gold_label_list"] = datasets.Sequence(
|
170 |
datasets.features.ClassLabel(names=names))
|
171 |
+
elif "nerd" in self.config.name:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
features["target"] = datasets.Value("string")
|
173 |
features["text"] = datasets.Value("string")
|
174 |
features["definition"] = datasets.Value("string")
|
|
|
176 |
features["text_end"] = datasets.Value("int32")
|
177 |
features["gold_label_binary"] = datasets.Value("int32")
|
178 |
features["date"] = datasets.Value("string")
|
179 |
+
# elif "ner" in self.config.name:
|
180 |
+
# names = [
|
181 |
+
# "B-corporation", "B-creative_work", "B-event", "B-group", "B-location", "B-person", "B-product",
|
182 |
+
# "I-corporation", "I-creative_work", "I-event", "I-group", "I-location", "I-person", "I-product", "O"]
|
183 |
+
# features["gold_label_sequence"] = datasets.Sequence(datasets.features.ClassLabel(names=names))
|
184 |
+
# features["text_tokenized"] = datasets.Sequence(datasets.Value("string"))
|
185 |
+
# features["entities"] = datasets.features.Sequence(
|
186 |
+
# {"entity": datasets.Value("string"), "type": datasets.Value("string")}
|
187 |
+
# )
|
188 |
return datasets.DatasetInfo(
|
189 |
description=_TWEET_TEMPORAL_DESCRIPTION + "\n" + self.config.description,
|
190 |
features=datasets.Features(features),
|