mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-23 17:31:41 +00:00
cache the language info (avoids 10x slowdown)
This commit is contained in:
parent
b162de353d
commit
0cb36aa74f
@ -1,3 +1,4 @@
|
||||
from functools import lru_cache
|
||||
from langcodes import Language, best_match
|
||||
|
||||
|
||||
@ -34,6 +35,7 @@ def _language_in_list(language, targets, min_score=80):
|
||||
return matched[1] > 0
|
||||
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def get_language_info(language):
|
||||
"""
|
||||
Looks up the things we need to know about how to handle text in a given
|
||||
|
Loading…
Reference in New Issue
Block a user