-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add cache layer to Tagger #3
Comments
Thanks for the advice. I interpreted adding some lines |
you may add a singleton tagger instance to init.py as a shorthand method that use the default dictionary and implement a initialize method for actually make io happen and use a cache layer, when call |
Regarding a cache layer, should I refer to methods written on lines 91 to 168 in https://github.com/fxsjy/jieba/blob/master/jieba/__init__.py and add them to the class Tagger? |
not sure about.that ,you.may consider use https://docs.python.org/3/library/functools.html#functools.lru_cache for keep code simple |
if instantiating Tagger at function level it will load dictionary every time,
if instantiating Tagger at module level it will load dictionary therefore may not actually use
refer to https://github.com/fxsjy/jieba/blob/master/jieba/__init__.py
The text was updated successfully, but these errors were encountered: