cueseg: chapter by vectors somebody else made, where there are some

The hashed bag of words asks only whether two stretches repeat the same
words, and cannot tell that ships and vessels are one subject. An embedding
can. segment_with takes one vector per window and falls back to the words
when it is given none, or the wrong number of them — a caller that embedded
some other recording's windows is asking about that recording.

windows_of gives the text to embed, in the order the vectors come back in,
so nobody has to reimplement the windowing pass to use this.

Bound in all three languages, and on the command line as --windows and
--embeddings, which pipe through emb. The C ABI version goes to 2:
catena_segment_cues gained an argument.
This commit is contained in:
funkpower
2026-09-20 09:12:04 -04:00
parent dd09499e68
commit 0b849c39c4
14 changed files with 359 additions and 24 deletions
+14 -1
View File
@@ -25,7 +25,7 @@ extern "C" {
/* Bumped when the meaning or signature of anything here changes. Additions
* leave it alone. Check it against CATENA_ABI_VERSION at load time. */
#define CATENA_ABI_VERSION 1u
#define CATENA_ABI_VERSION 2u
unsigned int catena_abi_version(void);
@@ -58,6 +58,19 @@ char *catena_parse_subtitles(const char *content, int keep_repeats);
* budget means the default. Returns a JSON array of chunks. */
char *catena_pack_cues(const char *cues, double seconds, size_t max_tokens);
/* Cut a timed transcript into topic chapters. `cues` is a JSON array of
* cues. `embeddings` is a JSON array of one vector per window, or NULL to
* compare windows by the words they repeat. A duration of zero or less is
* taken from the last cue. Returns a JSON array of segments. */
char *catena_segment_cues(const char *cues,
double duration,
const char *embeddings);
/* The text of each window a transcript is measured in, in the order
* catena_segment_cues expects vectors back. Returns a JSON array of
* strings. */
char *catena_cue_windows(const char *cues);
/* Split a collection into the works inside it. Returns a JSON array of
* sections, or NULL when the document is one work rather than a collection —
* an answer, not a failure; the reason is in catena_last_error. */