Skip to contents

Removes editorial annotations in square brackets, parentheses, and curly braces from political speech transcripts. Also normalizes whitespace and collapses double em-dashes left behind by removals.

Usage

clean_text(x)

Arguments

x

A character vector of text to clean.

Value

A character vector with annotations removed and whitespace normalized.

Examples

clean_text("We must act now [applause] for the future.")
#> [1] "We must act now for the future."
clean_text("The president (speaking loudly) left the room.")
#> [1] "The president left the room."