Skip to main content

Crate terraphim_rolegraph

Crate terraphim_rolegraph 

Source
Expand description

Knowledge graph implementation for per-role semantic search.

Each RoleGraph is a directed graph of Nodes (concepts) and Edges (co-occurrence relationships) built from indexed documents. An Aho-Corasick automaton provides O(n) concept detection over document text.

§Architecture

Thesaurus (JSON)
    |
    v
TriggerIndex (Aho-Corasick patterns)
    |
    v
RoleGraph (nodes + edges + document map)
    |
    v
Ranked search results

§Key Types

Modules§

input

Structs§

GraphStats
Statistics about the graph structure for debugging
RoleGraph
A RoleGraph is a graph of concepts and their relationships.
RoleGraphSync
Wraps the RoleGraph for ingesting documents and is Send and Sync
SerializableRoleGraph
A serializable representation of RoleGraph for JSON serialization/deserialization.
TriggerIndex
Simple TF-IDF index over trigger descriptions for semantic fallback search. Used when Aho-Corasick finds no exact synonym matches.

Enums§

Error
Errors produced by the role-graph knowledge graph operations.

Constants§

DEFAULT_TRIGGER_THRESHOLD
Default threshold for TriggerIndex relevance filtering.

Functions§

magic_pair
Magic pair - Cantor pairing function for edge IDs
magic_unpair
Magic unpair - inverse of Cantor pairing
split_paragraphs
Splits a block of text into individual sentences and clause fragments.