Cache Manipulations
Switching between cache files
Even if this sounds kind of hilarious, you can actually switch between cache files in LESP, basically by changing the cache_file
parameter in the Proofreader
class and then running the load_cache
method. This is useful if you want to use different cache files for different wordlists. For example, you can use the cache file lesp_cache/lesp.cache
for the wordlist lesp-wordlist.txt
and the cache file lesp_cache/lesp2.cache
for the wordlist lesp-wordlist2.txt
, so that you won't get any compatibility issues.
That's it! Now the cache file lesp_cache/lesp2.cache
will be used for the wordlist lesp-wordlist.txt
instead of the default cache file lesp_cache/lesp.cache
.
If you want to switch between cache files that will be used for get_similar
, you can do so by changing the cache_file
parameter in the get_similar
method. For example, if you want to use the cache file lesp_cache/lesp2.cache
for get_similar
instead of the default cache file lesp_cache/lesp.cache
, you can do so by running the following code:
Modifying your cache
If you want to manually change something in your cache, you can do so by accessing the cache
attribute of the Proofreader
object. The cache
attribute is a dictionary with the keys being the words and the values being the list of similar words. For example, if you want to set the cache for the word "hello" to ["hi", "hey", "hola"]
, you can do so by running the following code:
Clearing your cache
If you want to clear your cache, you can do so by running the clear_cache
method of the Proofreader
object. This will delete the cache file and the directory containing the cache file (if there is one).
Last updated