Coverage for src/lilbee/retrieval/concepts/__init__.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-08-14 11:46 +0000

1"""Concept graph for LazyGraphRAG-style index-time knowledge extraction. 

2 

3Extracts noun-phrase concepts from chunks via spaCy, builds a PPMI-weighted 

4co-occurrence graph (Church & Hanks 1990), and clusters with Leiden 

5(Traag et al. 2019, graspologic-native). Used to boost search results by 

6concept overlap and expand queries via graph traversal. 

7 

8Requires optional ``graph`` extra: ``pip install lilbee[graph]``. 

9When dependencies are missing everything here degrades gracefully -- empty 

10results, ``concepts_available()`` False -- except ``load_spacy_pipeline``, 

11which raises ``ImportError`` by design so the caller can surface the model 

12download command. 

13""" 

14 

15from __future__ import annotations 

16 

17from lilbee.retrieval.concepts.clusterer import ConceptGraphClusterer 

18from lilbee.retrieval.concepts.community import Community 

19from lilbee.retrieval.concepts.graph import ConceptGraph 

20from lilbee.retrieval.concepts.nlp import concepts_available, load_spacy_pipeline 

21 

22__all__ = [ 

23 "Community", 

24 "ConceptGraph", 

25 "ConceptGraphClusterer", 

26 "concepts_available", 

27 "load_spacy_pipeline", 

28]