public Word(string inbound, bool first, Vocabulary vocabulary) { if (inbound.Length == 0) { Console.WriteLine ("STOP STOP STOP STOP STOP"); } name = inbound; part = vocabulary.GetSpeechPart (name); frequency++; if (first) { firstCount++; } }
public Word ChooseByGrammar(Vocabulary.SpeechPart nextPart, Random random) { Dictionary <Word, int> possibleFollowers = new Dictionary<Word, int> (); foreach (Word word in followers.Keys) { foreach (Vocabulary.SpeechPart part in Enum.GetValues (typeof(Vocabulary.SpeechPart))) { if (word.Part.HasFlag (part)) { //Console.Write (" YES " + word.Self + " as " + part + "."); possibleFollowers.Add (word, followers [word]); break; } // else { // Console.Write (" not " + word.Self + "."); // } } } if (possibleFollowers.Count == 0) { //Console.WriteLine ("Word.ChooseByGrammar: There is no " + nextPart + " that can follow " + this.Self + "."); return null; } return ChooseFollower (possibleFollowers, random); }
Word ChooseByPart(Vocabulary.SpeechPart part) { List <Word> options; int count, choice; if (!novel.CrossReference.ContainsKey (part)) { Console.WriteLine ("No " + part + " found in CrossReference."); return null; } options = novel.CrossReference[part]; count = options.Count; choice = novel.Rand.Next (0, count); return options[choice]; }
public Prosebreaker (string dictPath) { vocabulary = new Vocabulary (dictPath); }
public Prosebreaker(string dictPath) { vocabulary = new Vocabulary(dictPath); }
public override string ToString() { return(Vocabulary.PartToString(part)); }