public Markov(int randomnessLevel, string inputFileName, startForm controlForm)
{
k = randomnessLevel;
keys = new Queue<string>(k);
words = new List<string>();
wordGroups = new Dictionary<string, List<string>>();
statusForm = controlForm;
string line;
System.IO.StreamReader file = new System.IO.StreamReader(inputFileName);
while ((line = file.ReadLine()) != null)
{
statusForm.status = "Reading input...";
foreach(string s in line.Split(' '))
{
words.Add(cleanupString(s));
}
}
file.Close();
if (words.Count < (k + 1))
{
//To avoid trying to index outside of the array. Just adds the first word k more times.
//The output would have sucked anyway, so this won't throw it off very much.
for (int i = 0; i < k; i++)
{
words.Add(words[0]);
}
}
readWordGroups();
}