<- list(name = "ben",
ben subject = c("he","she","they"),
object = c("him","her","their"),
dependent = c("his","her","their"),
independent = c("his","hers","theirs"),
reflextive = c("himself","herself","themself"))
An R function for pronouns
People can have pronouns that change over time or multiple pronouns, like myself. In an ideal world, I’d love it if people used a random pronoun each time, but people aren’t random number generators and when presented with “any pronouns” will usually default to exclusively “he”.
This got me thinking though… What if I could randomly sample from a list of pronouns? So that’s what I’ve done — for Quarto users at least. It’s simple really, all you need to do is define each person’s pronouns:
I have to thank Wikipedia for providing the names of the different pronoun forms, it’s been a couple of decades since I had to think about this. Now we can just write a little function that samples from this list and returns the appropriate pronoun, in the format required.
<- function(who, which, format = "lower"){
pronoun if (format == "title") {
gsub("(\\w)(\\w*)", "\\U\\1\\L\\2", sample(who[[which]],1), perl=TRUE)
else {
} sample(who[[which]],1)
}
}
pronoun(ben,"subject","title")
[1] "He"
To use this, you would just call the function in-text like you would any R function. I was very satisfied getting to this point (and figuring out how to do it in base R), but then I realised that English is a very annoying language. The particularly annoying part is that because any of he, she, and they could be picked, it’s hard to know what the right verb to choose is. To illustrate:
` r pronoun(ben,"subject","title")` likes greyhounds
Is returned as:
She likes greyhounds
In my Quarto file I have no idea which pronoun is going to get picked (yay!) but depending on which one gets picked, I should’ve used ‘like’ or ‘likes’.
Well that’s a future me problem, this was just a fun little proof of concept. If I come back around to this, maybe I’ll:
- Extend the function to cover verbs
- Integrate it with YAML somehow? It’d be cool to attach pronouns to author YAML and turn the function into a Quarto extension