internal/community
github.com/ensera-ai/taisce/internal/community · 3 files · 932 lines · 17 tests · source
Package community groups an entity graph into the subjects it contains.
A question with no anchor — "what have I been going back and forth on this month" — names no entity and resembles no single passage, so nothing in the read path can start. The answer is a property of the graph rather than of any row in it: a set of entities densely connected to each other and sparsely connected to everything else is a subject somebody has, whether or not they ever named it.
What this package is allowed to decide
How the graph is partitioned, and nothing else. It has no I/O, no clock and no database: it takes edges and returns groups. Whether a group is summarised, whether the summary is stored, and what an erasure does to it are decisions that live above this, and keeping them out is what lets them change without touching how a partition is made.
It also does not decide what an edge means. The caller supplies relations somebody asserted, which is what makes a group a set of things that genuinely bear on each other rather than a set of things whose text is alike.
Where it sits
Imports: none in this repository
Imported by: internal/formation, internal/infra/pg
Files
| File | Lines | Declarations | What it is for |
|---|---|---|---|
| graph.go | 260 | 10 | Carries the package documentation. |
| hierarchy.go | 195 | 10 | MaxSize is how many entities a group may hold before it is split again. |
| leiden.go | 477 | 20 | Resolution is how dense a group has to be to be one subject. |
17 tests hold this package's behaviour; the list is named for what each one proves.