Convert dataset to Parquet
#3
by albertvillanova HF Staff - opened
Files changed (6)
- README.md+16-6
- amttl.pyDeleted-147
- amttl/test-00000-of-00001.parquetAdded+3
- amttl/train-00000-of-00001.parquetAdded+3
- amttl/validation-00000-of-00001.parquetAdded+3
- dataset_infos.jsonDeleted-1
18 unmodified lines1920212223247 unmodified lines3233343536373839404142434445464748495018 unmodified lines- parsingpretty_name: AMTTLdataset_info:features:- name: iddtype: string7 unmodified lines'1': I'2': E'3': Sconfig_name: amttlsplits:- name: trainnum_bytes: 1132212num_examples: 3063- name: validationnum_bytes: 324374num_examples: 822- name: testnum_bytes: 328525num_examples: 908download_size: 685534dataset_size: 1785111---# Dataset Card for AMTTL18 unmodified lines192021222324257 unmodified lines3334353637383940414243444546474849505152535455565758596018 unmodified lines- parsingpretty_name: AMTTLdataset_info:config_name: amttlfeatures:- name: iddtype: string7 unmodified lines'1': I'2': E'3': Ssplits:- name: trainnum_bytes: 1132196num_examples: 3063- name: validationnum_bytes: 324358num_examples: 822- name: testnum_bytes: 328509num_examples: 908download_size: 274351dataset_size: 1785063configs:- config_name: amttldata_files:- split: trainpath: amttl/train-*- split: validationpath: amttl/validation-*- split: testpath: amttl/test-*default: true---# Dataset Card for AMTTL
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147# coding=utf-8# Copyright 2020 HuggingFace Datasets Authors.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.
# Lint as: python3"""Introduction to AMTTL CWS Dataset"""
import datasets
logger = datasets.logging.get_logger(__name__)
_CITATION = """\@inproceedings{xing2018adaptive, title={Adaptive multi-task transfer learning for Chinese word segmentation in medical text}, author={Xing, Junjie and Zhu, Kenny and Zhang, Shaodian}, booktitle={Proceedings of the 27th International Conference on Computational Linguistics}, pages={3619--3630}, year={2018}}"""
_DESCRIPTION = """\Chinese word segmentation (CWS) trained from open source corpus faces dramatic performance dropwhen dealing with domain text, especially for a domain with lots of special terms and diversewriting styles, such as the biomedical domain. However, building domain-specific CWS requiresextremely high annotation cost. In this paper, we propose an approach by exploiting domain-invariantknowledge from high resource to low resource domains. Extensive experiments show that our modeachieves consistently higher accuracy than the single-task CWS and other transfer learningbaselines, especially when there is a large disparity between source and target domains.
This dataset is the accompanied medical Chinese word segmentation (CWS) dataset.The tags are in BIES scheme.
For more details see https://www.aclweb.org/anthology/C18-1307/"""
_URL = "https://raw.githubusercontent.com/adapt-sjtu/AMTTL/master/medical_data/"_TRAINING_FILE = "forum_train.txt"_DEV_FILE = "forum_dev.txt"_TEST_FILE = "forum_test.txt"
class AmttlConfig(datasets.BuilderConfig): """BuilderConfig for AMTTL"""
def __init__(self, **kwargs): """BuilderConfig for AMTTL.
Args: **kwargs: keyword arguments forwarded to super. """ super(AmttlConfig, self).__init__(**kwargs)
class Amttl(datasets.GeneratorBasedBuilder): """AMTTL Chinese Word Segmentation dataset."""
BUILDER_CONFIGS = [ AmttlConfig( name="amttl", version=datasets.Version("1.0.0"), description="AMTTL medical Chinese word segmentation dataset", ), ]
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "id": datasets.Value("string"), "tokens": datasets.Sequence(datasets.Value("string")), "tags": datasets.Sequence( datasets.features.ClassLabel( names=[ "B", "I", "E", "S", ] ) ), } ), supervised_keys=None, homepage="https://www.aclweb.org/anthology/C18-1307/", citation=_CITATION, )
def _split_generators(self, dl_manager): """Returns SplitGenerators.""" urls_to_download = { "train": f"{_URL}{_TRAINING_FILE}", "dev": f"{_URL}{_DEV_FILE}", "test": f"{_URL}{_TEST_FILE}", } downloaded_files = dl_manager.download_and_extract(urls_to_download)
return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}), 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): logger.info("⏳ Generating examples from = %s", filepath) with open(filepath, encoding="utf-8") as f: guid = 0 tokens = [] tags = [] for line in f: line_stripped = line.strip() if line_stripped == "": if tokens: yield guid, { "id": str(guid), "tokens": tokens, "tags": tags, } guid += 1 tokens = [] tags = [] else: splits = line_stripped.split("\t") if len(splits) == 1: splits.append("O") tokens.append(splits[0]) tags.append(splits[1]) # last example yield guid, { "id": str(guid), "tokens": tokens, "tags": tags, }123version https://git-lfs.github.com/spec/v1oid sha256:e162219c3d2e9a4b234407072169e58475c70f69a1118c4c92c1cc8bdb7fddcfsize 51311123version https://git-lfs.github.com/spec/v1oid sha256:93ff0e728fa5bf6cf4c32805ac01529c1b022f29b39f28406a5e7fd28b9b6342size 172615123version https://git-lfs.github.com/spec/v1oid sha256:e7992b50bd6d87521937260ed7ebce5a986b8eb52ad0905373fe94d6b155c53esize 504251{"amttl": {"description": "Chinese word segmentation (CWS) trained from open source corpus faces dramatic performance drop\nwhen dealing with domain text, especially for a domain with lots of special terms and diverse\nwriting styles, such as the biomedical domain. However, building domain-specific CWS requires\nextremely high annotation cost. In this paper, we propose an approach by exploiting domain-invariant\nknowledge from high resource to low resource domains. Extensive experiments show that our mode\nachieves consistently higher accuracy than the single-task CWS and other transfer learning\nbaselines, especially when there is a large disparity between source and target domains.\n\nThis dataset is the accompanied medical Chinese word segmentation (CWS) dataset.\nThe tags are in BIES scheme.\n\nFor more details see https://www.aclweb.org/anthology/C18-1307/\n", "citation": "@inproceedings{xing2018adaptive,\n title={Adaptive multi-task transfer learning for Chinese word segmentation in medical text},\n author={Xing, Junjie and Zhu, Kenny and Zhang, Shaodian},\n booktitle={Proceedings of the 27th International Conference on Computational Linguistics},\n pages={3619--3630},\n year={2018}\n}\n", "homepage": "https://www.aclweb.org/anthology/C18-1307/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "tags": {"feature": {"num_classes": 4, "names": ["B", "I", "E", "S"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "amttl", "config_name": "amttl", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1132212, "num_examples": 3063, "dataset_name": "amttl"}, "validation": {"name": "validation", "num_bytes": 324374, "num_examples": 822, "dataset_name": "amttl"}, "test": {"name": "test", "num_bytes": 328525, "num_examples": 908, "dataset_name": "amttl"}}, "download_checksums": {"https://raw.githubusercontent.com/adapt-sjtu/AMTTL/master/medical_data/forum_train.txt": {"num_bytes": 434357, "checksum": "9819373963ea04d1d28844d5bc83b6b0332fad8b5f2e73092bcfc58dc6d6292a"}, "https://raw.githubusercontent.com/adapt-sjtu/AMTTL/master/medical_data/forum_dev.txt": {"num_bytes": 124973, "checksum": "1a2eb461b98d2a9160baad7f76d003cc0917b998e8283bcffa52b71224dd9d17"}, "https://raw.githubusercontent.com/adapt-sjtu/AMTTL/master/medical_data/forum_test.txt": {"num_bytes": 126204, "checksum": "aea1a8cf244cd565e94bd193a1eef7a10b16eeb0b6fbb6ed1d2fefbd55360dd6"}}, "download_size": 685534, "post_processing_size": null, "dataset_size": 1785111, "size_in_bytes": 2470645}}README.md+16-6
amttl.pyDeleted-147
amttl/test-00000-of-00001.parquetAdded+3
amttl/train-00000-of-00001.parquetAdded+3
amttl/validation-00000-of-00001.parquetAdded+3
dataset_infos.jsonDeleted-1