示例#1
0
 /// <summary>
 /// Set character gaze timings based on prediction suggestions.
 /// </summary>
 /// <param name="characterSuggestions">The character prediction suggestions.</param>
 public void SetCharacterSuggestions(IPredictionSuggestionCollection characterSuggestions)
 {
     _sendKeysProbabilities.Clear();
     foreach (var suggestion in characterSuggestions)
     {
         var normalizedText = NormalizedSendKeys(suggestion.Text);
         _sendKeysProbabilities.Add(normalizedText, suggestion.Confidence);
     }
 }
示例#2
0
        internal void UpdateOfferedList(IPredictionSuggestionCollection collection)
        {
            var fiddleFactor = AppSettings.Instance.Prediction.PredictionNovelty == PredictionNovelty.FromFirstLetter ? 0 : 1;

            using (var enumerator = collection.GetEnumerator())
            {
                var foundNovelty = false;
                while (!foundNovelty && enumerator.MoveNext())
                {
                    var candidate    = enumerator.Current;
                    var offeredLimit = Math.Min(offeredList.Count, candidate.ReplacementLength + fiddleFactor);

                    var matchPosition = 0;
                    while (matchPosition < offeredLimit && offeredList[matchPosition] != candidate.Text)
                    {
                        matchPosition++;
                    }

                    foundNovelty = matchPosition == offeredLimit;

                    if (foundNovelty && candidate.ReplacementLength + fiddleFactor != 0)
                    {
                        while (offeredList.Count < candidate.ReplacementLength + fiddleFactor)
                        {
                            offeredList.Add(null);
                        }

                        offeredList[candidate.ReplacementLength + fiddleFactor - 1] = candidate.Text;

                        var builder = new StringBuilder();
                        for (var i = 0; i < candidate.ReplacementLength + fiddleFactor; i++)
                        {
                            builder.AppendFormat(" - {0}", offeredList[i]);
                        }
                        Debug.WriteLine(builder);
                    }
                }
            }
        }
示例#3
0
 internal NoveltyWordPredictionSuggestionCollection(NoveltyWordPredictor predictor, IPredictionSuggestionCollection innerCollection)
     : base(innerCollection, predictor.NoveltyFunction)
 {
     this.innerCollection = innerCollection;
 }