Commit e12c6931 authored by Rémy Decoupes's avatar Rémy Decoupes
Browse files

better format output

parent 410a9dbe
......@@ -158,10 +158,14 @@ if __name__ == '__main__':
candidate_labels_fr = ["covid-19", "grippe aviaire", "AMR", "tiques", "autres"]
candidate_labels_en = ["covid-19", "avian influenza", "AMR", "tick borne", "others"]
classifier_results = []
for i, tweets in tqdm(df_tfidf.iterrows()):
for i, tweets in tqdm(df_tfidf.iterrows(), total=df_tfidf.shape[0]):
text = tweets["text"]
text_translated = translator_fr(text)[0]["translation_text"]
classifier_results.append(classifier(text_translated, candidate_labels_en)["scores"])
try:
text_translated = translator_fr(text)[0]["translation_text"]
classifier_results.append(classifier(text_translated, candidate_labels_en)["scores"])
except:
df_tfidf.drop([i], inplace=True)
print("text: " + text + " | translated: " + text_translated)
classifier_df = pd.DataFrame(classifier_results, columns=candidate_labels_en)
df_tfidf = df_tfidf.join(classifier_df)
df_tfidf.to_csv("analysis-output/acquitaine-digitalepidemiologylab.csv")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment