def remove_common_prefix(x, prefix, ws_prefix): x["completion"] = x["completion"].str[len(prefix) :] if ws_prefix: # keep the single whitespace as prefix x["completion"] = " " + x["completion"] return x
function removeCommonPrefix(x: any, prefix: any, wsPrefix: any): any { x["completion"] = x["completion"].str[len(prefix) :]; if (wsPrefix) { x["completion"] = " " + x["completion"]; } return x; }