Skip to content
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

Caching Resource #23

Closed
pratikpoddar opened this issue May 11, 2014 · 1 comment
Closed

Caching Resource #23

pratikpoddar opened this issue May 11, 2014 · 1 comment

Comments

@pratikpoddar
Copy link

Running

import langid
langid.classify("India is a country") ## statement number 1

takes a lot of time to run "statement number 1".

but,

import langid
langid.classify("I like cricket")
langid.classify("India is a country") ## statement number 2

does not take a lot of time to run "statement number 2".

So, Does langid.classify caches some information? Can we manage that? Thanks

@saffsd
Copy link
Owner

saffsd commented May 11, 2014

The module-level function 'classify' is just a convenience wrapper of a LanguageIdentifier instance, which checks if a global instance exists. If not, it unpacks one - this is why it takes time for the first run. If you want to invoke the unpacking manually, call langid.load_model() first. This will cause the model to be loaded into memory (which can then be accessed as langid.identifier). No other caching occurs.

@saffsd saffsd closed this as completed May 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants