Skip to content

Commit

Permalink
Update the encoding of PersianNames headers and eliminate the wstring…
Browse files Browse the repository at this point in the history
… to string conversion
  • Loading branch information
alisedighmoghadam committed Nov 29, 2023
1 parent 0fe1f30 commit 0a1eb47
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 188 deletions.
16 changes: 0 additions & 16 deletions src/common/StringHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,5 @@ std::string StringHelper::removePunctuation(const std::string& word)

return result;
}
<<<<<<< HEAD

=======
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
std::vector<std::string> StringHelper::convertToUTF8(const std::vector<std::wstring>& wstr)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> converter;
std::vector<std::string> str;
for (auto& item : wstr)
{
str.push_back(converter.to_bytes(item));
}
return str;
}
#pragma GCC diagnostic pop
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b
}
5 changes: 0 additions & 5 deletions src/common/StringHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ class StringHelper
static std::string toLower(const std::string& data);
static bool isPunctuation(char c);
static std::string removePunctuation(const std::string& word);
<<<<<<< HEAD

=======
// Helper to convert wstring to string for Persian and Arabic characters.
static std::vector<std::string> convertToUTF8(const std::vector<std::wstring>& wstr);
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b
};
}
23 changes: 0 additions & 23 deletions src/modules/person/data/iran/PersianFirstNames.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<<<<<<< HEAD
#pragma once
=======
#pragma once
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b

#include <string>
#include <vector>

