|
|
--- |
|
|
license: apache-2.0 |
|
|
language: |
|
|
- it |
|
|
- fr |
|
|
- de |
|
|
- es |
|
|
- en |
|
|
base_model: |
|
|
- google-bert/bert-base-multilingual-cased |
|
|
pipeline_tag: text-classification |
|
|
library_name: transformers |
|
|
--- |
|
|
|
|
|
# π Multilingual Intent Classifier β Language Switching |
|
|
|
|
|
This model is a fine-tuned multilingual BERT (`bert-base-multilingual-cased`) for intent **classification** of **language-switching** requests. |
|
|
It recognizes when a user wants to change the conversation language and supports 5 language: |
|
|
|
|
|
- `english` |
|
|
- `italian` |
|
|
- `german` |
|
|
- `spanish` |
|
|
- `french` |
|
|
|
|
|
|
|
|
## It recognizes even other class of text like: |
|
|
|
|
|
- `other` (generic sentences not related to language switching) |
|
|
- `not_allowed` (unsupported languages) |
|
|
|
|
|
|
|
|
## π Training Data |
|
|
|
|
|
- ~6,000 training examples |
|
|
- Short conversational sentences (e.g. "Can we switch to English?", "Vorrei parlare in italiano", "Nein, bitte auf Deutsch"), and pieaces of conversation steps |
|
|
- Languages covered: English, Italian, German, Spanish, French |
|
|
- `not_allowed` and `other` provide robustness for real-world inputs |
|
|
--- |
|
|
|
|
|
## π Usage with π€ Transformers |
|
|
|
|
|
You can use the model directly with the `pipeline` API: |
|
|
|
|
|
```python |
|
|
from transformers import pipeline |
|
|
|
|
|
# Replace with the actual model repo |
|
|
model_name = "software-si/change-language-intent" |
|
|
|
|
|
classifier = pipeline( |
|
|
task="text-classification", |
|
|
model=model_name, |
|
|
tokenizer=model_name, |
|
|
return_all_scores=True |
|
|
) |
|
|
|
|
|
texts = [ |
|
|
"Vorrei parlare in italiano", |
|
|
"Can we switch to English?", |
|
|
"Nein, bitte auf Deutsch" |
|
|
] |
|
|
|
|
|
results = classifier(texts) |
|
|
|
|
|
for text, res in zip(texts, results): |
|
|
print(f"\nInput: {text}") |
|
|
for r in res: |
|
|
print(f" {r['label']}: {r['score']:.4f}") |