Documentation Index
Fetch the complete documentation index at: https://mintlify.com/exegia/corpora-py/llms.txt
Use this file to discover all available pages before exploring further.
CorpusManager manages a collection of named Text-Fabric (Context-Fabric) corpora. It holds (Fabric, api) pairs keyed by name, giving you a single object that controls which corpus is active and how to access its API. The module-level singleton corpus_manager is pre-instantiated at import time and is used internally by all 11 MCP tools — you can also use it directly in scripts.
Import
Methods
load(path, name=None, features=None)
cfabric.Fabric and calls either tf.load(features) or tf.loadAll() depending on whether features is supplied. Sets the loaded corpus as current if it is the first corpus loaded into this manager instance.
Path to the directory containing
.tf files. Expanded with Path.expanduser() and resolved to an absolute path before use.Human-readable name to register the corpus under. Defaults to the basename of
path.Explicit list of feature names to load (e.g.
["otype", "lex", "g_word"]). When omitted, all features are loaded via loadAll().The corpus name used to register it (either the value passed as
name or the directory basename).| Exception | Condition |
|---|---|
FileNotFoundError | path does not exist on disk |
RuntimeError | cfabric.Fabric.load() returns False |
ImportError | context-fabric is not installed |
get_api(name=None)
name is omitted, the currently active corpus is used. The returned object exposes the standard TF API surfaces: api.S (search), api.F (features), api.T (text), api.L (locality), and others.
Name of the corpus to retrieve. Defaults to
corpus_manager.current.The Text-Fabric API object for the requested corpus.
| Exception | Condition |
|---|---|
RuntimeError | No corpus has been loaded yet |
KeyError | A named corpus was requested but is not registered |
list_corpora()
Ordered list of loaded corpus names.
select(name)
name. Does not reload or modify the corpus data.
Name of a corpus that is already loaded.
| Exception | Condition |
|---|---|
KeyError | The corpus has not been loaded |
unload(name)
(Fabric, api) tuple. If the removed corpus was the active current, resets current to the next corpus in the registration order, or None if nothing remains.
Name of the corpus to remove.
| Exception | Condition |
|---|---|
KeyError | The corpus has not been loaded |
Property
current
None when no corpus has been loaded. The active corpus is used as the default target by get_api() and all MCP tools.