java-faker icon indicating copy to clipboard operation
java-faker copied to clipboard

For Name (Person) generate gender according the random first name

Open manueljordan opened this issue 6 years ago • 9 comments

Hello

Is possible to consider generate the gender according the generated first name?

The following is incorrect (ignore the last name part):

  • Maria, Perez, male
  • Tony, Fernandez, female
  • John, Wilson, female
  • Robert, Long, female
  • Alison, Waters, male

Should be:

  • Maria, Perez, female
  • Tony, Fernandez, male
  • John, Wilson, male
  • Robert, Long, male
  • Alison, Waters, female

Thanks for the understanding

Pretty nice this library so far!

manueljordan avatar Apr 23 '19 02:04 manueljordan

This will be a nice addition to have.

josepj avatar Apr 23 '19 18:04 josepj

similar to the change around cities and countries.. this is a non trivial change... I don't see this being added anytime soon..

codingricky avatar Apr 30 '19 02:04 codingricky

Hi @codingricky, I would like to help implement this feature and wanted to ask if you have any design suggestions on how this issue should be tackled. Thanks in advance.

haruntuncay avatar May 09 '19 13:05 haruntuncay

Sorry for the delay but I feel there's only 2 options.

  1. Use a 3rd party library/web service/api to determine the gender given a name.. so fetch a random name, ask for the gender of that name, if that's not right, then try again. I think there are significant negatives to introducing a dependency on a 3rd party web service
  2. Tag all the names with a gender, too much manual work I feel for this option

Not sure that either options are really that feasible unfortunately.

@haruntuncay

codingricky avatar Jul 20 '19 01:07 codingricky

2. Tag all the names with a gender, too much manual work I feel for this option

I also thought that this seems like the only option based on the current structure. Maybe we could generate a python script that uses 3rd party services via http to determine whether a name is male/female name and re-structure the yaml file automatically. This would help us avoid adding a dependency to the project and keep trying until it is right, as the first option describes.

Of course, we would have to generate separate scripts for country/address issue and this one (person/gender) and any other issues that will arise in the future that requests a similar merge option. Unless we find a better way to merge providers, generating scripts to automate the process seems like an approachable solution for now. What do you think @codingricky ?

haruntuncay avatar Jul 20 '19 07:07 haruntuncay

Hello

Tag all the names with a gender, too much manual work I feel for this option

I think it is the right path (even when at a first glance is verbose - it is), because it can be applied in some way for Country to City correct generation, and cellphone/phone correct random generation according a city (size of numbers and how they should start).

The point is implement this smoothly how a main factory to be applied for other extensions. Thus the .yml files would work in pairs.

Something like:

Person: Karla Cano, Claudia Canepa, Juan Ramirez [name and last name]
PersonWithSex: Karla Cano | Female, Claudia Canepa | Female, Juan Ramirez | Male 

Here comes the concept of Tuple

Just sharing ideas ...

manueljordan avatar Jul 20 '19 14:07 manueljordan

Hi, has there been any progress on this feature? If not, I'd like to work on this.

uroshekic avatar Oct 04 '19 12:10 uroshekic

I think the way to solve this is to generate femaleName and maleName. It's even a bit more complicated for czech language where the last name is also gender specific. And in name.yml there is a separation of names female_first_name and male_first_name In case we would add female_last_name and male_last_name we would be set for all options and random gender generation would be a piece of cake.

LuborVitek avatar Jan 18 '20 00:01 LuborVitek

I have implemented a simple function to generate name with gender like the examples you mentioned. (Maria Perez, female) (Tony, Fernandez, male) --SE_SUSTech, group: Lanrand

xiye2333333 avatar May 27 '22 18:05 xiye2333333