Annif icon indicating copy to clipboard operation
Annif copied to clipboard

Share vocabulary objects between projects

Open osma opened this issue 3 years ago • 0 comments

Currently, each AnnifProject creates its own vocabulary (AnnifVocabulary object, which wraps a SubjectIndex) even though in reality many projects may use the same vocabulary - which is now even more likely since vocabularies are multilingual (#600). This leads to unnecessary use of RAM and also CPU when the subject index has to be recreated many times.

Instead, the vocabularies could be moved under AnnifRegistry which currently only stores projects. The vocabularies could be loaded lazily as needed using a get_vocab method, similar to the current get_vocab method in annif.vocab.

osma avatar Aug 08 '22 08:08 osma