hearing.storage¶
Transcript persistence via key-value stores (python-storage / dol).
A transcript is standoff annotation data — persist the whole transcript (not
just a rolling window) so post-meeting agents see everything (see the
hearing-agents and annotation-systems skills). MeetingStore
saves/loads transcripts as JSON keyed by meeting id, over any
MutableMapping — a plain dict (tests), a dol store (e.g. TextFiles),
or the dependency-free filesystem fallback here. Meeting audio, being large binary
blobs, goes to a separate bytes store (MeetingStore(..., recordings=...)).
Functions
|
Return a bytes-valued |
|
Return a string-valued |
Reconstruct a |
|
|
Serialize a |
Classes
|
Save/load transcripts keyed by meeting id, over any text MutableMapping. |
- class hearing.storage.MeetingStore(store=None, *, recordings=None)[source]¶
Bases:
objectSave/load transcripts keyed by meeting id, over any text MutableMapping.
>>> store = MeetingStore({}) # in-memory >>> from hearing.types import Transcript, TranscriptSegment, TimeSpan >>> _ = store.save("m1", Transcript([TranscriptSegment("hi", TimeSpan(0, 500))])) >>> store.load("m1").text 'hi' >>> list(store) ['m1']
Recordings (the meeting audio) live in a separate bytes store, given as
recordings(aMutableMappingor a directory), under<meeting id>plus the audio’s extension when the id does not already end with it:>>> store = MeetingStore({}, recordings={}) >>> store.save_recording("m1", b"RIFF...", ext=".wav") 'm1.wav' >>> store.recording("m1") b'RIFF...'
- recording(meeting_id)[source]¶
The meeting’s audio bytes, as stored by
save_recording().- Return type:
- recording_key(meeting_id)[source]¶
The key of the meeting’s recording (
KeyErrorif there is none).- Return type:
- hearing.storage.get_bytes_store(path=None)[source]¶
Return a bytes-valued
MutableMapping(for recordings).None-> an in-memory dict; a path -> adol.Filesstore ifdolis installed, else the dependency-free_FileBytesStoreover that directory.- Return type:
- hearing.storage.get_store(path=None)[source]¶
Return a string-valued
MutableMappingfor transcripts.None-> an in-memory dict. A path -> adol.TextFilesstore ifdolis installed (pip install 'hearing[storage]'), else the dependency-free_FileTextStoreover that directory.- Return type:
- hearing.storage.transcript_from_json(s)[source]¶
Reconstruct a
Transcriptfromtranscript_to_json()output.- Return type: