public string GetAnalysisStringFromWordList(List <string> words) { List <string> memory = new List <string>(); for (int index = 0; index < this.LearningLength; ++index) { memory.Add(words[words.Count - this.LearningLength + index]); } return(Corpus.ConvertMemoryToString(memory)); }
public void LearnText(string input) { List <string> memory = new List <string>(); for (int index = 0; index < this.LearningLength; ++index) { memory.Add((string)null); } foreach (string str1 in input.Split(Utils.WhitespaceDelim, StringSplitOptions.RemoveEmptyEntries)) { string key = Corpus.ConvertMemoryToString(memory); Dictionary <string, int> dictionary1; if (this.data.ContainsKey(key)) { dictionary1 = this.data[key]; } else { dictionary1 = new Dictionary <string, int>(); try { this.data.Add(key, dictionary1); } catch (OutOfMemoryException ex) { break; } } string str2 = str1; if (dictionary1.ContainsKey(str2)) { Dictionary <string, int> dictionary2; string index; (dictionary2 = dictionary1)[index = str2] = dictionary2[index] + 1; } else { dictionary1.Add(str2, 1); } try { this.data[key] = dictionary1; } catch (OutOfMemoryException ex) { break; } if (Corpus.WordEndsWithSentenceEnder(str2)) { for (int index = 0; index < this.LearningLength; ++index) { memory[index] = (string)null; } } else { memory.Add(str2); memory.RemoveAt(0); } } }