Learn R Programming

SemNetCleaner (version 1.1.1)

singularize: Converts Words to their Singular Form

Description

A function to change words to their singular form. The rules for converting words to their singular forms are based on the opposite of the grammar rules found here: https://www.grammarly.com/blog/plural-nouns/. This function does not handle special cases, so particular care is necessary.

Usage

singularize(word)

Arguments

word

A word

Value

Returns the word in singular form

Examples

Run this code
# NOT RUN {
# 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")

# }

Run the code above in your browser using DataLab