public bool TryInflect(string word, out IPluralForm inflection)
 {
     if(word.EndsWith(_suffix))
     {
         inflection = new SimplePluralForm(word + _extraSuffix, GetRule(word));
         return true;
     }
     inflection = null;
     return false;
 }
Esempio n. 2
0
 public bool TryInflect(string word, out IPluralForm inflection)
 {
     if (word.EndsWith(_suffix))
     {
         inflection = new SimplePluralForm(word + _extraSuffix, GetRule(word));
         return(true);
     }
     inflection = null;
     return(false);
 }
 public bool TryInflect(string word, out IPluralForm inflection)
 {
     if(word.EndsWith(_suffixMatch))
     {
         inflection = new SimplePluralForm(
             word.Substring(0, word.Length - _suffixToReplace.Length) + _suffixReplacement,
             GetRule(word));
         return true;
     }
     inflection = null;
     return false;
 }
Esempio n. 4
0
 public bool TryInflect(string word, out IPluralForm inflection)
 {
     if (word.EndsWith(_suffixMatch))
     {
         inflection = new SimplePluralForm(
             word.Substring(0, word.Length - _suffixToReplace.Length) + _suffixReplacement,
             GetRule(word));
         return(true);
     }
     inflection = null;
     return(false);
 }
Esempio n. 5
0
 public bool TryInflect(string word, out IPluralForm inflection)
 {
     // to allow for compound words like salesperson -> salespeople
     if(word.EndsWith(_wordToMatch))
     {
         inflection = new SimplePluralForm(
             word.Substring(0, word.Length - _wordToMatch.Length) + _replacement,
             GetRule(word));
         return true;
     }
     inflection = null;
     return false;
 }
Esempio n. 6
0
 public bool TryInflect(string word, out IPluralForm inflection)
 {
     // to allow for compound words like salesperson -> salespeople
     if (word.EndsWith(_wordToMatch))
     {
         inflection = new SimplePluralForm(
             word.Substring(0, word.Length - _wordToMatch.Length) + _replacement,
             GetRule(word));
         return(true);
     }
     inflection = null;
     return(false);
 }
Esempio n. 7
0
 public bool TryInflect(string word, out IPluralForm result)
 {
     var match = _regex.Match(word);
     if(match.Success)
     {
         if(match.Groups.Count == 1)
         {
             result = new SimplePluralForm(word + _groupReplacement, RuleDisplay);
         }
         else
         {
             var mgrp = match.Groups[1];
             var start = word.Substring(0, mgrp.Index);
             var end = word.Substring(mgrp.Index + mgrp.Length);
             result = new SimplePluralForm(start + _groupReplacement + end, RuleDisplay);
         }
         return true;
     }
     result = null;
     return false;
 }
Esempio n. 8
0
        public bool TryInflect(string word, out IPluralForm result)
        {
            var match = _regex.Match(word);

            if (match.Success)
            {
                if (match.Groups.Count == 1)
                {
                    result = new SimplePluralForm(word + _groupReplacement, RuleDisplay);
                }
                else
                {
                    var mgrp  = match.Groups[1];
                    var start = word.Substring(0, mgrp.Index);
                    var end   = word.Substring(mgrp.Index + mgrp.Length);
                    result = new SimplePluralForm(start + _groupReplacement + end, RuleDisplay);
                }
                return(true);
            }
            result = null;
            return(false);
        }