示例#1
0
 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++;
     }
 }
示例#2
0
        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);
        }
示例#3
0
        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);
		}
示例#5
0
 public Prosebreaker(string dictPath)
 {
     vocabulary = new Vocabulary(dictPath);
 }
示例#6
0
 public override string ToString()
 {
     return(Vocabulary.PartToString(part));
 }