using System.Collections.Generic;
public static void Main()
Random rand = new Random();
List<Verb> verbList = BuildVerbList();
List<Case> caseList = BuildCaseList();
verbList = BuildVerbList();
foreach (Verb verb in verbList)
foreach (Case sCase in caseList)
verbList = BuildVerbList();
Subject sj_gary = new Subject("Gary");
Predicate pd_beHungry = new Predicate(vb_be, verb);
Clause garyIsHungry = new Clause(sj_gary, pd_beHungry, sCase);
Console.WriteLine(Sentence.BuildSimple(garyIsHungry));
public static List<Verb> BuildVerbList()
List<Verb> verbList = new List<Verb>();
Verb climb = new Verb("climb");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple"), "climbed");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple"), "climbs");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple"), "climb");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect"), "climbed");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect"), "climbed");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect"), "climbed");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple",affirmation:"negative"), "climb");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple",affirmation:"negative"), "climb");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple",affirmation:"negative"), "climb");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect",affirmation:"negative"), "climbed");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect",affirmation:"negative"), "climbed");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect",affirmation:"negative"), "climbed");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive",affirmation:"negative"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive",affirmation:"negative"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive",affirmation:"negative"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog",affirmation:"negative"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog",affirmation:"negative"), "climbing");
climb.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog",affirmation:"negative"), "climbing");
Verb think = new Verb("think");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple"), "thinked");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple"), "thinks");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple"), "think");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect"), "thought");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect"), "thought");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect"), "thought");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple",affirmation:"negative"), "think");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple",affirmation:"negative"), "think");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple",affirmation:"negative"), "think");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect",affirmation:"negative"), "thought");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect",affirmation:"negative"), "thought");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect",affirmation:"negative"), "thought");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive",affirmation:"negative"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive",affirmation:"negative"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive",affirmation:"negative"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog",affirmation:"negative"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog",affirmation:"negative"), "thinking");
think.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog",affirmation:"negative"), "thinking");
Verb die = new Verb("die");
die.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple"), "died");
die.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple"), "dies");
die.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple"), "die");
die.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect"), "died");
die.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect"), "died");
die.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect"), "died");
die.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive"), "dieing");
die.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive"), "dieing");
die.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive"), "dieing");
die.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog"), "dieing");
die.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog"), "dieing");
die.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog"), "dieing");
Verb talk = new Verb("talk");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple"), "talked");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple"), "talks");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple"), "talk");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect"), "talked");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect"), "talked");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect"), "talked");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive"), "talking");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive"), "talking");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive"), "talking");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog"), "talking");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog"), "talking");
talk.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog"), "talking");
public static Verb CreateBe()
Verb be = new Verb("be");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple"), "");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple"), "");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple"), "will");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect"), "had");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect"), "has");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect"), "will have");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive"), "was");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive"), "is");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive"), "will be");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog"), "had been");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog"), "has been");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog"), "will have been");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "simple", affirmation:"negative"), "did not");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "simple", affirmation:"negative"), "does not");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "simple", affirmation:"negative"), "will not");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfect", affirmation:"negative"), "had not");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfect", affirmation:"negative"), "has not");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfect", affirmation:"negative"), "will not have");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "progressive", affirmation:"negative"), "was not");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "progressive", affirmation:"negative"), "is not");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "progressive", affirmation:"negative"), "will not be");
be.AddFormFromHash(Case.StaticCaseHash(tense: "past", person: "third", form: "perfprog", affirmation:"negative"), "had not been");
be.AddFormFromHash(Case.StaticCaseHash(tense: "present", person: "third", form: "perfprog", affirmation:"negative"), "has not been");
be.AddFormFromHash(Case.StaticCaseHash(tense: "future", person: "third", form: "perfprog", affirmation:"negative"), "will not have been");
public static List<Case> BuildCaseList()
List<Case> caseList = new List<Case>();
caseList.Add(new Case(tense: "past", person: "third", form: "simple"));
caseList.Add(new Case(tense: "present", person: "third", form: "simple"));
caseList.Add(new Case(tense: "future", person: "third", form: "simple"));
caseList.Add(new Case(tense: "past", person: "third", form: "perfect"));
caseList.Add(new Case(tense: "present", person: "third", form: "perfect"));
caseList.Add(new Case(tense: "future", person: "third", form: "perfect"));
caseList.Add(new Case(tense: "past", person: "third", form: "progressive"));
caseList.Add(new Case(tense: "present", person: "third", form: "progressive"));
caseList.Add(new Case(tense: "future", person: "third", form: "progressive"));
caseList.Add(new Case(tense: "past", person: "third", form: "perfprog"));
caseList.Add(new Case(tense: "present", person: "third", form: "perfprog"));
caseList.Add(new Case(tense: "future", person: "third", form: "perfprog"));
caseList.Add(new Case(tense: "past", person: "third", form: "simple", affirmation:"negative"));
caseList.Add(new Case(tense: "present", person: "third", form: "simple", affirmation:"negative"));
caseList.Add(new Case(tense: "future", person: "third", form: "simple", affirmation:"negative"));
caseList.Add(new Case(tense: "past", person: "third", form: "perfect", affirmation:"negative"));
caseList.Add(new Case(tense: "present", person: "third", form: "perfect", affirmation:"negative"));
caseList.Add(new Case(tense: "future", person: "third", form: "perfect", affirmation:"negative"));
caseList.Add(new Case(tense: "past", person: "third", form: "progressive", affirmation:"negative"));
caseList.Add(new Case(tense: "present", person: "third", form: "progressive", affirmation:"negative"));
caseList.Add(new Case(tense: "future", person: "third", form: "progressive", affirmation:"negative"));
caseList.Add(new Case(tense: "past", person: "third", form: "perfprog", affirmation:"negative"));
caseList.Add(new Case(tense: "present", person: "third", form: "perfprog", affirmation:"negative"));
caseList.Add(new Case(tense: "future", person: "third", form: "perfprog", affirmation:"negative"));
public string Affirmation;
public Case(string tense = "present", string number = "singular", string gender = "neuter", string person = "third", string form = "simple", string affirmation = "positive")
Affirmation = affirmation;
Console.WriteLine("Tense: " + Tense);
Console.WriteLine("Number: " + Number);
Console.WriteLine("Gender: " + Gender);
Console.WriteLine("Person: " + Person);
Console.WriteLine("Form: " + Form);
Console.WriteLine("Positive: " + Form);
return (Tense + Number + Gender + Person + Form + Affirmation).GetHashCode();
public static int StaticCaseHash(string tense = "present", string number = "singular", string gender = "neuter", string person = "third", string form = "simple", string affirmation = "positive")
return (tense + number + gender + person + form + affirmation).GetHashCode();
public static int GetDefaultHash()
return ("present"+"singular"+"neuter"+"third"+"simple"+"positive").GetHashCode();
public static string BuildSimple(Clause clause)
if (clause.ClauseCase.Person == "first")
if (clause.ClauseCase.Number == "singular")
sentenceSubject = clause.ClauseSubject.Name;
outputText += sentenceSubject;
outputText += clause.ClausePredicate.MainVerb.WithCase(clause.ClauseCase);
outputText += clause.ClausePredicate.StatementVerb.WithCase(clause.ClauseCase);
outputText = outputText.Replace(" "," ");
public Subject ClauseSubject;
public Predicate ClausePredicate;
public Clause(Subject clauseSubject, Predicate clausePredicate, Case clauseCase)
ClauseSubject = clauseSubject;
ClausePredicate = clausePredicate;
public Subject(string name)
public Verb StatementVerb;
public Predicate(Verb mainVerb, Verb statementVerb)
StatementVerb = statementVerb;
public Dictionary<int, string> Forms = new Dictionary<int, string>();
public void AddForm(Case vCase, string word)
Forms.Add(vCase.CaseHash(), word);
public void AddFormFromHash(int hash, string word)
public string WithCase(Case verbCase)
if (Forms.ContainsKey(verbCase.CaseHash()))
if (Forms[verbCase.CaseHash()] != null)
return Forms[verbCase.CaseHash()];
return Forms[Case.GetDefaultHash()];
return Forms[Case.GetDefaultHash()];
public Statement(string name)
public class GrammarController