public string Handle(string verb, Verbs.Convert convert) { verb = InputToBase(verb); if (verb == "shall" || verb == "should" || verb == "will" || verb == "would" || verb == "may" || verb == "might" || verb == "can" || verb == "could" || verb == "must") { return(verb); } switch (convert) { case Verbs.Convert.ext_V: return(verb); case Verbs.Convert.ext_Vs: return(ComposePresent(verb)); case Verbs.Convert.ext_Ving: return(ComposePrespart(verb)); case Verbs.Convert.ext_Ved: return(ComposePast(verb)); case Verbs.Convert.ext_Ven: return(ComposePastpart(verb)); } return(verb); }
public VerbSubVariable(string name, Verbs verbs, string pos, Verbs.Convert inflection) : base(name) { this.verbs = verbs; this.pos = pos; this.inflection = inflection; }
// compase a conjugation of the verb to have public static string ComposeToHave(Verbs.Person person, Verbs.Convert convert) { if (convert == Verbs.Convert.ext_Ved) { return("had"); } if (convert == Verbs.Convert.ext_Vs) { return((person == Verbs.Person.ThirdSingle) ? "has" : "have"); } if (convert == Verbs.Convert.ext_Ving) { return("having"); } if (convert == Verbs.Convert.ext_Ven) { return("had"); } return("have"); }
// compose a conjugation of the verb to do public static string ComposeToDo(Verbs.Person person, Verbs.Convert convert) { if (convert == Verbs.Convert.ext_Ved) { return("did"); } if (convert == Verbs.Convert.ext_Vs) { return(person == Verbs.Person.ThirdSingle ? "does" : "do"); } if (convert == Verbs.Convert.ext_Ving) { return("doing"); } if (convert == Verbs.Convert.ext_Ven) { return("done"); } return("do"); }
// compse a conjugation of the verb to be public static string ComposeToBe(Verbs.Person person, Verbs.Convert convert) { if (convert == Verbs.Convert.ext_Ved) { return((person == Verbs.Person.FirstSingle || person == Verbs.Person.ThirdSingle) ? "was" : "were"); } if (convert == Verbs.Convert.ext_Vs) { return(person == Verbs.Person.FirstSingle ? "am" : (person == Verbs.Person.ThirdSingle ? "is" : "are")); } if (convert == Verbs.Convert.ext_Ving) { return("being"); } if (convert == Verbs.Convert.ext_Ven) { return("been"); } return("be"); }
// inflect a verb, appropriate to a given person for irregulars public string ComposePersonable(string verb, Verbs.Person person, Verbs.Convert convert) { if (Verbs.IsToBe(verb)) { return(Verbs.ComposeToBe(person, convert)); } if (Verbs.IsToDo(verb)) { return(Verbs.ComposeToDo(person, convert)); } if (Verbs.IsToHave(verb)) { return(Verbs.ComposeToHave(person, convert)); } if (convert == Verbs.Convert.ext_Vs && person != Verbs.Person.ThirdSingle) { return(InflectVerb(verb, Verbs.Convert.ext_V)); } else { return(InflectVerb(verb, convert)); } }
// input is converted to base form Verbs.VerbType CheckVerb(ref string input, out Verbs.Convert convert) { // look it up in the verb table first TwoTuple <string, string> convinfo; if (verbsData.base_past.TryGetValue(input, out convinfo)) { convert = Verbs.Convert.ext_Vs; if (convinfo.two == "I") { return(Verbs.VerbType.VI); } else if (convinfo.two == "T") { return(Verbs.VerbType.VT); } else { return(Verbs.VerbType.VE); } } if (input.EndsWith("s")) { convert = Verbs.Convert.ext_Vs; if (verbsData.verb_S.TryGetValue(input, out convinfo)) { input = convinfo.one; if (convinfo.two == "I") { return(Verbs.VerbType.VI); } else if (convinfo.two == "T") { return(Verbs.VerbType.VT); } else { return(Verbs.VerbType.VE); } } else { input = conjugator.SItBase(input); if (verbsData.intransitive.ContainsKey(input)) { return(Verbs.VerbType.VI); } else if (verbsData.transitive.ContainsKey(input)) { return(Verbs.VerbType.VT); } else if (verbsData.either.ContainsKey(input)) { return(Verbs.VerbType.VE); } } } else if (input.EndsWith("ing")) { convert = Verbs.Convert.ext_Ving; if (verbsData.verb_ING.TryGetValue(input, out convinfo)) { input = convinfo.one; if (convinfo.two == "I") { return(Verbs.VerbType.VI_ING); } else if (convinfo.two == "T") { return(Verbs.VerbType.VT_ING); } else { return(Verbs.VerbType.VE_ING); } } else { input = conjugator.GItBase(input); if (verbsData.intransitive.ContainsKey(input)) { return(Verbs.VerbType.VI_ING); } else if (verbsData.transitive.ContainsKey(input)) { return(Verbs.VerbType.VT_ING); } else if (verbsData.either.ContainsKey(input)) { return(Verbs.VerbType.VE_ING); } } } else { if (verbsData.past_base.TryGetValue(input, out convinfo)) { convert = Verbs.Convert.ext_Ven; input = convinfo.one; if (convinfo.two == "I") { return(Verbs.VerbType.VI_EN); } else if (convinfo.two == "T") { return(Verbs.VerbType.VT_EN); } else { return(Verbs.VerbType.VE_EN); } } if (verbsData.verb_ED.TryGetValue(input, out convinfo)) { convert = Verbs.Convert.ext_Ven; input = convinfo.one; if (convinfo.two == "I") { return(Verbs.VerbType.VI_EN); } else if (convinfo.two == "T") { return(Verbs.VerbType.VT_EN); } else { return(Verbs.VerbType.VE_EN); } } else { if (input.EndsWith("ed") && input != "need") { string alt = ""; CheckEDVerb(ref input, out alt); convert = Verbs.Convert.ext_Ven; if (verbsData.intransitive.ContainsKey(input)) { return(Verbs.VerbType.VI_EN); } else if (verbsData.transitive.ContainsKey(input)) { return(Verbs.VerbType.VT_EN); } else if (verbsData.either.ContainsKey(input)) { return(Verbs.VerbType.VE_EN); } // first one didn't work but do we have an alternative? if (alt.Length > 0) { if (verbsData.intransitive.ContainsKey(input)) { input = alt; return(Verbs.VerbType.VI_EN); } else if (verbsData.transitive.ContainsKey(input)) { input = alt; return(Verbs.VerbType.VT_EN); } else if (verbsData.either.ContainsKey(input)) { input = alt; return(Verbs.VerbType.VE_EN); } } } else { convert = Verbs.Convert.ext_Vs; if (verbsData.intransitive.ContainsKey(input)) { return(Verbs.VerbType.VI); } else if (verbsData.transitive.ContainsKey(input)) { return(Verbs.VerbType.VT); } else if (verbsData.either.ContainsKey(input)) { return(Verbs.VerbType.VE); } } } } return(Verbs.VerbType.NotVerb); }
public VerbSubDeclination(Verbs verbs, string pos, Verbs.Convert inflection) { this.verbs = verbs; this.pos = pos; this.inflection = inflection; }