File size: 2,781 Bytes
8618a3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b78fc16
8618a3a
5e2073d
8618a3a
 
 
 
 
 
 
 
 
5e2073d
8618a3a
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
license: mit
tags:
- text-classification
- multitask
- toxicity
- misandry
- misogyny
- offensive-language
- english
- slovak
- xlm-roberta
---

# 🛡️ LexiGuard: Misogyny, Misandry & Toxicity Detection in English and Slovak

**LexiGuard** is a multilingual multitask model designed to detect and classify offensive language, with a focus on **misogyny**, **misandry**, and **toxicity levels** in **English**. The model also supports **Slovak**, making it suitable for multilingual analysis of social media content.

It performs **dual classification**:
1. **Category**: Misogyny, Misandry, or Neutral  
2. **Toxicity level**: Low, Medium, or High

The model is based on [xlm-roberta-base](https://huggingface.co/xlm-roberta-base) and was fine-tuned on a custom dataset primarily in **English**, with additional annotated samples in **Slovak**.

---

## 🧠 Model Overview

- **Base model**: `xlm-roberta-base`
- **Tasks**: Multitask classification (2 output heads)
- **Primary language**: English  
- **Secondary language**: Slovak
- **Use case**: Detecting offensive, sexist, or toxic comments in multilingual social media

---

## 🛠️ Usage

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("Megyy/lexiguard")
model = AutoModelForSequenceClassification.from_pretrained("Megyy/lexiguard")

text = "Women are useless in politics."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)

# outputs.logits contains predictions for both tasks
```

> Note: The model has **two output heads**:
> - Head 1: Category (misogyny/misandry/neutral)
> - Head 2: Toxicity (low/medium/high)

---

## 📊 Label Definitions

**Task 1 – Category Classification**
- `0`: Neutral
- `1`: Misogyny
- `2`: Misandry

**Task 2 – Toxicity Prediction**
- `0`: Low
- `1`: Medium
- `2`: High

---

## 🧪 Training Data

- Over 5,000 manually annotated comments
- Domain: Online discussions, social media, and forums
- Language distribution:
  - ~80% English
  - ~20% Slovak

---

## 📁 Model Files

- `pytorch_model.bin` / `model.safetensors`: model weights
- `config.json`: model configuration
- `tokenizer.json`, `vocab.txt`, etc.: tokenizer files
- `README.md`: model card

---

## 📚 Citation

If you use this model in your work, please cite:

```
@bachelorsthesis{majercakova2025lexiguard,
  title={LexiGuard: Offensive Language Detection in English and Slovak Social Media},
  author={Magdalena Majercakova},
  year={2025},
  note={Bachelor's thesis, TUKE},
}
```

---

## 👨‍💻 Author

Developed by **Magdaléna Majerčáková** as part of a Bachelor's Thesis  
Supervised by **Ing. Zuzana Sokolová, PhD**  
Faculty of Electrical Engineering and Informatics, TUKE (2025)

---