namespace faker
{
<<<<<<< HEAD
const std::vector<std::string> persianMalesFirstNames = {
"آرمان", "بهروز", "کیان", "فریدون", "سپهر", "میلاد", "آرشام", "پوریا", "بهراد",
"سیاوش", "احسان", "شایان", "شهریار", "آرتین", "امیدوار", "پارسا", "کاوه", "پیام",
Expand All @@ -26,24 +21,6 @@ const std::vector<std::string> persianFemalesFirstNames = {
"شهناز", "سوگند", "فرانکا", "لیانا", "سمیرا", "فاطمه", "سهراب", "هلنا", "دلارا", "پارمیس", "آوا",
"پانیذ", "آناهیتا", "سحر", "ناهید", "آتوسا", "بهناز", "راحله", "شبنم", "فریبا", "نرگس", "رها",
"سهیلا", "شیدا", "محیا", "زهره", "زیبا", "رقیه", "مهتاب", "الهه", "ریما", "مهدیس"};
=======
const std::vector<std::wstring> persianMalesFirstNames = {
L"آرمان", L"بهروز", L"کیان", L"فریدون", L"سپهر", L"میلاد", L"آرشام", L"پوریا", L"بهراد",
L"سیاوش", L"احسان", L"شایان", L"شهریار", L"آرتین", L"امیدوار", L"پارسا", L"کاوه", L"پیام",
L"آرین", L"مانی", L"نیما", L"فرهاد", L"کسری", L"کیوان", L"رهام", L"فرشاد", L"آرمین",
L"فرزاد", L"ساماندار", L"امینوار", L"امیرعلی", L"رضوان", L"حسینیان", L"ناصر", L"محمدرضا", L"صادق",
L"علی", L"عباس", L"حمید", L"جواد", L"محمود", L"علیرضا", L"رامبد", L"پیمان", L"مهدی",
L"سجاد", L"محمد", L"یوسف", L"محمدعلی", L"حسین", L"رحمان", L"رضا", L"کاظم", L"مهران",
L"نادر", L"مهدیار", L"پرهام", L"پیروز", L"میثم", L"احمد", L"مصطفی"};

const std::vector<std::wstring> persianFemalesFirstNames = {
L"آتنا", L"پریسا", L"نازنین", L"شیرین", L"الناز", L"سارا", L"زهرا", L"ریحانه", L"بهار", L"آیدا", L"نیکا",
L"مهسا", L"نگین", L"یاسمن", L"آرزو", L"لاله", L"روژین", L"ترانه", L"پرنیا", L"مریم", L"پگاه", L"سلما",
L"ملیسا", L"نسترن", L"مینا", L"پرشین", L"مهتا", L"لیلا", L"مهرانگیز", L"زینب", L"آزیتا", L"پرستو", L"رها",
L"شهناز", L"سوگند", L"فرانکا", L"لیانا", L"سمیرا", L"فاطمه", L"سهراب", L"هلنا", L"دلارا", L"پارمیس", L"آوا",
L"پانیذ", L"آناهیتا", L"سحر", L"ناهید", L"آتوسا", L"بهناز", L"راحله", L"شبنم", L"فریبا", L"نرگس", L"رها",
L"سهیلا", L"شیدا", L"محیا", L"زهره", L"زیبا", L"رقیه", L"مهتاب", L"الهه", L"ریما", L"مهدیس"};
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b


}
118 changes: 0 additions & 118 deletions src/modules/person/data/iran/PersianLastNames.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<<<<<<< HEAD
#pragma once
=======
#pragma once
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b

#include <string>
#include <vector>

namespace faker
{
<<<<<<< HEAD
const std::vector<std::string> persianLastNames = {"خانی",
"رحمانی",
"احمدی",
Expand Down Expand Up @@ -121,117 +116,4 @@ const std::vector<std::string> persianLastNames = {"خانی",
"معتمدی",
"حسینی‌نژاد",
"نظری"};
=======
const std::vector<std::wstring> persianLastNames = {L"خانی",
L"رحمانی",
L"احمدی",
L"زاده",
L"نژاد",
L"صفری",
L"جعفری",
L"محمدی",
L"اکبری",
L"میرزایی",
L"فرهادی",
L"رستمی",
L"نوری",
L"جلالی",
L"حسینی",
L"رسولی",
L"موسوی",
L"یوسفی",
L"مقدم",
L"پورمحمد",
L"بهرامی",
L"قربانی",
L"فیاض",
L"فرجی",
L"بخشی",
L"بهشتی",
L"سلطانی",
L"قاسمی",
L"جوادی",
L"جهانگیری",
L"نصیری",
L"عبداللهی",
L"علیزاده",
L"مجد",
L"مظاهری",
L"هاشمی",
L"پارسا",
L"پیروز",
L"حقیقت",
L"راد",
L"زمانی",
L"سلمانی",
L"شیرازی",
L"قنبری",
L"طاهری",
L"مهدوی",
L"نعمتی",
L"وکیلی",
L"کاظمی",
L"رئیسی",
L"میری",
L"سلیمانی",
L"مومنی",
L"جوکار",
L"بنیادی",
L"حیدری",
L"افشار",
L"شمس",
L"کشاورز",
L"رشیدی",
L"صادقی",
L"حق‌پرست",
L"بیگی",
L"حسن‌زاده",
L"قریشی",
L"بابایی",
L"نعیمی",
L"موحد",
L"خضری",
L"داوری",
L"نیکو",
L"پورجعفر",
L"طباطبایی",
L"گلزار",
L"صباحی",
L"خزایی",
L"رفیعی",
L"حقی",
L"هاشمیان",
L"سجادی",
L"توکلی",
L"یزدانی",
L"شهیدی",
L"پورفرج",
L"آقاجانی",
L"پارسایی",
L"نادری",
L"آهنگری",
L"اکتایی",
L"زند",
L"تقی‌زاده",
L"جوانمرد",
L"محمدیان",
L"خلج",
L"زندی",
L"سلیمی",
L"سلطانپور",
L"کمالی",
L"باقری",
L"فرج‌اللهی",
L"زنجانی",
L"مهدی‌زاده",
L"فرجامی",
L"قنبرزاده",
L"رهنما",
L"خسروجاه",
L"تهرانی",
L"اسدی",
L"معتمدی",
L"حسینی‌نژاد",
L"نظری"};
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b
}
17 changes: 1 addition & 16 deletions src/modules/person/data/iran/PersianPeopleNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
#include "PersianFirstNames.h"
#include "PersianLastNames.h"
#include "PersianPrefixes.h"
<<<<<<< HEAD

=======
#include "../../../../common/StringHelper.h"
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b


namespace faker
{
const NameFormats persianPersonNameFormats{{{"{prefix} {firstName} {lastName}", 1}, {"{firstName} {lastName}", 9}}};

//Convert UTF16 to UTF8 for Persian characters then use the data.
<<<<<<< HEAD
const PeopleNames persianPeopleNames{{persianMalesFirstNames,
{},
persianLastNames,
Expand All @@ -26,17 +22,6 @@ const PeopleNames persianPeopleNames{{persianMalesFirstNames,
{},
persianLastNames,
persianFemalesPrefixes,
=======
const PeopleNames persianPeopleNames{{faker::StringHelper::convertToUTF8(persianMalesFirstNames),
{},
faker::StringHelper::convertToUTF8(persianLastNames),
faker::StringHelper::convertToUTF8(persianMalesPrefixes),
{}},
{faker::StringHelper::convertToUTF8(persianFemalesFirstNames),
{},
faker::StringHelper::convertToUTF8(persianLastNames),
faker::StringHelper::convertToUTF8(persianFemalesPrefixes),
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b
{}},
persianPersonNameFormats};

Expand Down
10 changes: 0 additions & 10 deletions src/modules/person/data/iran/PersianPrefixes.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<<<<<<< HEAD
#pragma once
=======
#pragma once
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b

#include <string>
#include <vector>

namespace faker
{
<<<<<<< HEAD
const std::vector<std::string> persianMalesPrefixes{"آقا", "دکتر", "استاد"};

const std::vector<std::string> persianFemalesPrefixes{"خانم", "دکتر", "استاد"};
=======
const std::vector<std::wstring> persianMalesPrefixes{L"آقا", L"دکتر", L"استاد"};

const std::vector<std::wstring> persianFemalesPrefixes{L"خانم", L"دکتر", L"استاد"};
>>>>>>> 36de5791406c2238d9c3fae6787ca4e44dc2d55b
}

0 comments on commit 0a1eb47

Please sign in to comment.