in lib/twitter_cldr/segmentation/thai_break_engine.rb [68:108]
def advance_past_suffix(cursor, end_pos, state)
suffix_length = 0
if cursor.position < end_pos && state.word_length > 0
uc = cursor.codepoint
candidates = state.words[state.words_found].candidates(
cursor, engine.dictionary, end_pos
)
if candidates <= 0 && suffix_set.include?(uc)
if uc == THAI_PAIYANNOI
unless suffix_set.include?(cursor.previous)
cursor.advance(2)
suffix_length += 1
uc = cursor.codepoint
else
cursor.advance
end
end
if uc == THAI_MAIYAMOK
if cursor.previous != THAI_MAIYAMOK
cursor.advance(2)
suffix_length += 1
else
cursor.advance
end
end
else
cursor.position = state.current + state.word_length
end
end
suffix_length
end