% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rename_speaker.R
\name{rename_speaker}
\alias{rename_speaker}
\title{Rename speakers in an interview transcript}
\usage{
rename_speaker(interview, current_speaker, new_speaker)
}
\arguments{
\item{interview}{A character vector representing the interview
transcript lines. Each line should start with a speaker tag in
the format \verb{[Speaker Name]}.}

\item{current_speaker}{A character vector containing the current
speaker names to be replaced. These should not include the square
brackets or trailing space; the function handles the formatting
automatically.}

\item{new_speaker}{A character vector containing the replacement
speaker names. This vector must have the same length as
\code{current_speaker}, with each element corresponding to the speaker
at the same position in \code{current_speaker}.}
}
\value{
A character vector with the same structure as the input
\code{interview}, but with the specified speaker names replaced.
}
\description{
This function replaces specified speaker identifiers with new names
throughout an interview transcript. It is useful for anonymizing
data, standardizing speaker names, or correcting transcription
errors. The replacement is performed using regular expressions to
ensure exact matching of the speaker tag format "[Name]".
}
\examples{
speaker = retrieve_speaker(intrw)
intrw_renamed = rename_speaker(
    interview = intrw, 
    current_speaker = speaker[!speaker == "UNKNOWN"],
    new_speaker = c("Mary", "Marylou")
)

}
\seealso{
Other process interview:
\code{\link[=concatenate_intervention]{concatenate_intervention()}},
\code{\link[=generate_speaker_pattern]{generate_speaker_pattern()}},
\code{\link[=prep_interview]{prep_interview()}},
\code{\link[=process_interview]{process_interview()}},
\code{\link[=process_structured_interview]{process_structured_interview()}},
\code{\link[=read_interview]{read_interview()}},
\code{\link[=retrieve_speaker]{retrieve_speaker()}},
\code{\link[=structure_interview]{structure_interview()}},
\code{\link[=unlist_processed_interview]{unlist_processed_interview()}},
\code{\link[=write_interview]{write_interview()}}
}
\concept{process interview}
