static PredictionDictionary CreateDictionary(IEnumerable <string> sentences) { var environment = new TestPredictionEnvironment(); var dictionary = PredictionDictionary.Create(environment); foreach (var sentence in sentences) { var position = sentence.PunctuationLength(0); var words = new List <string>(); while (position < sentence.Length) { var wordLength = sentence.WordLength(position); var word = sentence.Substring(position, wordLength).ToLowerInvariant(); position += wordLength; position += sentence.PunctuationLength(position); words.Add(word); } dictionary.AddPhrase(words.ToArray()); } return(dictionary); }
public void AllTestPhrases() { var environment = new TestPredictionEnvironment(); var dictionary = PredictionDictionary.Create(environment); foreach (var sentence in TestSentences.Instance) { var position = sentence.PunctuationLength(0); var words = new List <string>(); while (position < sentence.Length) { var wordLength = sentence.WordLength(position); var word = sentence.Substring(position, wordLength).ToLowerInvariant(); position += wordLength; position += sentence.PunctuationLength(position); words.Add(word); } dictionary.AddPhrase(words.ToArray()); } dictionary.Dump(); }
public void SimpleQuickBrownFox() { var environment = new TestPredictionEnvironment(); var dictionary = PredictionDictionary.Create(environment); dictionary.AddPhrase("the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"); dictionary.Dump(); }
public void OrderNeutrality() { var environment = new TestPredictionEnvironment(); var dictionaryAB = PredictionDictionary.Create(environment); dictionaryAB.AddPhrase("A"); dictionaryAB.AddPhrase("B"); var dictionaryBA = PredictionDictionary.Create(environment); dictionaryBA.AddPhrase("B"); dictionaryBA.AddPhrase("A"); }
public void WarAndPeaceFireUp() { var environment = new TestPredictionEnvironment(Resources.spoken); var predictor = PredictionEngineFactory.Create(environment); }