foundation capa

foundation-text-clustering

Local-only embedding-based text clustering: groups texts by vector similarity into opaque, zero-based cluster labels. The embedding vector never leaves this call -- only the cluster label crosses any further disclosure boundary, since a raw vector for a short/constrained phrase can often be inverted back toward the source text (unlike a one-way opaque ID). Generic over infrastructure_embeddings::Embedder -- works with the dependency-free DeterministicEmbedder (lexical-overlap only, not semantic -- the honest default, no model download required) or the real ONNX BGE-m3 embedder behind that crate's `ort` feature (genuinely semantic, opt-in, needs the model present).

Local-only embedding-based text clustering: groups texts by vector similarity into opaque, zero-based cluster labels. The embedding vector never leaves this call -- only the cluster label crosses any further disclosure boundary, since a raw vector for a short/constrained phrase can often be inverted back toward the source text (unlike a one-way opaque ID). Generic over infrastructure_embeddings::Embedder -- works with the dependency-free DeterministicEmbedder (lexical-overlap only, not semantic -- the honest default, no model download required) or the real ONNX BGE-m3 embedder behind that crate's `ort` feature (genuinely semantic, opt-in, needs the model present).

Tierfoundation
Roleunclassified (baselined)
Pathcrates/foundation/text-clustering
Edition2021
Targetsfoundation_text_clustering
Public items1 across 0 modules
Tests5

What it is for

Local-only embedding-based text clustering: group texts by vector similarity into opaque, zero-based cluster labels via a simple greedy nearest-centroid pass (deterministic given a deterministic embedder and threshold -- no randomized initialization, no iteration count to tune).

The embedding vector never leaves this call. Only the cluster label crosses any further disclosure boundary. This matters: a raw embedding vector for a short, constrained phrase (a citation, a named entity) can often be inverted or nearest-neighbor-matched back toward the source text -- a real, published attack class. A one-way, non-invertible cluster label carries no such geometry to exploit, the same reason table-shard/transcript-shard/prose-shard disclose opaque P1/D1-style IDs and never a raw identifier.

Generic over infrastructure_embeddings::Embedder, so it works unchanged with either implementation already in this repo: the dependency-free DeterministicEmbedder (lexical/word-overlap similarity only -- NOT semantic, and this crate makes no claim otherwise; see that crate's own doc comment) with zero model download required, or the real ONNX BGE-m3 embedder behind infrastructure-embeddings's ort feature (genuinely semantic, opt-in, requires the model to actually be present).

Capabilities

crate root

Local-only embedding-based text clustering: group texts by vector

Item
async fn cluster_texts(embedder : & dyn Embedder, texts : & & str, similarity_threshold : f32,) -> Result <Vec <usize>, EmbeddingError>

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
async fn cluster_texts(embedder : & dyn Embedder, texts : & & str, similarity_threshold : f32,) -> Result <Vec <usize>, EmbeddingError>Cluster texts by embedding similarity

No pub use re-exports: every item above is declared in this crate.

Boundary

Reaches into infrastructure.

Shares tier foundation with 27 other crates: foundation-audit-log, foundation-basemodels, foundation-bounded-io, foundation-conversation-closure, foundation-crypto-sign, foundation-decisioning, foundation-encounter-vocabulary, foundation-fs-metadata, … (27 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)foundation
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/foundation/text-clustering
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_foundation["foundation"] --> n_infrastructure["infrastructure"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`infrastructure-embeddings`infrastructurenoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio^1full, macros, rtnoalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_domain_prose_shard["domain-prose-shard"] -->|uses| SELF
  SELF["foundation-text-clustering"]
  SELF -->|runtime| n_infrastructure_embeddings["infrastructure-embeddings"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libfoundation_text_clustering`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: domain-prose-shard.

Verification

KindCount
Unit tests5
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root101

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc11
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 1
    "No rustdoc detected" : 0

Metrics

MetricValue
Rust source files1
Source lines159
Code lines103
Public API items1
Public modules0
Tests5
Examples0
Cargo features0
Direct runtime dependencies1
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "function" : 1
pie showData
    title Rust source composition
    "Code" : 103
    "Blank or comment" : 56

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las foundation · Manual