Generation

translateFri, 18 Nov 2022

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; }

TypeScript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code