public string GetSuggestionText(int suggestionIndex = -1) { if (!IsInitialized) { throw new InvalidOperationException("The session has not been initialized."); } IEnumerable <string> words = suggestionIndex == -1 ? (IEnumerable <string>)Suggestion : Suggestion.Take(suggestionIndex + 1); // TODO: use detokenizer to build suggestion text string text = string.Join(" ", words); if (IsLastWordComplete) { return(text); } string lastToken = Prefix[Prefix.Length - 1]; return(text.Substring(lastToken.Length, text.Length - lastToken.Length)); }