示例#1
0
from util import helianthate

mask = helianthate([[1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0]], 'right', 'right', action = 'new')
input = file('crito-52-input.txt', 'r').read().strip()
glued = [[input[0]]]

separators = ('\\a', '\\e', '\\h', '\\i', '\\o', '\\u', '\\w')

for x in input[1 : ]:
    attached = False
    for s in separators:
        if s in glued[-1][-1][-4 : ]:
            attached = True
            glued[-1].append(x)
            break
    if not attached:
        if x == 'v':
            glued[-1].append(x)
        else:
            glued.append([x])

result = []
for i, token in enumerate(glued):
    word = ' '.join(token)
    if mask[i % len(mask)] == 0 or len(word) <= 6:
        result.append(r'\textcolor{white}{%s}' % word)
    else:
        result.append(r'\textcolor{red}{%s}' % word)
file('crito-52-output-1.txt', 'w').write(' '.join(result))

### 2 ###