Update README.md
Browse files
README.md
CHANGED
|
@@ -20,27 +20,45 @@ This is a fine-tuned **Language-Agnostic BERT Sentence Embedding (LaBSE)** model
|
|
| 20 |
* **Base Architecture:** `sentence-transformers/LaBSE`
|
| 21 |
* **Task:** Text Classification (Intent Recognition)
|
| 22 |
* **Number of Classes:** 77 (Derived from the BANKING77 taxonomy)
|
| 23 |
-
* **Supported Languages:** English, Sinhala, Tamil, Singlish (Code-mixed), and Tanglish (Code-mixed).
|
| 24 |
|
| 25 |
-
##
|
| 26 |
-
This model
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
* **Architecture Decision:** Because of this sensitivity, the Swift backend dynamically routes **OCR-extracted text** to a robust Linear SVM, while routing **clean digital text** to this LaBSE model.
|
| 34 |
|
| 35 |
-
##
|
|
|
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
```python
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
| 20 |
* **Base Architecture:** `sentence-transformers/LaBSE`
|
| 21 |
* **Task:** Text Classification (Intent Recognition)
|
| 22 |
* **Number of Classes:** 77 (Derived from the BANKING77 taxonomy)
|
|
|
|
| 23 |
|
| 24 |
+
## Supported Languages & Scripts
|
| 25 |
+
This model has been robustly fine-tuned to handle both native scripts and Romanized (code-mixed) phonetic typing, which is highly prevalent in South Asian digital communication.
|
| 26 |
|
| 27 |
+
| Language | Script | Example Input |
|
| 28 |
+
|---|---|---|
|
| 29 |
+
| **English** | Latin | *"I lost my credit card yesterday"* |
|
| 30 |
+
| **Sinhala** | Sinhala | *"මගේ කාඩ් එක නැතිවුනා"* |
|
| 31 |
+
| **Singlish** | Latin (Code-mixed) | *"mage card eka nathi wela"* |
|
| 32 |
+
| **Tamil** | Tamil | *"என் கார்டு தொலைந்துவிட்டது"* |
|
| 33 |
+
| **Tanglish** | Latin (Code-mixed) | *"en card tholainthu vittathu"* |
|
| 34 |
|
| 35 |
+
## Use Case & Architecture
|
| 36 |
+
This model is intended to be used as the **Digital Text Router** in a hybrid multimodal pipeline. When a user submits a typed text ticket (without an image/screenshot), this model deeply analyzes the semantic context of the text to instantly categorize the ticket for the correct banking department.
|
|
|
|
| 37 |
|
| 38 |
+
## Evaluation & OCR Ablation Results
|
| 39 |
+
During our ablation studies, this Transformer model was evaluated against traditional Machine Learning algorithms (Linear SVMs) to determine its robustness to OCR-induced Character Error Rates (CER).
|
| 40 |
|
| 41 |
+
The F1-scores below represent how well the models retain intent-classification accuracy when forced to read noisy OCR text (Tesseract) extracted from varying image qualities, compared to clean ground-truth text.
|
| 42 |
+
|
| 43 |
+
| Image Quality Condition | LaBSE Raw OCR vs Clean | LaBSE+SpellCheck vs Clean | SVM Raw OCR vs Clean |
|
| 44 |
+
|---|---|---|---|
|
| 45 |
+
| `clean` | 49.70% | 31.17% | **94.15%** |
|
| 46 |
+
| `blur` | 39.56% | 30.74% | **45.32%** |
|
| 47 |
+
| `rotation` | 48.29% | 26.58% | **69.30%** |
|
| 48 |
+
| `low-resolution` | 30.05% | 25.47% | **30.36%** |
|
| 49 |
+
| **OVERALL** | 34.18% | 23.42% | **35.37%** |
|
| 50 |
+
|
| 51 |
+
**Conclusion:**
|
| 52 |
+
Transformers like LaBSE are highly sensitive to sub-word tokenization destruction caused by OCR typos. Because of this architectural sensitivity, the Swift backend dynamically routes **OCR-extracted text** to a robust Linear SVM (which proved to be 94.15% resilient on clean OCR), while routing **clean typed digital text** to this LaBSE model to leverage its superior deep semantic understanding.
|
| 53 |
+
|
| 54 |
+
## How to use via Serverless API
|
| 55 |
|
| 56 |
```python
|
| 57 |
+
import requests
|
| 58 |
|
| 59 |
+
API_URL = "https://api-inference.huggingface.co/models/Swift-Support/labse-intent-1.0"
|
| 60 |
+
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
|
| 61 |
|
| 62 |
+
# Sending a Singlish code-mixed ticket
|
| 63 |
+
response = requests.post(API_URL, headers=headers, json={"inputs": "mage card eka nathi wela"})
|
| 64 |
+
print(response.json())
|