norwegian-dynaword / CONTRIBUTING.md
V4ldeLund's picture
update contributing.md (#14)
87f83e7

Working with dataset locally

A huggingface datasets repository is a GitHub repository like any other. You can simply download it like so:

git clone https://huggingface.co/datasets/danish-foundation-models/norwegian-dynaword
cd norwegian-dynaword
git lfs pull # download large files to ensure that tests works

You can the work with the dataset locally like so:

from datasets import load_dataset

name = "../."  # instead of "danish-foundation-models/norwegian-dynaword"
dataset = load_dataset("../.", split="train")
# make transformations here

Note: While it is local Huggingface still uses a cache, therefore you might need to reset it after changes have been made to see that it works correctly. You can do this by deleting the cached files which you can locate using dataset.cache_files.

Adding a new dataset

To add a new dataset you will have to create a folder under data/{dataset_name}/, which should look as follows:

  data/dataset_name
  |- dataset_name.md
  |- dataset_name.parquet
  |- create.py               # optional

The create.py is an optional python script that allow you to recreate the dataset from the source. This is typically to allow us to reproduce the dataset with fixes or update the dataset to the latest version using an API.

Writing Dataset Card

The purpose of the dataset card is to provide a user friendly description of the dataset. A good card should help understand what the data is, where it comes from, what it contains, and what limitations it may have. Avoid using technical language when possible. The main description should explain the data itself, not the implementation or processing. Parsing details, filtering logic, token counting, and reconstruction logic usually belong in create.py, unless they are necessary for the user to understand a limitation of the released data.

For concrete examples, see the Danish Dynaword cards for Enevældens Nyheder Online and Hvad vil du helst?. They are different in source type and scale, but both are useful reference points.

  1. Short description

The short description is reused in the main README table - keep it compact. Mention the source and link it in the short description if relevant.

Example of a good short description:

<!-- START-SHORT DESCRIPTION -->
{document type} from {source publisher}'s [{source title}]({source_url}).
<!-- END-SHORT DESCRIPTION -->
  1. Describe the dataset after the short description

After the short description, explain what the dataset contains in more detail. This can be considered the extended introduction to the dataset it can for instance describe the main source material, where it comes from, and what topics or document types it covers.

  1. Source section

Use the Source section to explain where the data was downloaded from and how the original source presents it. Include the publisher, source collection name, and identifiers such as a DOI when they are available.

  1. Citation section

Add a Citation Information section only if the original source release provides a citation.

  1. License wording

Use the license section to explain, in plain language, how the original source makes the data available.

  1. Limitations

Use the Limitations section to describe risks, biases, historical differences, or reconstruction assumptions that affect the released dataset. If some assumptions were made during parsing, such as spacing, punctuation, metadata, or date reconstruction, add them here.

Installing dependencies

This repo comes with a few dependencies you need to install to make this run. It uses a makefile to run commands and a uv for package management. Once you have uv installed you can install the dependencies using:

make install

Now you can activate the environment with:

source .venv/bin/activate

Running dataset tests

This dataset is special as it comes with a test suite, e.g. testing in the ids are unique and that the format is consistent. You can run the suite using

make test

Submitting a PR

Creating a PR on Huggingface is a bit different from creating one on Github.

  1. Go to the community tab on huggingface press new pull request and choose on your machine. Specify the title of the your PR. Then you can simply:
git checkout -b {new branch name}
# make your changes here 

# push to hub
# you might need to first login:
# huggingface-cli login
git push origin HEAD:refs/pr/{PR NUMBER}

Where HEAD refers to the current branch.

Before you make the PR do be sure to make sure that you have completed the checklist below.

Making changes to an existing PR

As a contributor you might need to develop on an existing branch. To do so you you

# fetch and checkout existing branch:
git fetch origin refs/pr/{PR NUMBER}:pr/{PR NUMBER}
git checkout pr/{PR NUMBER}
# make your changes here

# push changes

Checklist

  • I have run the test suite using make test and all tests pass
  • I have added/changed a dataset:
    • I have updated descriptive statistics using make update-descriptive-statistics
    • I have bumped the version use make bump-version
  • If I have added a create.py script I have added the script dependencies required to run that script.
  • I have updated the CHANGELOG.md if appropriate

Examples of Previous PRs

To see example PR you can see the following:

Frequently asked questions

Do you accept synthetic datasets

Yes we do generally accept synthetic datasets since it will likely be a promising research direction for low- to mid-resource languages. However, you should be aware that synthetic dataset will probably require a more detailed examination and description. We will for instance examine the quality of the synthetic subset and whether the model used for the creation permits resharing of the synthetic data under permissible licenses.

Do you accept non-Norwegian data

Generally this repository is intended for Norwegian text, however quite broadly defined. For instance, we do accept data containing code-switching and historical Norwegian text.