public void GetSuggestionCountTest() { try { SwipeType.SwipeType swipeType = new MatchSwipeType(File.ReadAllLines("EnglishDictionary.txt")); var testing = new Dictionary <string, List <string> > { ["heqerqllo"] = new List <string> { "hello", "hero", "ho" }, ["wertyuioiuytrtghjklkjhgfd"] = new List <string> { "weird", "world", "would" }, ["dfghjioijhgvcftyuioiuytr"] = new List <string> { "doctor", "door", "dour" }, ["asdfgrtyuijhvcvghuiklkjuytyuytre"] = new List <string> { "agriculture", "article", "adjure" } }; foreach (var s in testing) { foreach (var x in swipeType.GetSuggestion(s.Key, 3)) { s.Value.Remove(x); } } foreach (var s in testing) { if (s.Value.Count > 0) { Assert.Fail("GetSuggestionTest fail with new match"); } } } catch (Exception ex) { Assert.Fail($"GetSuggestionTest fail with exception: {ex}"); } }
public IEnumerator Swype() { foreach (var x in matchSwipeType.GetSuggestion(outputText, 2)) { Debug.Log(x); } outputText = ""; yield return(null); }
public IEnumerable <string> analyzeInputNeargye(Dictionary <long, double[]> moveHistory) { char test = '`'; char consecutiveChar = '0'; int counter = 0; try { List <KeyValuePair <char, int> > list = new List <KeyValuePair <char, int> >(); for (int i = 0; i < moveHistory.Count(); i++) { int count = 1; while (settleButton(moveHistory.ElementAt(i).Value[0], moveHistory.ElementAt(i).Value[1]) == settleButton(moveHistory.ElementAt(i + 1).Value[0], moveHistory.ElementAt(i + 1).Value[1])) { i++; count++; if (i + 1 == moveHistory.Count()) { break; } } list.Add(new KeyValuePair <char, int>(settleButton(moveHistory.ElementAt(i).Value[0], moveHistory.ElementAt(i).Value[1]), count)); } for (int i = 0; i < list.Count() - 2; i++) { if (i + 2 > list.Count() - 1) { break; } if (list.ElementAt(i + 1).Value < 10 && list.ElementAt(i + 0).Key == list.ElementAt(i + 2).Key) { list.RemoveAt(i + 1); } } string word = ""; foreach (var letter in list) { if (letter.Value > 0) { for (int i = 0; i < letter.Value; i++) { word += letter.Key; } } } moveHistory.Clear(); if (word.Length > 0) { var swype = new MatchSwipeType(File.ReadAllLines("EnglishDictionary.txt")); return(swype.GetSuggestion(word, 5)); } else { return(null); } } catch (Exception e) { return(null); } }
public void GetSuggestionTest() { try { SwipeType.SwipeType swipeType = new MatchSwipeType(File.ReadAllLines("EnglishDictionary.txt")); var testing = new Dictionary <string, List <string> > { ["heqerqllo"] = new List <string> { "hello", "hero", "ho" }, ["qwertyuihgfcvbnjk"] = new List <string> { "quick" }, ["wertyuioiuytrtghjklkjhgfd"] = new List <string> { "weird", "world", "would", "weld", "wild", "wold", "word", "wed" }, ["dfghjioijhgvcftyuioiuytr"] = new List <string> { "doctor", "door", "dour" }, ["aserfcvghjiuytedcftyuytre"] = new List <string> { "architecture", "architecure" }, ["asdfgrtyuijhvcvghuiklkjuytyuytre"] = new List <string> { "agriculture", "article", "adjure", "astute" }, ["mjuytfdsdftyuiuhgvc"] = new List <string> { "mystic", "music" }, ["vghjioiuhgvcxsasdvbhuiklkjhgfdsaserty"] = new List <string> { "vocabulary" } }; foreach (var s in testing) { foreach (var x in swipeType.GetSuggestion(s.Key)) { s.Value.Remove(x); } } foreach (var s in testing) { if (s.Value.Count > 0) { Assert.Fail("GetSuggestionTest fail with new match"); } } } catch (Exception ex) { Assert.Fail($"GetSuggestionTest fail with exception: {ex}"); } }