File size: 2,256 Bytes
2de7653 31c49b7 2de7653 31c49b7 2de7653 31c49b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
"""BOUN dataset"""
import datasets
_CITATION = """
@article{celebi2018segmenting,
title={Segmenting hashtags and analyzing their grammatical structure},
author={Celebi, Arda and {\"O}zg{\"u}r, Arzucan},
journal={Journal of the Association for Information Science and Technology},
volume={69},
number={5},
pages={675--686},
year={2018},
publisher={Wiley Online Library}
}
"""
_DESCRIPTION = """
Dev-BOUN Development set that includes 500 manually segmented hashtags. These are selected from tweets about movies,
tv shows, popular people, sports teams etc. Test-BOUN Test set that includes 500 manually segmented hashtags.
These are selected from tweets about movies, tv shows, popular people, sports teams etc.
"""
_URLS = {
"dev": "https://raw.githubusercontent.com/ardax/hashtag-segmentor/master/Dev-BOUN",
"test": "https://raw.githubusercontent.com/ardax/hashtag-segmentor/master/Test-BOUN"
}
class Boun(datasets.GeneratorBasedBuilder):
VERSION = datasets.Version("1.0.0")
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"index": datasets.Value("int32"),
"hashtag": datasets.Value("string"),
"segmentation": datasets.Value("string")
}
),
supervised_keys=None,
homepage="https://github.com/ardax/hashtag-segmentor",
citation=_CITATION,
)
def _split_generators(self, dl_manager):
downloaded_files = dl_manager.download(_URLS)
return [
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"] }),
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"] }),
]
def _generate_examples(self, filepath):
with open(filepath, 'r') as f:
for idx, line in enumerate(f):
yield idx, {
"index": idx,
"hashtag": line.strip().replace(" ", ""),
"segmentation": line.strip()
} |