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

Weight genders in faker.person.gender() #1730

Open
matthewmayer opened this issue Jan 11, 2023 · 5 comments
Open

Weight genders in faker.person.gender() #1730

matthewmayer opened this issue Jan 11, 2023 · 5 comments
Labels
c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs m: person Something is referring to the person module s: waiting for user interest Waiting for more users interested in this feature
Milestone

Comments

@matthewmayer
Copy link
Contributor

matthewmayer commented Jan 11, 2023

Clear and concise description of the problem

faker.person.gender() pulls from a list of genders at https://github.com/faker-js/faker/blob/next/src/locales/en/person/gender.ts

This is a very inclusive list, however I feel it makes the function less realistic to have all values returned with equal probability. In reality, even in fairly LGBTQ-friendly countries, the percentage of people who define as non-cis-gender is fairly low https://www.bbc.com/news/uk-64184736

Suggested solution

Now that we have faker.helpers.weightedArrayElement i think we could change this so for example it returns "Man" 45% of the time, "Woman" 45% of the time, and one of the other genders 10% of the time (divided equally between the other 73 options)

Alternative

Keep current behavior (unrealistic)
Only return Man or Woman (non-inclusive)

Additional context

No response

@matthewmayer matthewmayer added the s: pending triage Pending Triage label Jan 11, 2023
@Shinigami92
Copy link
Member

-> Keep current behavior (unrealistic)

When someone already calls the method, they intend to get just some random data for e.g. testing an input like a gender free text field on Facebook or whatever platform.

It is not meant to represent realistic data neither IMO Faker is not meant to be a real world database for everything.

Implementing weight into all and everything inside Faker is a non goal to me.

@matthewmayer
Copy link
Contributor Author

I guess it depends what you mean by "but realistic" in the tagline:

Generate massive amounts of fake (but realistic) data for testing and development.

i think in some cases like the name patterns, adding weights makes the data more realistic.

@ejcheng ejcheng added s: needs decision Needs team/maintainer decision c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs m: person Something is referring to the person module and removed s: pending triage Pending Triage labels Jan 11, 2023
@ST-DDT
Copy link
Member

ST-DDT commented Jan 11, 2023

I agree, that we should somewhat balance the genders.
However I would keep it simple and just do 90% any binary gender and 10% non-binary/any genders, hardcoded in the method and not in the data.

@ST-DDT ST-DDT moved this to Todo in Faker Roadmap Jan 11, 2023
@ST-DDT
Copy link
Member

ST-DDT commented Mar 16, 2023

Workaround:

faker.datatype.boolean({ probability }) ? faker.person.sex() : faker.person.gender()

If you are interested in this feature, please upvote it.

@ST-DDT ST-DDT added s: waiting for user interest Waiting for more users interested in this feature and removed s: needs decision Needs team/maintainer decision labels Mar 16, 2023
@ST-DDT ST-DDT added this to the vFuture milestone Mar 16, 2023
@ST-DDT ST-DDT added s: waiting for user interest Waiting for more users interested in this feature and removed s: waiting for user interest Waiting for more users interested in this feature labels May 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community:

  • If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
  • If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.

We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements.

We will start the implementation based on:

  • the number of votes (:+1:) and comments
  • the relevance for the ecosystem
  • availability of alternatives and workarounds
  • and the complexity of the requested feature

We do this because:

  • There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
  • Every feature we add to faker has "costs" associated to it:
    • initial costs: design, implementation, reviews, documentation
    • running costs: awareness of the feature itself, more complex module structure, increased bundle size, more work during refactors

View more issues which are waiting for user interest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs m: person Something is referring to the person module s: waiting for user interest Waiting for more users interested in this feature
Projects
No open projects
Status: Todo
Development

No branches or pull requests

4 participants