From 0f7998ca97827919b994386dd5a4826e33190bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blar?= Date: Tue, 14 Nov 2023 11:49:23 +0100 Subject: [PATCH] add danish people names (#254) --- include/faker-cxx/types/Language.h | 12 +- src/modules/person/Person.cpp | 17 +- src/modules/person/PersonTest.cpp | 33 +-- .../person/data/danish/DanishFirstNames.h | 236 ++++++++++++++++++ .../person/data/danish/DanishLastNames.h | 23 ++ .../person/data/danish/DanishMiddleNames.h | 13 + .../person/data/danish/DanishPeopleNames.h | 19 ++ .../person/data/danish/DanishPrefixes.h | 11 + 8 files changed, 335 insertions(+), 29 deletions(-) create mode 100644 src/modules/person/data/danish/DanishFirstNames.h create mode 100644 src/modules/person/data/danish/DanishLastNames.h create mode 100644 src/modules/person/data/danish/DanishMiddleNames.h create mode 100644 src/modules/person/data/danish/DanishPeopleNames.h create mode 100644 src/modules/person/data/danish/DanishPrefixes.h diff --git a/include/faker-cxx/types/Language.h b/include/faker-cxx/types/Language.h index 49810d6de..7e0d984ee 100644 --- a/include/faker-cxx/types/Language.h +++ b/include/faker-cxx/types/Language.h @@ -22,12 +22,13 @@ enum class Language Czech, Slovak, Ukrainian, + Danish }; -const std::vector languages{Language::English, Language::Polish, Language::Italian, Language::French, - Language::German, Language::Russian, Language::Romanian, Language::Hindi, - Language::Finnish, Language::Nepali, Language::Spanish, Language::Turkish, - Language::Czech, Language::Slovak, Language::Ukrainian}; +const std::vector languages{Language::English, Language::Polish, Language::Italian, Language::French, + Language::German, Language::Russian, Language::Romanian, Language::Hindi, + Language::Finnish, Language::Nepali, Language::Spanish, Language::Turkish, + Language::Czech, Language::Slovak, Language::Ukrainian, Language::Danish}; inline std::string toString(Language language) { @@ -36,7 +37,8 @@ inline std::string toString(Language language) {Language::French, "French"}, {Language::German, "German"}, {Language::Russian, "Russian"}, {Language::Romanian, "Romanian"}, {Language::Hindi, "Hindi"}, {Language::Finnish, "Finnish"}, {Language::Nepali, "Nepali"}, {Language::Spanish, "Spanish"}, {Language::Turkish, "Turkish"}, - {Language::Czech, "Czech"}, {Language::Slovak, "Slovak"}, {Language::Ukrainian, "Ukrainian"}}; + {Language::Czech, "Czech"}, {Language::Slovak, "Slovak"}, {Language::Ukrainian, "Ukrainian"}, + {Language::Danish, "Danish"}}; return languageToStringMapping.at(language); } diff --git a/src/modules/person/Person.cpp b/src/modules/person/Person.cpp index d9b451030..3a85905d1 100644 --- a/src/modules/person/Person.cpp +++ b/src/modules/person/Person.cpp @@ -5,6 +5,7 @@ #include "../../common/StringHelper.h" #include "data/czech/CzechPeopleNames.h" +#include "data/danish/DanishPeopleNames.h" #include "data/english/EnglishPeopleNames.h" #include "data/finnish/FinnishPeopleNames.h" #include "data/french/FrenchPeopleNames.h" @@ -34,14 +35,14 @@ namespace const std::vector sexes{"Male", "Female"}; const std::map languageToPeopleNamesMapping{ - {Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames}, - {Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames}, - {Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames}, - {Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames}, - {Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames}, - {Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames}, - {Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames}, - {Language::Ukrainian, ukrainianPeopleNames}}; + {Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames}, + {Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames}, + {Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames}, + {Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames}, + {Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames}, + {Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames}, + {Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames}, + {Language::Ukrainian, ukrainianPeopleNames}, {Language::Danish, danishPeopleNames}}; std::string middleNameForLanguage(Language language, std::optional sex); std::string prefixForLanguage(Language language, std::optional sex); diff --git a/src/modules/person/PersonTest.cpp b/src/modules/person/PersonTest.cpp index 7b7df7733..23e719a57 100644 --- a/src/modules/person/PersonTest.cpp +++ b/src/modules/person/PersonTest.cpp @@ -6,6 +6,7 @@ #include "../../common/StringHelper.h" #include "data/czech/CzechPeopleNames.h" +#include "data/danish/DanishPeopleNames.h" #include "data/english/EnglishPeopleNames.h" #include "data/finnish/FinnishPeopleNames.h" #include "data/french/FrenchPeopleNames.h" @@ -35,24 +36,24 @@ namespace const std::vector sexes{"Male", "Female"}; const std::map languageToPeopleNamesMapping{ - {Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames}, - {Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames}, - {Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames}, - {Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames}, - {Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames}, - {Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames}, - {Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames}, - {Language::Ukrainian, ukrainianPeopleNames}}; + {Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames}, + {Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames}, + {Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames}, + {Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames}, + {Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames}, + {Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames}, + {Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames}, + {Language::Ukrainian, ukrainianPeopleNames}, {Language::Danish, danishPeopleNames}}; const std::map generatedTestName{ - {Language::English, "shouldGenerateEnglishName"}, {Language::French, "shouldGenerateFrenchName"}, - {Language::German, "shouldGenerateGermanName"}, {Language::Italian, "shouldGenerateItalianName"}, - {Language::Polish, "shouldGeneratePolishName"}, {Language::Russian, "shouldGenerateRussianName"}, - {Language::Romanian, "shouldGenerateRomanianName"}, {Language::Hindi, "shouldGenerateIndianName"}, - {Language::Finnish, "shouldGenerateFinnishName"}, {Language::Nepali, "shouldGenerateNepaleseName"}, - {Language::Spanish, "shouldGenerateSpanishName"}, {Language::Turkish, "shouldGenerateTurkishName"}, - {Language::Czech, "shouldGenerateCzechName"}, {Language::Slovak, "shouldGenerateSlovakName"}, - {Language::Ukrainian, "shouldGenerateUkrainianName"}}; + {Language::English, "shouldGenerateEnglishName"}, {Language::French, "shouldGenerateFrenchName"}, + {Language::German, "shouldGenerateGermanName"}, {Language::Italian, "shouldGenerateItalianName"}, + {Language::Polish, "shouldGeneratePolishName"}, {Language::Russian, "shouldGenerateRussianName"}, + {Language::Romanian, "shouldGenerateRomanianName"}, {Language::Hindi, "shouldGenerateIndianName"}, + {Language::Finnish, "shouldGenerateFinnishName"}, {Language::Nepali, "shouldGenerateNepaleseName"}, + {Language::Spanish, "shouldGenerateSpanishName"}, {Language::Turkish, "shouldGenerateTurkishName"}, + {Language::Czech, "shouldGenerateCzechName"}, {Language::Slovak, "shouldGenerateSlovakName"}, + {Language::Ukrainian, "shouldGenerateUkrainianName"}, {Language::Danish, "shouldGenerateDanishName"}}; } class PersonTest : public TestWithParam diff --git a/src/modules/person/data/danish/DanishFirstNames.h b/src/modules/person/data/danish/DanishFirstNames.h new file mode 100644 index 000000000..c460c2520 --- /dev/null +++ b/src/modules/person/data/danish/DanishFirstNames.h @@ -0,0 +1,236 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector danishMalesFirstNames = {"Adam", + "Adrian", + "Ahmad", + "Aksel", + "Albert", + "Alexander", + "Alfred", + "Ali", + "Anders", + "Andreas", + "Anton", + "Arthur", + "Arunthavanathan", + "August", + "Benjamin", + "Bjørn", + "Brian", + "Carl", + "Christian", + "Christopher", + "Claus", + "Daniel", + "David", + "Elias", + "Elliot", + "Emil", + "Erik", + "Esben", + "Felix", + "Frank", + "Frederik", + "Georg", + "Hakim", + "Hans", + "Harald", + "Henrik", + "Ib", + "Ivan", + "Jacob", + "Jakob", + "Jan", + "Jens", + "Jeppe", + "Jesper", + "Johan", + "John", + "Jonas", + "Jonathan", + "Jørgen", + "Kaj", + "Karl-Emil", + "Karl-Johan", + "Karl", + "Kasper", + "Kevin", + "Kim", + "Kurt", + "Lars", + "Lasse", + "Leif", + "Leo", + "Linus", + "Lucas", + "Lukas", + "Mads", + "Magnus", + "Malthe", + "Mark", + "Martin", + "Mathias", + "Mathis", + "Max", + "Michael", + "Mikkel", + "Mohammad", + "Morten", + "Nicklas", + "Niels-Christian", + "Niels", + "Niklas", + "Noah", + "Ole", + "Oliver", + "Oscar", + "Otto", + "Patrick", + "Per", + "Peter", + "Philip", + "Poul", + "Rasmus", + "Robert", + "Samuel", + "Sebastian", + "Sigurd", + "Simon", + "Steen", + "Stefan", + "Stig", + "Sune", + "Svend", + "Søren", + "Theo", + "Thomas", + "Tim", + "Tobias", + "Troels", + "Uffe", + "Ulrik", + "Vagn", + "Valdemar", + "Victor", + "Viggo", + "Viktor", + "Vilhelm", + "Villy", + "Vincent", + "William"}; + +const std::vector danishFemalesFirstNames = {"Agnes", + "Alberte", + "Alexandrea", + "Alice", + "Alma", + "Amanda", + "Anita", + "Anna", + "Anne", + "Annette", + "Astrid", + "Bente", + "Betina", + "Birgitte", + "Britt", + "Camilla", + "Caroline", + "Cecilie", + "Charlotte", + "Christina", + "Clara", + "Ditte-Marie", + "Dorit", + "Dorthe", + "Ea", + "Elisabeth", + "Elise", + "Ella", + "Ellen-Margrethe", + "Else", + "Emilie", + "Emma", + "Eva", + "Fatima", + "Freja", + "Frida", + "Gitte", + "Gry", + "Hanne", + "Hedvig", + "Helene", + "Helle", + "Hilda", + "Ida", + "Ingrid", + "Isabella", + "Janni", + "Jeanette", + "Jette", + "Johanne", + "Josefine", + "Julie", + "Karen", + "Karla", + "Kathrine", + "Katrine", + "Kirsten", + "Laila", + "Lene", + "Lillian", + "Line", + "Lis", + "Lisa", + "Lisbeth", + "Liv", + "Lone", + "Louise", + "Luna", + "Lykke", + "Maja", + "Malene", + "Maren", + "Maria", + "Marianne", + "Mathilde", + "Merete", + "Mette", + "Mia", + "Mille", + "Mona", + "Nadia", + "Nanna", + "Nicoline", + "Nina", + "Pia", + "Rebecca", + "Regitze", + "Rikke", + "Rosa-Maria", + "Ruth", + "Sabrina", + "Sandra", + "Sanne", + "Sara", + "Sarah", + "Signe", + "Silje", + "Simone", + "Sofie", + "Stine", + "Susanne", + "Therese", + "Tina", + "Tine", + "Trine", + "Vibeke", + "Viktoria", + "Yasmin", + "Zara"}; +} diff --git a/src/modules/person/data/danish/DanishLastNames.h b/src/modules/person/data/danish/DanishLastNames.h new file mode 100644 index 000000000..ef3086117 --- /dev/null +++ b/src/modules/person/data/danish/DanishLastNames.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector danishLastNames = { + "Abbas", "Abdi", "Andersen", "Andresen", "Bak", "Bang", "Bech", "Beckmann", + "Berg", "Bertelsen", "Bisgaard", "Bjerregaard", "Blom", "Bonde", "Brandt", "Brix", + "Bruun", "Buch", "Buhl", "Bundgaard", "Carlsen", "Christensen", "Christiansen", "Clausen", + "Dahl", "Dalgaard", "Dam", "Damm", "Davidsen", "Dupont", "Esbensen", "Fischer", + "Foged", "Frandsen", "Frederiksen", "Gade", "Garcia", "Gregersen", "Hald", "Hansen", + "Haugaard", "Hedegaard", "Henriksen", "Hermansen", "Hjort", "Hjorth", "Holm", "Iversen", + "Jakobsen", "Jensen", "Jeppesen", "Jespersen", "Johannessen", "Johannsen", "Johansen", "Juhl", + "Justesen", "Jørgensen", "Karlsen", "Khan", "Kjeldsen", "Kjær", "Klausen", "Knudsen", + "Kristensen", "Krogh", "Larsen", "Lauridsen", "Laursen", "Lorentzen", "Lund", "Madsen", + "Magnussen", "Marcussen", "Mortensen", "Munch", "Munk", "Møller", "Nguyen", "Nielsen", + "Nissen", "Nygaard", "Olsen", "Pallesen", "Pedersen", "Petersen", "Pham", "Poulsen", + "Rasmussen", "Ravn", "Richter", "Schmidt", "Schrøder", "Simonsen", "Skov", "Steffensen", + "Storm", "Svendsen", "Svensson", "Sørensen", "Thomsen", "Toft", "Vestergaard", "Villadsen", + "Vinther", "Winther"}; +} diff --git a/src/modules/person/data/danish/DanishMiddleNames.h b/src/modules/person/data/danish/DanishMiddleNames.h new file mode 100644 index 000000000..3d0832211 --- /dev/null +++ b/src/modules/person/data/danish/DanishMiddleNames.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector danishMiddleNames = { + "Birk", "Bjerg", "Bjerre", "Bundgaard", "Dahl", "Dal", "Dam", "Feldt", "Frost", "Grøn", + "Hald", "Hjorth", "Holm", "Husum", "Jul", "Kjær", "Klit", "Koch", "Krog", "Linde", + "Lund", "Mose", "Mølgaard", "Nord", "Præst", "Rosen", "Skov", "Smed", "Vestergaard", "Østergaard"}; + +} diff --git a/src/modules/person/data/danish/DanishPeopleNames.h b/src/modules/person/data/danish/DanishPeopleNames.h new file mode 100644 index 000000000..509f7aa54 --- /dev/null +++ b/src/modules/person/data/danish/DanishPeopleNames.h @@ -0,0 +1,19 @@ +#pragma once + +#include "../NameFormats.h" +#include "../PeopleNames.h" +#include "DanishFirstNames.h" +#include "DanishLastNames.h" +#include "DanishMiddleNames.h" +#include "DanishPrefixes.h" + +namespace faker +{ +const NameFormats danishPersonNameFormats{{{"{firstName} {lastName}", 1}, {"{firstName} {middleName} {lastName}", 1}}}; + +const PeopleNames danishPeopleNames{ + {danishMalesFirstNames, danishMiddleNames, danishLastNames, danishMalesPrefixes, {}}, + {danishFemalesFirstNames, danishMiddleNames, danishLastNames, danishFemalesPrefixes, {}}, + danishPersonNameFormats}; + +} diff --git a/src/modules/person/data/danish/DanishPrefixes.h b/src/modules/person/data/danish/DanishPrefixes.h new file mode 100644 index 000000000..e9d405150 --- /dev/null +++ b/src/modules/person/data/danish/DanishPrefixes.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector danishMalesPrefixes{"hr."}; + +const std::vector danishFemalesPrefixes{"fr."}; +}