|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""Introduction to the CoNLL-2003 Shared Task: Language-Independent Named Entity Recognition""" |
|
|
|
import os |
|
|
|
import datasets |
|
|
|
|
|
logger = datasets.logging.get_logger(__name__) |
|
|
|
|
|
_CITATION = """\ |
|
@inproceedings{derczynski-kjeldsen-2019-bornholmsk, |
|
title = "Bornholmsk Natural Language Processing: Resources and Tools", |
|
author = "Derczynski, Leon and |
|
Kjeldsen, Alex Speed", |
|
booktitle = "Proceedings of the 22nd Nordic Conference on Computational Linguistics", |
|
month = sep # "{--}" # oct, |
|
year = "2019", |
|
address = "Turku, Finland", |
|
publisher = {Link{\"o}ping University Electronic Press}, |
|
url = "https://aclanthology.org/W19-6138", |
|
pages = "338--344", |
|
abstract = {This paper introduces language processing resources and tools for Bornholmsk, a language spoken on the island of Bornholm, with roots in Danish and closely related to Scanian. This presents an overview of the language and available data, and the first NLP models for this living, minority Nordic language. Sammenfattnijng p{\aa} borrijnholmst: D{\ae}jnna artikkelijn introduserer naturspr{\aa}gsresurser {\aa} varktoi for borrijnholmst, ed spr{\aa}g a d{\ae}r snakkes p{\aa} {\"o}n Borrijnholm me r{\o}dder i danst {\aa} i n{\ae}r familia me sk{\aa}nst. Artikkelijn gjer ed {\^a}uersyn {\^a}uer spr{\aa}ged {\aa} di datan som fijnnes, {\aa} di fosste NLP mod{\ae}llarna for d{\ae}tta l{\ae}wenes nordiska minnret{\^a}lsspr{\aa}ged.}, |
|
} |
|
|
|
""" |
|
|
|
_DESCRIPTION = """\ |
|
This corpus introduces language processing resources and tools for Bornholmsk, a language spoken on the island of Bornholm, with roots in Danish and closely related to Scanian. |
|
|
|
Sammenfattnijng på borrijnholmst: Dæjnna artikkelijn introduserer natursprågsresurser å varktoi for borrijnholmst, ed språg a dær snakkes på ön Borrijnholm me rødder i danst å i nær familia me skånst. |
|
""" |
|
|
|
_URL = "https://raw.githubusercontent.com/StrombergNLP/bornholmsk/master/da-bornholm.clean.txt" |
|
|
|
|
|
class BornholmskConfig(datasets.BuilderConfig): |
|
"""BuilderConfig for Bornholmsk""" |
|
|
|
def __init__(self, **kwargs): |
|
"""BuilderConfig Bornholmsk. |
|
|
|
Args: |
|
**kwargs: keyword arguments forwarded to super. |
|
""" |
|
super(BornholmskConfig, self).__init__(**kwargs) |
|
|
|
|
|
class Bornholmsk(datasets.GeneratorBasedBuilder): |
|
"""Bornholmsk dataset.""" |
|
|
|
BUILDER_CONFIGS = [ |
|
BornholmskConfig(name="Bornholmsk", version=datasets.Version("1.0.0"), description="Bornholmsk text"), |
|
] |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=datasets.Features( |
|
{ |
|
"id": datasets.Value("string"), |
|
"text": datasets.Value("string"), |
|
} |
|
), |
|
supervised_keys=None, |
|
homepage="https://github.com/StrombergNLP/bornholmsk", |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
"""Returns SplitGenerators.""" |
|
downloaded_file = dl_manager.download_and_extract(_URL) |
|
|
|
return [ |
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}), |
|
] |
|
|
|
def _generate_examples(self, filepath): |
|
logger.info("⏳ Generating examples from = %s", filepath) |
|
guid = 0 |
|
with open(filepath, encoding="utf-8") as f: |
|
for line in f: |
|
line = line.strip() |
|
if line: |
|
yield guid, { |
|
"id": str(guid), |
|
"text": line, |
|
} |
|
guid += 1 |
|
|