<jupyter_start><jupyter_text>Load pickled df_lgbt<jupyter_code>with open('pickles/df_lgbt.pickle', 'rb') as f:
    df_lgbt = pickle.load(f)<jupyter_output><empty_output><jupyter_text>Load pickled df_map (test)<jupyter_code>with open('pickles/df_map_test.pickle', 'rb') as f:
    df_map = pickle.load(f)
translator = google_translator()
translate_text = translator.translate('Ich mag dich', lang_src='de', lang_tgt='en')
translate_text
df_lgbt['Story'].index<jupyter_output><empty_output><jupyter_text>Pickle translations_dict<jupyter_code># pickle translations_dict
with open('pickles/translations_dict.pickle', 'wb' ) as f:
    pickle.dump(translations, f)
# pickle translations_dict
with open('pickles/translations_header.pickle', 'wb' ) as f:
    pickle.dump(translations_header, f)<jupyter_output><empty_output><jupyter_text>Pickle df_lgbt_translated<jupyter_code># pickle df_lgbt_translated
with open('pickles/df_lgbt_translated.pickle', 'wb' ) as f:
    pickle.dump(df_lgbt_translated, f)
with open('pickles/df_map_translated.pickle', 'wb' ) as f:
    pickle.dump(df_map_translated, f)
df_map_translated = pd.DataFrame(df_map)
len(df_map_translated)
df_map_translated.drop(['Header', 'Story'], axis=1, inplace=True)
df_map_translated.rename(columns={'Story_EN':'Story', 'Header_EN':'Header'}, inplace=True)
df_lgbt_translated
df_map_translated['Story_EN'] = pd.Series(translations)
df_map_translated['Header_EN'] = pd.Series(translations_header)
df_lgbt_translated.drop(['Header', 'Story'], axis=1, inplace=True)
df_lgbt_translated.rename(columns={'Story_EN':'Story', 'Header_EN':'Header'}, inplace=True)
df_lgbt_translated = pd.DataFrame(df_lgbt)
df_lgbt['Header_EN'] = pd.Series(translations_header)
df_lgbt['Story_EN'] = pd.Series(translations)
translations_header = {}
for de_text, text_index in zip(df_lgbt['Header'], df_lgbt['Header'].index):
    en_text = translator.translate(de_text, lang_tgt='en')
    translations_header[text_index] = en_text
translations = {}
for de_text, text_index in zip(df_lgbt['Story'], df_lgbt['Story'].index):
    en_text = translator.translate(de_text, lang_tgt='en')
    translations[text_index] = en_text
df_lgbt[]
translator.translate('Hallo, ich heiße Filipe und das ist ein Test', dest='en')
[df_map.loc[1707, 'Story']]
df_map<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup