mmap_manager
Memory-mapped array management for Context Fabric.
Classes
class
MmapManager
Manages memory-mapped numpy arrays for a corpus.
Manages memory-mapped numpy arrays for a corpus.
Provides lazy loading and shared access to corpus data.
Parameters
----------
cfm_path : Path
Path to .cfm/{version}/ directory
Attributes
| Name | Type | Description |
|---|---|---|
| _arrays | dict[(str, NDArray[Any])] | — |
| _meta | dict[(str, Any)] | None | — |
| cfm_path | — | — |
| max_node | int | — |
| max_slot | int | — |
| meta | dict[(str, Any)] | Load and cache corpus metadata. |
| node_types | list[str] | — |
| slot_type | str | — |
Methods
__init__(self, cfm_path: Path | str) → NoneInitialize manager for a .cfm directory.
Parameters
cfm_path: Path | str
close(self) → NoneRelease all memory mappings.
exists(self) → boolCheck if the .cfm directory exists and has metadata.
get_array(self, path_parts: str = ()) → NDArray[Any]Get a memory-mapped array, loading lazily.
Parameters
path_parts: str= ()
get_csr(self, path_parts: str = ()) → CSRArrayGet CSR array pair.
Parameters
path_parts: str= ()
get_json(self, path_parts: str = ()) → AnyLoad a JSON metadata file.
Parameters
path_parts: str= ()
get_string_pool(self, feature_name: str) → StringPoolGet string pool for a string-valued feature.
Parameters
feature_name: str