private static int GetTextTypeAndValue(byte[] input, int maxLength, int idx) {
if (idx >= maxLength)
return 0;
char c = (char)(input[idx] & 0xff);
if (c >= 'A' && c <= 'Z')
return (ALPHA + c - 'A');
if (c >= 'a' && c <= 'z')
return (LOWER + c - 'a');
if (c == ' ')
return (ALPHA + LOWER + MIXED + SPACE);
int ms = MIXED_SET.IndexOf(c);
int ps = PUNCTUATION_SET.IndexOf(c);
if (ms < 0 && ps < 0)
return (ISBYTE + c);
if (ms == ps)
return (MIXED + PUNCTUATION + ms);
if (ms >= 0)
return (MIXED + ms);
return (PUNCTUATION + ps);
}