def text2labels(text, sents):
labels = [c for c in text]<EOL>for sent in sents:<EOL><INDENT>start = text.index(sent)<EOL>finish = start + len(sent)<EOL>labels[start:finish] = '<STR_LIT:0>' * len(sent)<EOL><DEDENT>for i, c in enumerate(labels):<EOL><INDENT>if c != '<STR_LIT:0>':<EOL><INDENT>labels[i] = '<STR_LIT:1>'<EOL><DEDENT><DEDENT>return labels<EOL>
Marks all characters in given `text`, that doesn't exists within any
element of `sents` with `1` character, other characters (within sentences)
will be marked with `0`
Used in training process
>>> text = 'привет. меня зовут аня.'
>>> sents = ['привет.', 'меня зовут аня.']
>>> labels = text2labels(text, sents)
>>> ' '.join(text)
>>> 'п р и в е т .   м е н я   з о в у т   а н я .'
>>> ' '.join(labels)
>>> '0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'