Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(person): avoid repeated last name via new last_name_patterns #1819

Merged
merged 10 commits into from
Feb 21, 2023
7 changes: 7 additions & 0 deletions src/definitions/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ export type PersonDefinitions = LocaleEntry<{
*/
name: Array<{ value: string; weight: number }>;

/**
* A weighted list of patterns used to generate last names.
*/
last_name_patterns?: Array<{ value: string; weight: number }>;
male_last_name_patterns?: Array<{ value: string; weight: number }>;
female_last_name_patterns?: Array<{ value: string; weight: number }>;

bio_patterns?: string[];

title: PersonTitleDefinitions;
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en_GB/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import type { LocaleDefinition } from '../..';
import cell_phone from './cell_phone';
import internet from './internet';
import location from './location';
import person from './person';
import phone_number from './phone_number';

const en_GB: LocaleDefinition = {
title: 'English (Great Britain)',
cell_phone,
internet,
location,
person,
phone_number,
};

Expand Down
14 changes: 14 additions & 0 deletions src/locales/en_GB/person/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* This file is automatically generated.
* Run 'pnpm run generate:locales' to update.
*/
import type { PersonDefinitions } from '../../..';
import last_name_patterns from './last_name_patterns';
import name_ from './name';

const person: PersonDefinitions = {
last_name_patterns,
name: name_,
};

export default person;
4 changes: 4 additions & 0 deletions src/locales/en_GB/person/last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default [
{ value: '{{person.last_name}}', weight: 9 },
{ value: '{{person.last_name}}-{{person.last_name}}', weight: 1 },
];
7 changes: 7 additions & 0 deletions src/locales/en_GB/person/name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default [
{ value: '{{person.firstName}} {{person.lastName}}', weight: 7 },
{
value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}',
weight: 1,
},
];
2 changes: 2 additions & 0 deletions src/locales/en_GH/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import type { PersonDefinitions } from '../../..';
import female_first_name from './female_first_name';
import first_name from './first_name';
import last_name from './last_name';
import last_name_patterns from './last_name_patterns';
import male_first_name from './male_first_name';
import name_ from './name';

