Collection<String> bagOfWords = new ArrayList<String>(text.length);
for (int i = 0; i < text.length; i++) {
if (useOnlyAllLetterTokens) {
StringPattern pattern = StringPattern.recognize(text[i]);
if (pattern.isAllLetter())
bagOfWords.add("bow=" + text[i]);
}
else {
bagOfWords.add("bow=" + text[i]);
}