function s = string_plural(s)

% string_plural - attempt to pluralize a string
%-----------------------------------
%
% s = string_plural(s)
%
% Inputs:
% -------
%  s - string
%
% Outputs:
% --------
%  s - 'pluralized' string

%--------------------------------
% Author: Matt Robbins
%--------------------------------
% $Revision: 1982 $
% $Date: 2005-10-24 11:59:36 -0400 (Mon, 24 Oct 2005) $
%--------------------------------

if ~isstr(s)
	error('Input must be string.');
end

n = numel(s);

if s(end) == 'o'
	s = [s, 'es']; return;
end

if s(end) == 'y' && ~is_vowel(s(end-1))
	s(end:end + 2) = 'ies'; return;
end

if strfind(s, 'sh') == n - 1
	s = [s, 'es']; return;
end

if strfind(s, 'um') == n - 1
	s(end) = ''; s(end) = 'a'; return;
end

if strfind(s, 'us') == n - 1
	s(end) = ''; s(end) = 'i'; return;
end

s = [s, 's'];


%-----------------------
% IS_VOWEL
%-----------------------

function out = is_vowel(c)

vowels = 'ieaou';

out = 0;

if any(c == vowels)
	out = 1;
end

