File size: 1,214 Bytes
a4709f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Copyright 2026 Cobuild Tech Private Limited
# SPDX-License-Identifier: Apache-2.0
"""Run from the model folder:  python example.py   (every text below is invented for this example)"""
from cbx_intent import IntentClassifier

clf = IntentClassifier(".")
texts = [
    "कल सुबह सात बजे का अलार्म लगा दो",  # Hindi: set an alarm for seven tomorrow morning
    "আজ কলকাতার আবহাওয়া কেমন থাকবে",  # Bengali: what will the weather be like in Kolkata today
    "அம்மாவுக்கு ஒரு மின்னஞ்சல் அனுப்பு",  # Tamil: send an email to mum
    "ఈ పాట ఎవరు పాడారు",  # Telugu: who sang this song
    "ಲೈಟ್ ಆಫ್ ಮಾಡು",  # Kannada: turn the light off
    "ഇന്നത്തെ വാർത്തകൾ വായിക്കൂ",  # Malayalam: read today's news
    "میرے کیلنڈر میں کل کی میٹنگ دکھاؤ",  # Urdu: show tomorrow's meeting in my calendar
]
for text, r in zip(texts, clf.classify(texts)):
    print(f"{r['label']:<9} {max(r['scores'].values()):.2f}  {' '.join(text.split())}")