I have a dictionary substring:count
Also I have a long string (10 million characters or more).
I need to enter the number of occurrences of a key substring in a string into the dictionary values.
def NGFT(normaled_text):
for tg in NGFT_Table:
NGFT_Table[tg] = normaled_text.count(tg)
I tried the simple approach, but it turned out to be incredibly slow.
I need to speed it up by 1-2 orders of magnitude. (Currently the running time is over a minute, but a hand-made counter in C# did the same operation in about 1 second.) But there it was done with the help of a string builder. For Python, as far as I understand, there is no stringbuilder.