Skip to contents

This function generates a regular expression pattern to identify lines spoken by one or more specific speakers in an interview transcript. The pattern is designed to match the speaker's name enclosed in square brackets, followed by a space.

Usage

generate_speaker_pattern(speaker)

Arguments

speaker

A character vector of speaker identifiers.

Value

A string containing the regular expression pattern. If multiple speakers are provided, the patterns are combined using the "|" (OR) operator to match any of them.

Examples


speakers = retrieve_speaker(intrw)
pattern = generate_speaker_pattern(speakers)