in src/fmeval/eval_algorithms/qa_accuracy.py [0:0]
def _normalize_and_strip_text(text: str, *, normalize_text: bool = False, strip_text: bool = False) -> str:
"""
Combine two common operations -- normalization and stripping -- used by several metrics.
:param normalize_text: Normalize the text. We use the QuAC protocol for normalization.
:param strip_text: Strip the text, that is, remove whitespace characters from the beginning and end of the text.
:returns: The normalized (if the normalize_text flag was set to True) and stripped (if the strip_text flag was set
to True). If neither of the flags was set, the function returns the original text.
"""
if strip_text:
text = text.strip()
if normalize_text: # pragma: no branch
text = normalize_text_quac_protocol(text)
return text