Examples¶
Complete scripts you can copy, save and run. They live in the examples/ folder of the repository and are shown here exactly as they are in the repo.
Install once:
The first run downloads the published model (about 1.1 GB) and caches it. Every script loads the model through this small helper, so you can point all of them at another model by setting the SINDHI_MODEL environment variable:
Save _model.py next to the script you want to run.
1. Classify text¶
One sentence, several sentences, and details of the model.
2. Classify a CSV file¶
Reads a UTF-8 CSV with a Text column, writes the same file with predicted_label and confidence added, and prints the rows a person should check. Blank rows do not stop the run.
The same job without writing code: sindhi-nlp batch --input reviews.csv --output reviews_scored.csv (tutorial).
3. Bad input and confidence thresholds¶
4. Call the HTTP API¶
Start the server first (Serve the API), then:
5. Evaluate on your own data¶
See Evaluate on your own data for how to build a labeled file and read the numbers.
From the command line¶
sindhi-nlp predict "اڄ جو ڏينهن تمام سٺو آهي"
sindhi-nlp predict "اڄ جو ڏينهن تمام سٺو آهي" "مون کي ڏاڍو ڏک ٿيو" --json
sindhi-nlp batch --input reviews.csv --output reviews_scored.csv
sindhi-nlp info
All commands and options are on the Command line page.