Closed vvasuki closed 1 year ago
A confirmed fix you can copy paste:
@functools.cache
def _load_data():
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
with open(dir_path + "/yaml/aksharamukha-scripts.yaml", 'r') as stream:
data_loaded = yaml.safe_load(stream)
return data_loaded
def convert_default(src, tgt, txt, nativize = True, post_options = [], pre_options = []):
data_loaded = _load_data()
So much better:
Lines: 7%|▋ | 26193/353348 [00:48<08:22, 650.91it/s]
Sweet. Thanks for this. I'll implement and push the changes.
V
This will be pushed in the next update.
In case of multiple calls, aksharamukha is too slow.
Example:
Lines: 3%|▎ | 11175/353348 [13:32<7:01:17, 13.54it/s]
I believe this can be resolved by using an LRU cache in case of costly operations like:
Tip: if this were a function, you could have used a decorator like https://docs.python.org/3/library/functools.html