socio4health.utils.harmonizer_utils.s4h_translate_column#

socio4health.utils.harmonizer_utils.s4h_translate_column(data: DataFrame, column: str, language: str = 'en') → DataFrame[source]#

Translates Portuguese or Spanish content in a DataFrame to English using a local model.

The model is downloaded on first use and then reused from the local Hugging Face cache. Repeated values are translated only once per Python process.

Parameters:
  • data (pd.DataFrame) – The DataFrame containing the text columns.

  • column (str) – Name of the column to translate.

  • language (str) – Target language code. The bundled translation model currently supports English (en) as its target language.

Return type:

Original DataFrame with new column translated.