Version 6 of English plurals

Updated 2001-12-04 21:17:34

Richard Suchenwirth - Peter Lewerin needed one for Tcl-PLEAC (see BOOK Programming Language Examples Alike Cookbook), so here goes (never written that may returns in my Tcl life ;-):

 proc en:pl word {
    switch -- $word {
        man   {return men}
        foot  {return feet}
        goose {return geese}
        louse {return lice}
        mouse {return mice}
        ox    {return oxen}
        tooth {return teeth}
        auto - chief - kangaroo - kilo - memo 
        - photo - piano - pimento - pro - solo - soprano - studio
        - tattoo - video - zoo {return ${word}s}
        cod - deer - fish - offspring - perch - sheep 
        - trout {return $word ;# no special plural form}
    }
    switch -regexp -- $word {
      {[ei]x$}                  {return [string range $word 0 end-2]ices}
      {[sc]h$} - {[soxz]$}      {return ${word}es}
      {[bcdfghjklmnprstvwxz]y$} {return [string range $word 0 end-1]ies}
      {f$}                      {return [string range $word 0 end-1]ves}
      {fe$}                     {return [string range $word 0 end-2]ves}
      {child$}                  {return ${word}ren}
      {woman$}                  {return [string range $word 0 end-2]en}
      default                   {return ${word}s}
    }
 }

No warranty, but enjoy, and feel free to improve!


Arts and crafts of Tcl-Tk programming