asahi417 commited on
Commit
1484fd5
1 Parent(s): f9f23ab
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license:
5
+ - other
6
+ multilinguality:
7
+ - monolingual
8
+ size_categories:
9
+ - 1k<10K
10
+ task_categories:
11
+ - token-classification
12
+ task_ids:
13
+ - named-entity-recognition
14
+ pretty_name: TweetNER7
15
+ ---
16
+
17
+ # Dataset Card for "tner/tweetner7"
18
+
19
+ ## Dataset Description
20
+
21
+ - **Repository:** [T-NER](https://github.com/asahi417/tner)
22
+ - **Paper:** TBA
23
+ - **Dataset:** TweetNER7
24
+ - **Domain:** Twitter
25
+ - **Number of Entity:** 7
26
+
27
+
28
+ ### Dataset Summary
29
+ TweeBank NER dataset formatted in a part of [TNER](https://github.com/asahi417/tner) project.
30
+ - Entity Types: `corperation`, `creative_work`, `event`, `group`, `location`, `product`, `person`
31
+
32
+ ## Dataset Structure
33
+
34
+ ### Data Instances
35
+ An example of `train` looks as follows.
36
+
37
+ ```
38
+ {
39
+
40
+ }
41
+ ```
42
+
43
+ ### Label ID
44
+ The label2id dictionary can be found at [here](https://huggingface.co/datasets/tner/tweetner7/raw/main/dataset/label.json).
45
+ ```python
46
+ {
47
+ "B-corporation": 0,
48
+ "B-creative_work": 1,
49
+ "B-event": 2,
50
+ "B-group": 3,
51
+ "B-location": 4,
52
+ "B-person": 5,
53
+ "B-product": 6,
54
+ "I-corporation": 7,
55
+ "I-creative_work": 8,
56
+ "I-event": 9,
57
+ "I-group": 10,
58
+ "I-location": 11,
59
+ "I-person": 12,
60
+ "I-product": 13,
61
+ "O": 14
62
+ }
63
+ ```
64
+
65
+ ### Data Splits
66
+
67
+ | name |train|validation|test|
68
+ |---------|----:|---------:|---:|
69
+ |tweetner7 | 1639| 710 |1201|
70
+
71
+ ### Citation Information
72
+
73
+ ```
74
+ TBA
75
+ ```
dataset/2020.dev.json ADDED
The diff for this file is too large to render. See raw diff
dataset/2020.test.json ADDED
The diff for this file is too large to render. See raw diff
dataset/2020.train.json ADDED
The diff for this file is too large to render. See raw diff
dataset/2021.dev.json ADDED
The diff for this file is too large to render. See raw diff
dataset/2021.test.json ADDED
The diff for this file is too large to render. See raw diff
dataset/2021.train.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra00.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra01.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra02.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra03.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra04.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra05.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra06.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra07.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2020.extra08.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra00.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra01.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra02.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra03.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra04.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra05.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra06.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra07.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra08.json ADDED
The diff for this file is too large to render. See raw diff
dataset/extra/2021.extra09.json ADDED
The diff for this file is too large to render. See raw diff
dataset/label.json ADDED
@@ -0,0 +1 @@
 
1
+ {"B-corporation": 0, "B-creative_work": 1, "B-event": 2, "B-group": 3, "B-location": 4, "B-person": 5, "B-product": 6, "I-corporation": 7, "I-creative_work": 8, "I-event": 9, "I-group": 10, "I-location": 11, "I-person": 12, "I-product": 13, "O": 14}
dataset/random.dev.json ADDED
The diff for this file is too large to render. See raw diff
dataset/random.train.json ADDED
The diff for this file is too large to render. See raw diff
tweetner7.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ NER dataset compiled by T-NER library https://github.com/asahi417/tner/tree/master/tner """
2
+ import json
3
+ from itertools import chain
4
+ import datasets
5
+
6
+ logger = datasets.logging.get_logger(__name__)
7
+ _DESCRIPTION = """[TweetNER7](TBA)"""
8
+ _NAME = "tweetner7"
9
+ _VERSION = "1.0.0"
10
+ _CITATION = """
11
+ TBA
12
+ """
13
+
14
+ _HOME_PAGE = "https://github.com/asahi417/tner"
15
+ _URL = f'https://huggingface.co/datasets/tner/{_NAME}/raw/main/dataset'
16
+ _URLS = {
17
+ str(datasets.Split.TEST): [f'{_URL}/2021.test.json'],
18
+ str(datasets.Split.VALIDATION): [f'{_URL}/2020.dev.json'],
19
+ str(datasets.Split.TRAIN): [f'{_URL}/2020.train.json'],
20
+ f'{str(datasets.Split.TEST)}_2020': [f'{_URL}/2020.test.json'],
21
+ f'{str(datasets.Split.TEST)}_2021': [f'{_URL}/2021.test.json'],
22
+ f'{str(datasets.Split.VALIDATION)}_2020': [f'{_URL}/2020.dev.json'],
23
+ f'{str(datasets.Split.VALIDATION)}_2021': [f'{_URL}/2021.dev.json'],
24
+ f'{str(datasets.Split.TRAIN)}_2020': [f'{_URL}/2020.train.json'],
25
+ f'{str(datasets.Split.TRAIN)}_2021': [f'{_URL}/2021.train.json'],
26
+ f'{str(datasets.Split.VALIDATION)}_random': [f'{_URL}/random.dev.json'],
27
+ f'{str(datasets.Split.TRAIN)}_random': [f'{_URL}/random.train.json'],
28
+ f'extra_2020': [f'{_URL}/extra/2020.extra{i:02d}.json' for i in range(9)],
29
+ f'extra_2021': [f'{_URL}/extra/2021.extra{i:02d}.json' for i in range(10)]
30
+ }
31
+
32
+
33
+ class TweetNER7Config(datasets.BuilderConfig):
34
+ """BuilderConfig"""
35
+
36
+ def __init__(self, **kwargs):
37
+ """BuilderConfig.
38
+
39
+ Args:
40
+ **kwargs: keyword arguments forwarded to super.
41
+ """
42
+ super(TweetNER7Config, self).__init__(**kwargs)
43
+
44
+
45
+ class TweetNER7(datasets.GeneratorBasedBuilder):
46
+ """Dataset."""
47
+
48
+ BUILDER_CONFIGS = [
49
+ TweebankNERConfig(name=_NAME, version=datasets.Version(_VERSION), description=_DESCRIPTION),
50
+ ]
51
+
52
+ def _split_generators(self, dl_manager):
53
+ downloaded_file = dl_manager.download_and_extract(_URLS)
54
+ return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
55
+ for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
56
+
57
+ def _generate_examples(self, filepaths):
58
+ _key = 0
59
+ for filepath in filepaths:
60
+ logger.info(f"generating examples from = {filepath}")
61
+ with open(filepath, encoding="utf-8") as f:
62
+ _list = [i for i in f.read().split('\n') if len(i) > 0]
63
+ for i in _list:
64
+ data = json.loads(i)
65
+ yield _key, data
66
+ _key += 1
67
+
68
+ def _info(self):
69
+ return datasets.DatasetInfo(
70
+ description=_DESCRIPTION,
71
+ features=datasets.Features(
72
+ {
73
+ "tokens": datasets.Sequence(datasets.Value("string")),
74
+ "tags": datasets.Sequence(datasets.Value("int32")),
75
+ "id": datasets.Value("string"),
76
+ "date": datasets.Value("string")
77
+ }
78
+ ),
79
+ supervised_keys=None,
80
+ homepage=_HOME_PAGE,
81
+ citation=_CITATION,
82
+ )