Upload folder using huggingface_hub
Browse files
common/__pycache__/language_detector.cpython-310.pyc
ADDED
|
Binary file (616 Bytes). View file
|
|
|
common/language_detector.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# backend/app/ml/common/language_detector.py
|
| 2 |
+
|
| 3 |
+
def detect_language(text: str) -> str:
|
| 4 |
+
"""
|
| 5 |
+
Detect language based on simple heuristic.
|
| 6 |
+
For now: basic English detection.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
# Very simple check (temporary)
|
| 10 |
+
if any(word in text.lower() for word in ["the", "and", "is", "are", "because"]):
|
| 11 |
+
return "en"
|
| 12 |
+
|
| 13 |
+
return "unknown"
|