patternaggregator

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package patternaggregator provides XML-style tag aggregation for LLM text streams. It detects open/close delimiters (e.g. " ` " and " ` ") and emits matches with the inner content, plus non-tag text segments. Used by IVR to extract DTMF, mode, and status commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	// contains filtered or unexported fields
}

Aggregator consumes incremental text and emits text segments and delimiter matches.

func New

func New(open, close string) *Aggregator

New creates an aggregator with the given open and close delimiter strings (e.g. " ` " and " ` ").

func (*Aggregator) Feed

func (a *Aggregator) Feed(text string) (textSegments []string, matches []Match)

Feed appends text and returns any complete text segments (before a match) and matches (content between delimiters). Call Flush when the stream ends to get any remaining buffered text.

func (*Aggregator) Flush

func (a *Aggregator) Flush() (remaining string)

Flush returns any remaining buffered text and clears the buffer.

type Match

type Match struct {
	Content string
}

Match holds the content between a pair of open/close delimiters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL