1 2 3 4 5 6 7 8 9 10 11 12 13
''' Created on 12 mar 2014 @author: mlenart ''' from pyparsing import ParseException from morfeuszbuilder.utils import exceptions def pyparseString(rule, lineNum, line, filename): try: return rule.parseString(line, parseAll=True) except ParseException as ex:
14
msg = '%s:%d - Preprocessing of segmentation rules failed.\n' % (filename, lineNum)
15 16 17 18 19
msg += line + '\n' msg += (ex.col - 1) * ' ' + '^\n' msg += ex.msg # print unicode(exceptions.SegtypesException(msg)).encode('utf8') raise exceptions.SegtypesException(msg)