#-*- coding: utf-8 -*- import re import sys #from collatex import * #python collatex def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) class RuleConditions(object): def match_nomsac(self, token, decision): if 'only_nomsac' in decision['conditions'].keys() and decision['conditions']['only_nomsac'] == True \ and ('nomSac' not in token.keys() or token['nomSac'] == False): return False return True def ignore_unclear_legacy(self, decision_word, token_words): decision_word = decision_word.replace('_', '') token_words = [w.replace('_', '') for w in token_words] return(decision_word, token_words) def ignore_unclear(self, decision_word, token_words): decision_word = decision_word.replace('̣', '') token_words = [w.replace('̣', '') for w in token_words] decision_word = decision_word.replace('_', '') token_words = [w.replace('_', '') for w in token_words] return (decision_word, token_words) def ignore_supplied(self, decision_word, token_words): decision_word = re.sub('\[(?!\d)', '', re.sub('(? 0: newchars = [] for char in token['interface']: newchars.append(char.lower()) if newchars[-1] == u'σ': newchars[-1] = u'ς' token['interface'] = ''.join(newchars) return token else: return token def hide_supplied_text(self, token): token['interface'] = re.sub('\[(?!\d)', '', re.sub('(?