I have a program where I give it a noun and it checks in its database with a table of nouns, to see if that noun is there.
That works find for singular nouns.
eg.
User types, 'What is a tree?'
program searches 'tree'.
But for 'What are trees? '
The program will search for 'trees', however the database only stores nouns in singular form, so it will not be found.
I was thinking about taking off the last s before I do the search.
eg.
if ((searchnoun.charAt(searchnoun.length-1))=== 's')
{ searchnoun = searchnoun.(take off last s);}
however that will not work for nouns that are not plurals that end in 's'
such as:
Megalosaurus, Stegosaurus, Jesus, mass, bass, physics and quite a lot of others..
I could make a list of words ending in s that are not plurals and search if it is in that list first, if it is do not cut the last 's' off, otherwise do..
And I would do a similar thing for words ending in 'es' unless they are in the list of non-plural words that end in 'es'.
Is there a better way of doing this?