Downloads · 30 days
2
6% of all-time downloads
smillerr/xlm-roberta-sentiment-es
xlm-roberta-sentiment-es is a text classification model from smillerr. Use it when you need a label for a piece of text. The card lists the license as mit.
Modelo fine-tuned de FacebookAI/xlm-roberta-large para análisis de sentimientos en español.
Downloads · 30 days
2
6% of all-time downloads
All-time downloads
31
Public
Parameters
560M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 99%
From the Hugging Face model README
Modelo fine-tuned de FacebookAI/xlm-roberta-large para análisis de sentimientos en español.
from transformers import pipeline
import re
# Función de preprocesamiento
def procesar_texto(texto):
texto = str(texto)
texto = re.sub(r"http\S+", " ", texto)
texto = re.sub(r"@\w+", " ", texto)
texto = re.sub(r"#(\w+)", r"\1", texto)
texto = re.sub(r"[^\w\sáéíóúÁÉÍÓÚñÑ!?¿¡]", " ", texto)
texto = re.sub(r'\s+', ' ', texto.lower().strip())
return texto
# Cargar modelo
classifier = pipeline(
"text-classification",
model="smillerr/xlm-roberta-sentiment-es",
return_all_scores=False
)
# Ejemplo de uso
texto = "Me encanta este producto!"
texto_limpio = procesar_texto(texto)
resultado = classifier(texto_limpio)
print(resultado)
[{'label': 'LABEL_1', 'score': 0.9543}]
⚠️ Importante: Los textos deben ser preprocesados antes de clasificar para obtener mejores resultados.