File size: 888 Bytes
c97bd71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
"""Minimal Space-side inference example (also used as a smoke test).

    python3 examples/smoke.py            # inside the repo root
"""
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from inference import SyFox  # noqa: E402

PROBES = [
    "I was charged twice on my last invoice, please refund.",
    "Congratulations! You won a £1000 prize. Call 09058094518 now!",
    "The quarterback threw five touchdowns in the season opener.",
    "আমার কার্ড থেকে দুইবার টাকা কেটেছে, ফেরত চাই।",
]

if __name__ == "__main__":
    m = SyFox()
    for s in PROBES:
        r = m.decide(s)
        a = r["answers"]["domain"]
        print(f"[{r['script']:9s}] {a.get('choice'):5s} "
              f"conf={a.get('confidence', 0):.3f}  {s[:55]}")