|
|
|
|
|
from transformers import pipeline |
|
import pandas as pd |
|
|
|
|
|
classifier = pipeline("zero-shot-classification", model="typeform/distilbert-base-uncased-mnli") |
|
|
|
def classify_rse_actions(descriptions): |
|
categories = [ |
|
"La gouvernance de la structure", |
|
"Les droits humains", |
|
"Les conditions et relations de travail", |
|
"La responsabilité environnementale", |
|
"La loyauté des pratiques", |
|
"Les questions relatives au consommateur et à la protection du consommateur", |
|
"Les communautés et le développement local" |
|
] |
|
|
|
classified_data = [] |
|
for description in descriptions: |
|
|
|
result = classifier(description, categories) |
|
|
|
top_category = result['labels'][0] |
|
classified_data.append(top_category) |
|
|
|
return classified_data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|