Datasets:
Commit
·
8a3e91b
1
Parent(s):
11a9e81
Upload hashset_distant_sampled.py
Browse files- hashset_distant_sampled.py +59 -0
hashset_distant_sampled.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""HashSet dataset."""
|
| 2 |
+
|
| 3 |
+
import datasets
|
| 4 |
+
import pandas as pd
|
| 5 |
+
|
| 6 |
+
_CITATION = """
|
| 7 |
+
@article{kodali2022hashset,
|
| 8 |
+
title={HashSet--A Dataset For Hashtag Segmentation},
|
| 9 |
+
author={Kodali, Prashant and Bhatnagar, Akshala and Ahuja, Naman and Shrivastava, Manish and Kumaraguru, Ponnurangam},
|
| 10 |
+
journal={arXiv preprint arXiv:2201.06741},
|
| 11 |
+
year={2022}
|
| 12 |
+
}
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
_DESCRIPTION = """
|
| 16 |
+
Hashset is a new dataset consisiting on 1.9k manually annotated and 3.3M loosely supervised tweets for testing the
|
| 17 |
+
efficiency of hashtag segmentation models. We compare State of The Art Hashtag Segmentation models on Hashset and other
|
| 18 |
+
baseline datasets (STAN and BOUN). We compare and analyse the results across the datasets to argue that HashSet can act
|
| 19 |
+
as a good benchmark for hashtag segmentation tasks.
|
| 20 |
+
|
| 21 |
+
HashSet Distant: 3.3M loosely collected camel cased hashtags containing hashtag and their segmentation.
|
| 22 |
+
|
| 23 |
+
HashSet Distant Sampled is a sample of 20,000 camel cased hashtags from the HashSet Distant dataset.
|
| 24 |
+
"""
|
| 25 |
+
_URL = "https://raw.githubusercontent.com/prashantkodali/HashSet/master/datasets/hashset/HashSet-Distant-sampled.csv"
|
| 26 |
+
|
| 27 |
+
class HashSetDistantSampled(datasets.GeneratorBasedBuilder):
|
| 28 |
+
|
| 29 |
+
VERSION = datasets.Version("1.0.0")
|
| 30 |
+
|
| 31 |
+
def _info(self):
|
| 32 |
+
return datasets.DatasetInfo(
|
| 33 |
+
description=_DESCRIPTION,
|
| 34 |
+
features=datasets.Features(
|
| 35 |
+
{
|
| 36 |
+
"index": datasets.Value("int32"),
|
| 37 |
+
"hashtag": datasets.Value("string"),
|
| 38 |
+
"segmentation": datasets.Value("string")
|
| 39 |
+
}
|
| 40 |
+
),
|
| 41 |
+
supervised_keys=None,
|
| 42 |
+
homepage="https://github.com/prashantkodali/HashSet/",
|
| 43 |
+
citation=_CITATION,
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
def _split_generators(self, dl_manager):
|
| 47 |
+
downloaded_files = dl_manager.download(_URL)
|
| 48 |
+
return [
|
| 49 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files }),
|
| 50 |
+
]
|
| 51 |
+
|
| 52 |
+
def _generate_examples(self, filepath):
|
| 53 |
+
records = pd.read_csv(filepath).to_dict("records")
|
| 54 |
+
for idx, row in enumerate(records):
|
| 55 |
+
yield idx, {
|
| 56 |
+
"index": row["Unnamed: 0.1"],
|
| 57 |
+
"hashtag": row["Unsegmented_hashtag"],
|
| 58 |
+
"segmentation": row["Segmented_hashtag"]
|
| 59 |
+
}
|