public List<string> Generate() { var rtVal = new List<string>(); while (!End) { var str = string.Empty; var LastType = new Word(string.Empty); for (int i = 0; i < _indices.Count; i++) { int index = _indices[i]; if (LastType.Type == "SUBJECT") { str += VerbTense.ConvertToPresent(LastType,_inputList[i][index].Value )+ " "; } else { str += _inputList[i][index].Value + " "; } LastType.Type = _inputList[i].Type; LastType.Value = _inputList[i][index].Value; } rtVal.Add(str); Increment(); } return rtVal; }
public static string ConvertToPresent(Word lastWord, string verb) { if (lastWord.Type == "SUBJECT" && lastWord.Value.ToUpper() == "I") { var verbT = verb.ToUpper(); if (verbT == "IS") { verb = "am"; } return verb; }else if (lastWord.Type == "SUBJECT" && IsPlural(lastWord.Value)) { var verbT = verb.ToUpper(); if (verbT == "IS") { verb = "are"; } return verb; } else { var verbT = verb.ToUpper(); if (verbT == "IS") { return verb; } else { if (verb[verb.Length - 1] == 'h') { return verb + "es"; } return verb + "s"; } } }
public static string ConvertToSimplePast(Word lastWord, string verb) { var item = ConstantValue.GetIrregularVerbs().FirstOrDefault(c => c.Infinitive == verb); if (item != null) { //always get the first Item return item.SimplePast.Split(',')[0].Trim(); } if (verb[verb.Length - 1] == 'e') { return verb + "d"; } return verb + "ed"; }