Datasets:
Tasks:
Token Classification
Sub-tasks:
named-entity-recognition
Languages:
Chinese
Size:
10K<n<100K
License:
Commit
•
a21b4e9
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +137 -0
- dataset_infos.json +1 -0
- dummy/msra_ner/1.0.0/dummy_data.zip +3 -0
- msra_ner.py +148 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- zh
|
8 |
+
licenses:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 10K<n<100K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- structure-prediction
|
18 |
+
task_ids:
|
19 |
+
- named-entity-recognition
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for MSRA NER
|
23 |
+
|
24 |
+
## Table of Contents
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-instances)
|
32 |
+
- [Data Splits](#data-instances)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Annotations](#annotations)
|
37 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
38 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
39 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
40 |
+
- [Discussion of Biases](#discussion-of-biases)
|
41 |
+
- [Other Known Limitations](#other-known-limitations)
|
42 |
+
- [Additional Information](#additional-information)
|
43 |
+
- [Dataset Curators](#dataset-curators)
|
44 |
+
- [Licensing Information](#licensing-information)
|
45 |
+
- [Citation Information](#citation-information)
|
46 |
+
|
47 |
+
## Dataset Description
|
48 |
+
|
49 |
+
- **Homepage:** [Github](https://github.com/OYE93/Chinese-NLP-Corpus/tree/master/NER/MSRA)
|
50 |
+
- **Repository:** [Github](https://github.com/OYE93/Chinese-NLP-Corpus)
|
51 |
+
- **Paper:**
|
52 |
+
- **Leaderboard:**
|
53 |
+
- **Point of Contact:**
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
|
57 |
+
[More Information Needed]
|
58 |
+
|
59 |
+
### Supported Tasks and Leaderboards
|
60 |
+
|
61 |
+
[More Information Needed]
|
62 |
+
|
63 |
+
### Languages
|
64 |
+
|
65 |
+
[More Information Needed]
|
66 |
+
|
67 |
+
## Dataset Structure
|
68 |
+
|
69 |
+
### Data Instances
|
70 |
+
|
71 |
+
[More Information Needed]
|
72 |
+
|
73 |
+
### Data Fields
|
74 |
+
|
75 |
+
[More Information Needed]
|
76 |
+
|
77 |
+
### Data Splits
|
78 |
+
|
79 |
+
[More Information Needed]
|
80 |
+
|
81 |
+
## Dataset Creation
|
82 |
+
|
83 |
+
### Curation Rationale
|
84 |
+
|
85 |
+
[More Information Needed]
|
86 |
+
|
87 |
+
### Source Data
|
88 |
+
|
89 |
+
#### Initial Data Collection and Normalization
|
90 |
+
|
91 |
+
[More Information Needed]
|
92 |
+
|
93 |
+
#### Who are the source language producers?
|
94 |
+
|
95 |
+
[More Information Needed]
|
96 |
+
|
97 |
+
### Annotations
|
98 |
+
|
99 |
+
#### Annotation process
|
100 |
+
|
101 |
+
[More Information Needed]
|
102 |
+
|
103 |
+
#### Who are the annotators?
|
104 |
+
|
105 |
+
[More Information Needed]
|
106 |
+
|
107 |
+
### Personal and Sensitive Information
|
108 |
+
|
109 |
+
[More Information Needed]
|
110 |
+
|
111 |
+
## Considerations for Using the Data
|
112 |
+
|
113 |
+
### Social Impact of Dataset
|
114 |
+
|
115 |
+
[More Information Needed]
|
116 |
+
|
117 |
+
### Discussion of Biases
|
118 |
+
|
119 |
+
[More Information Needed]
|
120 |
+
|
121 |
+
### Other Known Limitations
|
122 |
+
|
123 |
+
[More Information Needed]
|
124 |
+
|
125 |
+
## Additional Information
|
126 |
+
|
127 |
+
### Dataset Curators
|
128 |
+
|
129 |
+
[More Information Needed]
|
130 |
+
|
131 |
+
### Licensing Information
|
132 |
+
|
133 |
+
[More Information Needed]
|
134 |
+
|
135 |
+
### Citation Information
|
136 |
+
|
137 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"msra_ner": {"description": "The Third International Chinese Language\nProcessing Bakeoff was held in Spring\n2006 to assess the state of the art in two\nimportant tasks: word segmentation and\nnamed entity recognition. Twenty-nine\ngroups submitted result sets in the two\ntasks across two tracks and a total of five\ncorpora. We found strong results in both\ntasks as well as continuing challenges.\n\nMSRA NER is one of the provided dataset.\nThere are three types of NE, PER (person),\nORG (organization) and LOC (location).\nThe dataset is in the BIO scheme.\n\nFor more details see https://faculty.washington.edu/levow/papers/sighan06.pdf\n", "citation": "@inproceedings{levow2006third,\n author = {Gina{-}Anne Levow},\n title = {The Third International Chinese Language Processing Bakeoff: Word\n Segmentation and Named Entity Recognition},\n booktitle = {SIGHAN@COLING/ACL},\n pages = {108--117},\n publisher = {Association for Computational Linguistics},\n year = {2006}\n}\n", "homepage": "https://www.microsoft.com/en-us/download/details.aspx?id=52531", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 7, "names": ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "msra_ner", "config_name": "msra_ner", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 33323074, "num_examples": 45001, "dataset_name": "msra_ner"}, "test": {"name": "test", "num_bytes": 2642934, "num_examples": 3443, "dataset_name": "msra_ner"}}, "download_checksums": {"https://raw.githubusercontent.com/OYE93/Chinese-NLP-Corpus/master/NER/MSRA/msra_train_bio.txt": {"num_bytes": 14037265, "checksum": "b403d1318c5289917ad2ca4136279592521684748327e93f1bf49a3845a40ac7"}, "https://raw.githubusercontent.com/OYE93/Chinese-NLP-Corpus/master/NER/MSRA/msra_test_bio.txt": {"num_bytes": 1119341, "checksum": "2be8e580bcb22e9086e4403d82a7ec0f6e18019ebef35b0fd52941724bdf89a3"}}, "download_size": 15156606, "post_processing_size": null, "dataset_size": 35966008, "size_in_bytes": 51122614}}
|
dummy/msra_ner/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8cd86e780b1f48defab6cea62ca866fa01ba4203906a323c343da1ac0b0e2ff6
|
3 |
+
size 447
|
msra_ner.py
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 HuggingFace Datasets Authors.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Introduction to MSRA NER Dataset"""
|
18 |
+
|
19 |
+
import logging
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
|
23 |
+
|
24 |
+
_CITATION = """\
|
25 |
+
@inproceedings{levow2006third,
|
26 |
+
author = {Gina{-}Anne Levow},
|
27 |
+
title = {The Third International Chinese Language Processing Bakeoff: Word
|
28 |
+
Segmentation and Named Entity Recognition},
|
29 |
+
booktitle = {SIGHAN@COLING/ACL},
|
30 |
+
pages = {108--117},
|
31 |
+
publisher = {Association for Computational Linguistics},
|
32 |
+
year = {2006}
|
33 |
+
}
|
34 |
+
"""
|
35 |
+
|
36 |
+
_DESCRIPTION = """\
|
37 |
+
The Third International Chinese Language
|
38 |
+
Processing Bakeoff was held in Spring
|
39 |
+
2006 to assess the state of the art in two
|
40 |
+
important tasks: word segmentation and
|
41 |
+
named entity recognition. Twenty-nine
|
42 |
+
groups submitted result sets in the two
|
43 |
+
tasks across two tracks and a total of five
|
44 |
+
corpora. We found strong results in both
|
45 |
+
tasks as well as continuing challenges.
|
46 |
+
|
47 |
+
MSRA NER is one of the provided dataset.
|
48 |
+
There are three types of NE, PER (person),
|
49 |
+
ORG (organization) and LOC (location).
|
50 |
+
The dataset is in the BIO scheme.
|
51 |
+
|
52 |
+
For more details see https://faculty.washington.edu/levow/papers/sighan06.pdf
|
53 |
+
"""
|
54 |
+
|
55 |
+
_URL = "https://raw.githubusercontent.com/OYE93/Chinese-NLP-Corpus/master/NER/MSRA/"
|
56 |
+
_TRAINING_FILE = "msra_train_bio.txt"
|
57 |
+
_TEST_FILE = "msra_test_bio.txt"
|
58 |
+
|
59 |
+
|
60 |
+
class MsraNerConfig(datasets.BuilderConfig):
|
61 |
+
"""BuilderConfig for MsraNer"""
|
62 |
+
|
63 |
+
def __init__(self, **kwargs):
|
64 |
+
"""BuilderConfig for MSRA NER.
|
65 |
+
|
66 |
+
Args:
|
67 |
+
**kwargs: keyword arguments forwarded to super.
|
68 |
+
"""
|
69 |
+
super(MsraNerConfig, self).__init__(**kwargs)
|
70 |
+
|
71 |
+
|
72 |
+
class MsraNer(datasets.GeneratorBasedBuilder):
|
73 |
+
"""MSRA NER dataset."""
|
74 |
+
|
75 |
+
BUILDER_CONFIGS = [
|
76 |
+
MsraNerConfig(name="msra_ner", version=datasets.Version("1.0.0"), description="MSRA NER dataset"),
|
77 |
+
]
|
78 |
+
|
79 |
+
def _info(self):
|
80 |
+
return datasets.DatasetInfo(
|
81 |
+
description=_DESCRIPTION,
|
82 |
+
features=datasets.Features(
|
83 |
+
{
|
84 |
+
"id": datasets.Value("string"),
|
85 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
86 |
+
"ner_tags": datasets.Sequence(
|
87 |
+
datasets.features.ClassLabel(
|
88 |
+
names=[
|
89 |
+
"O",
|
90 |
+
"B-PER",
|
91 |
+
"I-PER",
|
92 |
+
"B-ORG",
|
93 |
+
"I-ORG",
|
94 |
+
"B-LOC",
|
95 |
+
"I-LOC",
|
96 |
+
]
|
97 |
+
)
|
98 |
+
),
|
99 |
+
}
|
100 |
+
),
|
101 |
+
supervised_keys=None,
|
102 |
+
homepage="https://www.microsoft.com/en-us/download/details.aspx?id=52531",
|
103 |
+
citation=_CITATION,
|
104 |
+
)
|
105 |
+
|
106 |
+
def _split_generators(self, dl_manager):
|
107 |
+
"""Returns SplitGenerators."""
|
108 |
+
urls_to_download = {
|
109 |
+
"train": f"{_URL}{_TRAINING_FILE}",
|
110 |
+
"test": f"{_URL}{_TEST_FILE}",
|
111 |
+
}
|
112 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
113 |
+
|
114 |
+
return [
|
115 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
116 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
117 |
+
]
|
118 |
+
|
119 |
+
def _generate_examples(self, filepath):
|
120 |
+
logging.info("⏳ Generating examples from = %s", filepath)
|
121 |
+
with open(filepath, encoding="utf-8") as f:
|
122 |
+
guid = 0
|
123 |
+
tokens = []
|
124 |
+
ner_tags = []
|
125 |
+
for line in f:
|
126 |
+
line_stripped = line.strip()
|
127 |
+
if line_stripped == "":
|
128 |
+
if tokens:
|
129 |
+
yield guid, {
|
130 |
+
"id": str(guid),
|
131 |
+
"tokens": tokens,
|
132 |
+
"ner_tags": ner_tags,
|
133 |
+
}
|
134 |
+
guid += 1
|
135 |
+
tokens = []
|
136 |
+
ner_tags = []
|
137 |
+
else:
|
138 |
+
splits = line_stripped.split("\t")
|
139 |
+
if len(splits) == 1:
|
140 |
+
splits.append("O")
|
141 |
+
tokens.append(splits[0])
|
142 |
+
ner_tags.append(splits[1])
|
143 |
+
# last example
|
144 |
+
yield guid, {
|
145 |
+
"id": str(guid),
|
146 |
+
"tokens": tokens,
|
147 |
+
"ner_tags": ner_tags,
|
148 |
+
}
|