7using System.Globalization;
95 string tokenAsString =
"";
117 tokenAsString = String.Format(
"<UNKNOWN TOKEN {0}>", token);
120 return tokenAsString;
133 StringBuilder output =
new StringBuilder();
135 CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
136 TextInfo textInfo = cultureInfo.TextInfo;
138 int numTokens = tokens.Length;
140 for (
int tokenIndex = 0; tokenIndex < numTokens; ++tokenIndex)
147 tokenAsString = textInfo.ToTitleCase(tokenAsString);
149 output.Append(tokenAsString);
152 if (tokenIndex + 2 < numTokens)
159 return output.ToString();
Representation of a simple interpreter.
static string[] _commonwords
The 40 most common words in English (in order but that doesn't really matter here)....
string _InterpretToken(int token)
Helper method to convert the token into its corresponding word or punctuation mark.
string Interpret(int[] tokens)
Given an array of integer tokens, convert the tokens into a single string of space-delimited words,...
The namespace containing all Design Pattern Examples implemented in C#.