NAME

randomPerson.pl - Load macros for getting a random person with corresponding pronouns.

SYNOPSIS

loadMacros('randomPerson.pl');

DESCRIPTION

randomPerson.pl provides a randomPerson function that generates a random name that comes with corresponding pronouns and verb conjugation. The default subject pronouns are 'he', 'she', and 'they'.

This idea evolved from the PCCmacros.pl RandomName subroutine, extending it to cover pronouns and verb conjugation.

The first names (aka given names) were generated by randomly selecting 200 names from the United States Social Security Administration's top 1000 list (actually 1000 per gender) from 2005. The additional names associated with they/them pronouns were taken from a wikipedia list of public trans people who use they pronouns. The last names (aka surnames) were generated by randomly selecting 100 names from a list of top 1000 surnames in the United States in 2020, according to babynames.com, which used the 2020 US Census. That list was still lacking in representation of Asian, South Asian, and African surnames, so 12 popular names from these regions were added.

USAGE

First load the randomPerson macro with

loadMacros('randomPerson.pl');

and then call the randomPerson subroutine

$p = randomPerson();

The variable $p is now a Person object with methods to access the names, pronouns and verb conjugation. It can be used within a problem as

BEGIN_PGML
[$p] travels 1.5 miles to school.
After school, [$p->they] [$p->go] to work.
[$p->Their] dog greets [$p->them] when [$p->they] [$p->verb('get')] home.
The books on the table are [$p->theirs].
END_PGML

Depending on the he/she/they pronoun, the methods they, them, their and theirs (with or without capitalization) will select the correct subject, object, possession, possesive forms of the pronoun. Also, note that go is one of a few special verbs with irregular conjugation.

If you would like multiple people to be randomly choosen with unique names, use

@persons = randomPerson(n => 4);

generates an array of 4 unique Person objects.

Additionally, you can specify your own list of names and pronouns to draw from. For example

$p1 = randomPerson(names => [['Bart' => 'he'], ['Lisa' => 'she']]);

or without the pronouns, which will be assigned randomly from he/she/they:

$p2 = randomPerson(names => ['Bart', 'Lisa']);

To use pronouns beyond 'he', 'she', and 'they', first add the pronoun and its related forms like this:

$Person::PRONOUNS{'it'} = { possessive => 'its', possession => 'its', object => 'it' };

If a new pronoun is added, verb conjugation for that pronoun will match 'he'/'she' verb conjugation, not 'they' verb conjugation.

randomPerson

Returns a person as a Person object from a list in the macro.

Examples and options

randomLastName

This returns a random last name based on popular last names in the United States. Example

$p = randomLastName();

Note it is just a string, and doesn't have the pronouns that the Person object does.

If an array is requested and a number is passed in the form n => k (which defaults to 1), then an array of k unique last names is returned.

@lastnames = randomLastName(n => 4);

generates 4 unique last names.

CONSTRUCTOR Person

This makes a Person object to handle name and pronouns of a Person.

Make a Person with

Person->new(name => 'Roger', pronoun => 'he')

for example. This is used by the randomPerson method which returns a blessed Person object which can be used to write a problem with a random name with pronouns and verb conjugation.

name

This returns the name of the person.

$p = new Person(name => 'Roger', pronoun => 'he');
$p->name;

returns the name 'Roger'.

subject

These return the subject pronoun in lowercase. The second option is syntactic sugar.

$p->subject
$p->they

returns one of (he, she, they)

Subject

These return the subject pronoun, capitalized. The second option is syntactic sugar.

$p->Subject
$p->They

returns one of (He, She, They)

possessive

These return the possessive adjective in lowercase. The second option is syntactic sugar.

$p->possessive
$p->their

returns one of (his, her, their)

Possessive

These return the possessive adjective, capitalized. The second option is syntactic sugar.

$p->Possessive
$p->Their

returns one of (His, Her, Their)

possession

These return the possessive pronoun in lowercase. The second option is syntactic sugar.

$p->possession
$p->theirs

returns one of (his, hers, theirs)

Possession

These return the possessive pronoun, capitalized. The second option is syntactic sugar.

$p->Possession
%p->Theirs

returns one of (His, Hers, Theirs)

object

These return the object pronoun in lowercase. The second option is syntactic sugar.

$p->object
$p->them

returns one of (him, her, them)

one of Object

These return the object pronoun, capitalized. The second option is syntactic sugar.

$p->Object
$p->Them

returns (Him, Her, Them)

verb or Verb

Returns the correct conjugation of the verb. If only one argument is passed in, it should be a regular verb in the third person plural conjugation (the "they" version). For example:

$p1 = new Person(name => 'Roger', pronoun => 'he');
$p1->verb('find');

returns 'finds'. All that happens is an 's' or an 'es' is appended, or 'y'->'ies', according to some simple English conjugation rules.

$p2 = new Person(name => 'Max', pronoun => 'they');
$p2->verb('find')

returns 'find'. The verb can be called directly as a method as well.

If a second argument is passed, it should be the third person singular conjugation of the same verb (the "he/she" version). For example:

$p1 = new Person(name => 'Roger', pronoun => 'he');
$p1->verb('fly', 'flies');

returns 'flies'

$p2 = new Person(name => 'Max', pronoun => 'they');
$p2->verb('fly', 'flies');

returns 'fly'

Captilization can be done by capitalizing the verb. For example:

$p2 = new Person(name => 'Max', pronoun => 'they');
$p2->Verb('Say');

returns 'Say'.

do or Do

Returns the correct conjugation of to do with captilization. For example

$p->do;

or

$p->Do;

are or Are

Returns the correct conjugation of to be with captilization. For example

$p->are;

or

$p->Are;

go or Go

Returns the correct conjugation of to go with captilization. For example

$p->go;

or

$p->Go;

have or Have

Returns the correct conjugation of to have with captilization. For example

$p->have;

or

$p->Have;

were or Were

Returns the correct conjugation of past tense of to be with captilization. For example

$p->were;

or

$p->Were;

theyre or Theyre

Returns the correct contraction for the pronoun with to be, with captilization. For example

$p->theyre;

or

$p->Theyre;

theyve or Theyve

Returns the correct contraction for the pronoun with to have, with captilization. For example

$p->theyve;

or

$p->Theyve;