}
return repeatsMap;
}
private static List<String> toDocumentList(Corpus<String> corpus, Map<Integer, Integer> repeatsMap) {
IntSequence sequence = corpus.sequence();
List<String> documents = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
int prevRepeatNumber = -1;
int docNumber = 0;
boolean isFirst = true;
boolean isBlockStart = false;
for (int i = 0; i < sequence.size(); i++) {
Integer repeatNumber = repeatsMap.get(i);
if (prevRepeatNumber != -1 && (repeatNumber == null || prevRepeatNumber != repeatNumber)) {
sb.append("}");
}
if (repeatNumber != null && prevRepeatNumber != repeatNumber) {
sb.append(String.format(" {\\color{%s}", TikzConstants.VECTOR_STYLES[repeatNumber].getColour()));
isBlockStart = true;
}
if (repeatNumber != null) {
prevRepeatNumber = repeatNumber;
} else {
prevRepeatNumber = -1;
}
int docId = corpus.getDocumentId(i);
if (docNumber != docId) {
docNumber = docId;
documents.add(sb.toString());
sb = new StringBuilder();
}
int symbol = sequence.get(i);
String token = corpus.toToken(symbol);
if (!corpus.isSeparator(symbol)) {
if (isFirst) {
isFirst = false;
} else if (!token.equals(",") && !token.equals(".") && !isBlockStart) {