I'm using a dict file and Regular Expressions to change some words in a script but have now come across this error
Exception caught in plugin < class 'pagerprinter.plugins.tts.TTS' >
regular expression code size limit exceeded
my dict has some 5300 entries long set out as:
'SE': 'South East',
'NE': 'North East',
You get the idea changing abbreviations to full words. on average 6 - 8 abbreviations are changed.
for this I'm using
from abbreviations import abbreviations #mydict
pattern = re.compile(r'\b(' + '|'.join(abbreviations.keys()) + r')\b')
msg = pattern.sub(lambda x: abbreviations[x.group()], msg)
but I also use a further 4 more regexes for other tasks like removing words and numbers from the a number of strings.
What is the cause of the error I get? if I remove my dict it works if I have 300 entries it works.
looking into it from Google most people say that there are no limits on dict sizes.