AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Singular and Plural form detection?
 
 

Hi,
I know I could build a table of ‘things’ and include singular and plural forms.  This table would be very large.  The table still might not be able to determine or resolve an unknown word’s singular or plural form.

What I’m wanting to know are other ideas for detecting or converting the two forms. I’m curious what you may have done.

If the human asks “How many chairs are there?”, and there is only one chair, the bot should not respond with ‘There is one chairs’...but with ‘chair’ singular.

Incidentally this is the problem I’m now working on with my small project about ‘relative space’...and I’m looking for fresh ideas from my own.

Thanks,
Chuck

 

 
  [ # 1 ]

Fortunately, most plurals in English just require adding/stripping of an “s” or “es”. I built a module with standard rules for when to add and drop these from words, including common exceptions (for example, a word ending in “ss” is probably singular, and to pluralize, add “es”). To check, the module can look up the word in WordNet to see if it exists as a singular noun. Any exceptions are written to a list that the module checks against (for example, “ox” -> “oxen”).

Incidently, ALEX identifies anything “left over” after pos tagging as a noun and therefore doesn’t explicitly care if a word is singular or plural. And noun-verb congruence isn’t necessary for parse tree generation. Therefore this isn’t really a practical problem. However, the knowledge base tags every simple sentence with an ID that has the form subject_verb_number, where the subject is a noun or noun phrase in its singular form and the verb is the infinitive form of the main verb. This is where single/plural solution described above is implemented.

 

 
  [ # 2 ]

For the most part, CR’s implementation suggestion should do well for you. It’s when you get into “special case” words (e.g. moose, goose, octopus, etc.) where you’ll have difficulties, and where WordNet will prove to of inestimable value. I’m still working out how to use WordNet with my various projects, though, so any insights there from me will probably be “less than useful”. smile

 

 
  [ # 3 ]

“There is one chairs” can be prevented by doing something like (in Ruby):

s = ‘s’; if num == 1 then s = ‘’ end
be = “is”; if num == 0 or num > 1 then be = “are” end

puts “There #{be} #{num} chair#{s}.”

Then if “num” is set to, say, zero, the output will be “There are 0 chairs.”

 

 
  [ # 4 ]
Chuck Bolin - Apr 13, 2011:

Hi,
What I’m wanting to know are other ideas for detecting or converting the two forms. I’m curious what you may have done.

There’s an open source python library called “inflect” which specializes in such things.
You may want to try it out: http://pypi.python.org/pypi/inflect/0.2.1

 

 

 
  login or register to react