singularize | R Documentation |
A function to change words to their singular form. The rules for converting words to their singular forms are based on the inverse of the grammar rules found here: https://www.grammarly.com/blog/plural-nouns/. This function handles most special cases and some irregular cases (see examples) but caution is necessary. If no singular form is identified, then the original word is returned.
singularize(word, dictionary = TRUE)
word |
Character. A word |
dictionary |
Boolean.
Should dictionary be used to verify word exists?
Default to |
Returns the word in singular form, unless a singular form could not be found (then the original word is returned)
Alexander Christensen <alexpaulchristensen@gmail.com>
# Handles any prototypical cases # "dog" singularize("dogs") # "fox" singularize("foxes") # "wolf" singularize("wolves") # "octopus" singularize("octopi") # "taxon" singularize("taxa") # And most special cases: # "wife" singularize("wives") # "fez" singularize("fezzes") # "roof" singularize("roofs") # "photo" singularize("photos") # And some irregular cases: # "child" singularize("children") # "tooth" singularize("teeth") # "mouse" singularize("mice")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.