def read(path, filename): sents = splitby(newline, dropwhile(negate(newline), open(path + filename, encoding='utf-8')), first=True) sents = (' '.join(sent) for sent in sents if not sent[0].startswith("*INT:")) return [between(sent, ":", "%").split() for sent in sents]
def classify(row): "[[lev.Rule]] -> {utf-8-char:set<lev.Rule>}" return dct.map( set, dct.collapse(filter(negate(self_sub), concat(row)), keymap=lambda rule: rule.src) # collapse_envs, )