const person: PersonDefinitions = {
female_first_name,
first_name,
last_name,
last_name_patterns,
male_first_name,
name: name_,
};
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en_GH/person/last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default [
{ value: '{{person.last_name}}', weight: 1 },
{ value: '{{person.last_name}}-{{person.last_name}}', weight: 1 },
];
4 changes: 0 additions & 4 deletions src/locales/en_GH/person/name.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export default [
{ value: '{{person.firstName}} {{person.lastName}}', weight: 1 },
{
value: '{{person.firstName}} {{person.lastName}}-{{person.lastName}}',
weight: 1,
},
];
2 changes: 2 additions & 0 deletions src/locales/es/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import female_first_name from './female_first_name';
import female_prefix from './female_prefix';
import first_name from './first_name';
import last_name from './last_name';
import last_name_patterns from './last_name_patterns';
import male_first_name from './male_first_name';
import male_prefix from './male_prefix';
import name_ from './name';
Expand All @@ -19,6 +20,7 @@ const person: PersonDefinitions = {
female_prefix,
first_name,
last_name,
last_name_patterns,
male_first_name,
male_prefix,
name: name_,
Expand Down
6 changes: 6 additions & 0 deletions src/locales/es/person/last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default [
{
value: '{{person.last_name}} {{person.last_name}}',
weight: 1,
},
];
5 changes: 2 additions & 3 deletions src/locales/es/person/name.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export default [
{
value:
'{{person.prefix}} {{person.firstName}} {{person.lastName}} {{person.lastName}}',
value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}',
weight: 1,
},
{
value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}',
value: '{{person.firstName}} {{person.lastName}}',
weight: 9,
},
];
2 changes: 2 additions & 0 deletions src/locales/es_MX/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import female_first_name from './female_first_name';
import female_prefix from './female_prefix';
import first_name from './first_name';
import last_name from './last_name';
import last_name_patterns from './last_name_patterns';
import male_first_name from './male_first_name';
import male_prefix from './male_prefix';
import name_ from './name';
Expand All @@ -19,6 +20,7 @@ const person: PersonDefinitions = {
female_prefix,
first_name,
last_name,
last_name_patterns,
male_first_name,
male_prefix,
name: name_,
Expand Down
10 changes: 10 additions & 0 deletions src/locales/es_MX/person/last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default [
{
value: '{{person.last_name}} {{person.last_name}}',
weight: 5,
},
{
value: '{{person.last_name}} de {{person.last_name}}',
weight: 1,
},
];
14 changes: 4 additions & 10 deletions src/locales/es_MX/person/name.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
export default [
{
value:
'{{person.prefix}} {{person.firstName}} {{person.lastName}} {{person.lastName}}',
value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}',
weight: 1,
},
{
value: '{{person.firstName}} {{person.lastName}} de {{person.lastName}}',
weight: 3,
value: '{{person.firstName}} {{person.lastName}}',
weight: 8,
},
{
value:
'{{person.suffix}} {{person.firstName}} {{person.lastName}} {{person.lastName}}',
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}',
weight: 1,
},
{
value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}',
weight: 5,
},
];
7 changes: 7 additions & 0 deletions src/locales/lv/person/female_last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default [
{ value: '{{person.female_last_name}}', weight: 8 },
{
value: '{{person.female_last_name}}-{{person.female_last_name}}',
weight: 2,
},
];
4 changes: 4 additions & 0 deletions src/locales/lv/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import type { PersonDefinitions } from '../../..';
import female_first_name from './female_first_name';
import female_last_name from './female_last_name';
import female_last_name_patterns from './female_last_name_patterns';
import female_prefix from './female_prefix';
import first_name from './first_name';
import male_first_name from './male_first_name';
import male_last_name from './male_last_name';
import male_last_name_patterns from './male_last_name_patterns';
import male_prefix from './male_prefix';
import name_ from './name';
import prefix from './prefix';
Expand All @@ -18,10 +20,12 @@ import title from './title';
const person: PersonDefinitions = {
female_first_name,
female_last_name,
female_last_name_patterns,
female_prefix,
first_name,
male_first_name,
male_last_name,
male_last_name_patterns,
male_prefix,
name: name_,
prefix,
Expand Down
4 changes: 4 additions & 0 deletions src/locales/lv/person/male_last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default [
{ value: '{{person.male_last_name}}', weight: 8 },
{ value: '{{person.male_last_name}}-{{person.male_last_name}}', weight: 2 },
];
9 changes: 0 additions & 9 deletions src/locales/lv/person/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,4 @@ export default [
weight: 1,
},
{ value: '{{person.firstName}} {{person.lastName}}', weight: 7 },
{ value: '{{person.lastName}} {{person.firstName}}', weight: 2 },
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
{
value: '{{person.firstName}} {{person.firstName}} {{person.lastName}}',
weight: 2,
},
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
{
value: '{{person.firstName}} {{person.lastName}}-{{person.lastName}}',
weight: 2,
},
];
2 changes: 2 additions & 0 deletions src/locales/nb_NO/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import female_first_name from './female_first_name';
import female_prefix from './female_prefix';
import first_name from './first_name';
import last_name from './last_name';
import last_name_patterns from './last_name_patterns';
import male_first_name from './male_first_name';
import male_prefix from './male_prefix';
import name_ from './name';
Expand All @@ -18,6 +19,7 @@ const person: PersonDefinitions = {
female_prefix,
first_name,
last_name,
last_name_patterns,
male_first_name,
male_prefix,
name: name_,
Expand Down
4 changes: 4 additions & 0 deletions src/locales/nb_NO/person/last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default [
{ value: '{{person.last_name}}', weight: 8 },
{ value: '{{person.last_name}} {{person.last_name}}', weight: 2 },
];
10 changes: 1 addition & 9 deletions src/locales/nb_NO/person/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,5 @@ export default [
value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}',
weight: 1,
},
{
value: '{{person.firstName}} {{person.firstName}} {{person.lastName}}',
weight: 1,
},
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
{
value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}',
weight: 1,
},
{ value: '{{person.firstName}} {{person.lastName}}', weight: 8 },
{ value: '{{person.firstName}} {{person.lastName}}', weight: 9 },
];
2 changes: 2 additions & 0 deletions src/locales/sv/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import female_first_name from './female_first_name';
import female_prefix from './female_prefix';
import first_name from './first_name';
import last_name from './last_name';
import last_name_patterns from './last_name_patterns';
import male_first_name from './male_first_name';
import male_prefix from './male_prefix';
import name_ from './name';
Expand All @@ -18,6 +19,7 @@ const person: PersonDefinitions = {
female_prefix,
first_name,
last_name,
last_name_patterns,
male_first_name,
male_prefix,
name: name_,
Expand Down
4 changes: 4 additions & 0 deletions src/locales/sv/person/last_name_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default [
{ value: '{{person.last_name}}', weight: 8 },
{ value: '{{person.last_name}} {{person.last_name}}', weight: 2 },
];
6 changes: 1 addition & 5 deletions src/locales/sv/person/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@ export default [
value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}',
weight: 1,
},
{ value: '{{person.firstName}} {{person.lastName}}', weight: 8 },
{
value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}',
weight: 1,
},
{ value: '{{person.firstName}} {{person.lastName}}', weight: 9 },
];
Loading