示例#1
0
	public Facts() {
		FactChain = new Markov.MarkovChain<string>(1);

		var FactsFile = Resources.Load("facts") as TextAsset;
		var Facts = FactsFile.text.Split("\n"[0]);

		foreach (string line in Facts) {
			FactChain.Add (line.Split (' '));
		}
	}
示例#2
0
		private static MarkovChain<string> BuildSentenceChain(string resourceName, int order)
		{
			var sampleLines = SplitLines(ReadEmbeddedResource(resourceName).ToLower());
			var samples = sampleLines.Select(line => SplitWords(line));

			var chain = new MarkovChain<string>(order);
			foreach (var sample in samples)
			{
				chain.Add(sample, 1);
			}

			return chain;
		}