public void HandelNumbers() { using (var recognizer = new NLLanguageRecognizer()) { Assert.That(recognizer.DominantLanguage, Is.EqualTo(NLLanguage.Unevaluated), "DominantLanguage/Pre-Process"); var text = "2"; recognizer.Process(text); Assert.That(recognizer.DominantLanguage, Is.EqualTo(NLLanguage.Unevaluated), "DominantLanguage/Post-Process"); } }
partial void HandleLanguageProbabilitiesButtonTap(UIButton sender) { UserInput.ResignFirstResponder(); if (!String.IsNullOrWhiteSpace(UserInput.Text)) { var recognizer = new NLLanguageRecognizer(); recognizer.Process(UserInput.Text); probabilities = recognizer.GetNativeLanguageHypotheses(10); PerformSegue(ShowLanguageProbabilitiesSegue, this); } }
public void Process() { using (var recognizer = new NLLanguageRecognizer()) { var languages = new Dictionary <NLLanguage, double> () { { NLLanguage.German, 1 }, { NLLanguage.Spanish, 10 }, }; Assert.That(recognizer.LanguageHints.Count, Is.EqualTo(0), "LanguageHints/0"); recognizer.LanguageHints = languages; Assert.That(recognizer.LanguageHints.Count, Is.EqualTo(2), "LanguageHints/2"); Assert.That(recognizer.DominantLanguage, Is.EqualTo(NLLanguage.Unevaluated), "DominantLanguage/Pre-Process"); var text = "Die Kleinen haben friedlich zusammen gespielt."; recognizer.Process(text); Assert.That(recognizer.DominantLanguage, Is.EqualTo(NLLanguage.German), "DominantLanguage/Post-Process"); // just test that we do return something. We are not testing the API perse. var hypo = recognizer.GetLanguageHypotheses(5); Assert.That(hypo.Count, Is.GreaterThan(0), "GetLanguageHypotheses"); } }