private void FlushBigram()
{
ClearAttributes();
char[] termBuffer = termAtt.ResizeBuffer(4); // maximum bigram length in code units (2 supplementaries)
int len1 = Character.ToChars(buffer[index], termBuffer, 0);
int len2 = len1 + Character.ToChars(buffer[index + 1], termBuffer, len1);
termAtt.Length = len2;
offsetAtt.SetOffset(startOffset[index], endOffset[index + 1]);
typeAtt.Type = DOUBLE_TYPE;
// when outputting unigrams, all bigrams are synonyms that span two unigrams
if (outputUnigrams)
{
posIncAtt.PositionIncrement = 0;
posLengthAtt.PositionLength = 2;
}
index++;
}