Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
unknown
Language Creators:
machine-generated
Annotations Creators:
expert-generated
Source Datasets:
original
Tags:
word-segmentation
License:
File size: 1,876 Bytes
d421e49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""SNAP dataset"""

import datasets

_CITATION = """

@inproceedings{celebi2016segmenting,

  title={Segmenting hashtags using automatically created training data},

  author={Celebi, Arda and {\"O}zg{\"u}r, Arzucan},

  booktitle={Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16)},

  pages={2981--2985},

  year={2016}

}

"""

_DESCRIPTION = """

Automatically segmented 803K SNAP Twitter Data Set hashtags with the heuristic described in the paper "Segmenting hashtags using automatically created training data".

"""
_URL = "https://raw.githubusercontent.com/ruanchaves/hashformers/master/datasets/SNAP.Hashtags.Segmented.w.Heuristics.txt"

class Snap(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(_URL)
        return [
            datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files}),
        ]

    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()
                }