{"id":19162866,"url":"https://github.com/centre-for-humanities-computing/danish-ner-bias","last_synced_at":"2025-07-13T00:39:24.834Z","repository":{"id":65606133,"uuid":"595543402","full_name":"centre-for-humanities-computing/Danish-NER-bias","owner":"centre-for-humanities-computing","description":"Investigating bias in Danish language models in Named Entity Recognition (NER). Code from the paper titled \"Detecting intersectionality in NER models: A data-driven approach.\"","archived":false,"fork":false,"pushed_at":"2023-05-08T21:28:26.000Z","size":4042,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-22T22:41:53.284Z","etag":null,"topics":["language-models","named-entity-recognition","nlp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/centre-for-humanities-computing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-31T09:53:18.000Z","updated_at":"2023-11-05T17:01:46.000Z","dependencies_parsed_at":"2025-01-03T21:41:00.830Z","dependency_job_id":"bdb793ac-8870-45e6-908f-5b821fed80fc","html_url":"https://github.com/centre-for-humanities-computing/Danish-NER-bias","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/centre-for-humanities-computing/Danish-NER-bias","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centre-for-humanities-computing%2FDanish-NER-bias","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centre-for-humanities-computing%2FDanish-NER-bias/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centre-for-humanities-computing%2FDanish-NER-bias/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centre-for-humanities-computing%2FDanish-NER-bias/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centre-for-humanities-computing","download_url":"https://codeload.github.com/centre-for-humanities-computing/Danish-NER-bias/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centre-for-humanities-computing%2FDanish-NER-bias/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265076118,"owners_count":23707513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["language-models","named-entity-recognition","nlp"],"created_at":"2024-11-09T09:13:22.907Z","updated_at":"2025-07-13T00:39:24.796Z","avatar_url":"https://github.com/centre-for-humanities-computing.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Detecting intersectionality in NER models: A data-driven approach\n\nThis repository contains the code used to produce the results in the paper \"**Detecting intersectionality in NER models: A data-driven approach**\" by Lassen et al. (2023). \n\nThe project investigates the effect of intersectional biases in Danish language models (see [list](https://github.com/centre-for-humanities-computing/Danish-NER-bias#danish-language-models)) used for Named Entity Recognition (NER). This is achieved by applying a data augmentation technique, namely augmenting all names in the [DaNe](https://aclanthology.org/2020.lrec-1.565/) testset on gender-divided name lists for both majority and minority names. \n\nFor instructions on how to reproduce the results, please refer to the [Pipeline](https://github.com/centre-for-humanities-computing/Danish-NER-bias#pipeline) section.\n\n## Project structure \nThe repository has the following directory structure:\n| \u003cdiv style=\"width:120px\"\u003e\u003c/div\u003e| Description |\n|---------|:-----------|\n| ```name_lists``` | Contains name lists used for data augmentation|\n| ```requirements``` | Requirements file for all models, and a seperate file for polyglot |\n| ```results``` | Results from all model evaluations saved as CSV files|\n| ```src```  | Contains scripts for evaluating all models (```evaluate_XX.py```). Also has helper modules for preprocessing name lists (```process_names```), importing models (```apply_fns```), and augmenting names + evaluating models (```evaluate_fns```).|\n| ```utils-R``` | Utils for running ```results.md```|\n| ```results.md``` | Rmarkdown for producing results table from the paper (```Table 2```) |\n| ```polyglot.sh``` | Installs necessary tools and packages and runs the evaluation of ```polyglot``` |\n| ```setup.sh``` | Installs necessary packages for running evaluation of all models except ```polyglot```|\n| ```run-models.sh``` | Runs the evaluation of all models except ```polyglot```|\n\n\n\n### Danish language models\nThe following models are evaluated:\n* [ScandiNER](https://huggingface.co/saattrupdan/nbailab-base-ner-scandi)\n* [DaCy models](https://github.com/centre-for-humanities-computing/DaCy)\n    * DaCY large (da_dacy_large_trf-0.1.0)\n    * DaCy medium (da_dacy_medium_trf-0.1.0)\n    * DaCY small (da_dacy_small_trf-0.1.0)\n* [DaNLP BERT](https://danlp-alexandra.readthedocs.io/en/stable/docs/tasks/ner.html#bert)\n* [Flair](https://github.com/flairNLP/flair)\n* [NERDA](https://github.com/ebanalyse/NERDA/)\n* [Spacy models](https://spacy.io/models/da)\n    * SpaCy large (da_core_news_lg-3.4.0)\n    * SpaCy medium (da_core_news_md-3.4.0)\n    * SpaCy small (da_core_news_sm-3.4.0)\n* [Polyglot](https://polyglot.readthedocs.io/en/latest/NamedEntityRecognition.html)\n\n\n## Pipeline \nThe pipeline has been built on Ubuntu ([UCloud](https://cloud.sdu.dk/)). \n\nFor all models except ```polyglot```, first run the ```setup.sh```\n```\nbash setup.sh\n```\nThis will create a virtual environment (```env```) and install the necessary packages. \n\nTo then evaluate all models, run: \n```\nbash run-models.sh\n```\n\n### Polyglot\nTo setup and evaluate ```polyglot```, run: \n```\nsudo bash polyglot.sh\n```\n**NB! Notice that it is necessary to run this code with sudo as the setup requires certain devtools that will not be installed otherwise. Run at own risk!**\n\nThe ```polyglot.sh``` script will both install devtools, packages and run the evaluation of the model in a seperately created environment called ```polyenv```. \n\n## Acknowledgements\nThe name augmentation was performed using [augmenty](https://kennethenevoldsen.github.io/augmenty/) and model evaluation was performed using the [DaCy](https://github.com/centre-for-humanities-computing/DaCy) framework. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentre-for-humanities-computing%2Fdanish-ner-bias","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentre-for-humanities-computing%2Fdanish-ner-bias","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentre-for-humanities-computing%2Fdanish-ner-bias/lists"}